1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-23 00:03:53 +02:00

[cleanup] format and javadoc

This commit is contained in:
David Dykstal 2006-09-19 15:51:12 +00:00
parent cb9c4eb6cc
commit 408451566e
3 changed files with 53 additions and 64 deletions

View file

@ -15,6 +15,7 @@
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.references; package org.eclipse.rse.internal.references;
import org.eclipse.rse.core.references.IRSEBasePersistableReferencedObject; import org.eclipse.rse.core.references.IRSEBasePersistableReferencedObject;
/** /**
@ -24,36 +25,31 @@ import org.eclipse.rse.core.references.IRSEBasePersistableReferencedObject;
* so unique that it can be used after restoration from disk to resolve a pointer to this * so unique that it can be used after restoration from disk to resolve a pointer to this
* specific object, in memory. * specific object, in memory.
*/ */
public class SystemPersistableReferencedObjectHelper public class SystemPersistableReferencedObjectHelper extends SystemReferencedObjectHelper implements IRSEBasePersistableReferencedObject {
extends SystemReferencedObjectHelper
implements IRSEBasePersistableReferencedObject
{
private String referenceName; private String referenceName;
/** /**
* Constructor for SystemPersistableReferencedObjectHelper * Constructor for SystemPersistableReferencedObjectHelper
* @param referenceName The unique name that can be stored to identify this object. * @param referenceName The unique name that can be stored to identify this object.
*/ */
protected SystemPersistableReferencedObjectHelper(String referenceName) protected SystemPersistableReferencedObjectHelper(String referenceName) {
{
super(); super();
setReferenceName(referenceName); setReferenceName(referenceName);
} }
/** /**
* Return the unique reference name of this object, as set in the constructor * @return the unique reference name of this object, as set in the constructor
*/ */
public String getReferenceName() public String getReferenceName() {
{
return referenceName; return referenceName;
} }
/** /**
* Set the unique reference name of this object. Overrides what was set in * Set the unique reference name of this object. Overrides what was set in
* the constructor. Typically called on rename operation. * the constructor. Typically called on rename operation.
* @param name the name of this particular reference.
*/ */
public void setReferenceName(String name) public void setReferenceName(String name) {
{
this.referenceName = name; this.referenceName = name;
} }

View file

@ -15,11 +15,11 @@
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.references; package org.eclipse.rse.internal.references;
import org.eclipse.rse.core.model.RSEModelObject; import org.eclipse.rse.core.model.RSEModelObject;
import org.eclipse.rse.core.references.IRSEBaseReferencingObject; import org.eclipse.rse.core.references.IRSEBaseReferencingObject;
import org.eclipse.rse.core.references.IRSEReferencedObject; import org.eclipse.rse.core.references.IRSEReferencedObject;
/** /**
* A class to encapsulate the operations required of an object which * A class to encapsulate the operations required of an object which
* supports references to it by other objects (SystemReferencingObject). * supports references to it by other objects (SystemReferencingObject).
@ -33,58 +33,57 @@ import org.eclipse.rse.core.references.IRSEReferencedObject;
/** /**
* @lastgen class SystemReferencedObjectImpl Impl implements SystemReferencedObject, EObject {} * @lastgen class SystemReferencedObjectImpl Impl implements SystemReferencedObject, EObject {}
*/ */
public abstract class SystemReferencedObject extends RSEModelObject implements IRSEReferencedObject public abstract class SystemReferencedObject extends RSEModelObject implements IRSEReferencedObject {
{ protected SystemReferencedObjectHelper helper = null;
protected SystemReferencedObjectHelper helper = null;
/** /**
* Default constructor. Typically called by EMF factory method. * Default constructor. Typically called by EMF factory method.
*/ */
protected SystemReferencedObject() protected SystemReferencedObject() {
{
super(); super();
helper = new SystemReferencedObjectHelper(); helper = new SystemReferencedObjectHelper();
} }
// ---------------------------------- // ----------------------------------
// IRSEReferencedObject methods... // IRSEReferencedObject methods...
// ---------------------------------- // ----------------------------------
/** /**
* Add a reference, increment reference count, return new count * Add a reference, increment reference count, return new count
* @param ref the referencing object
* @return new count of how many referencing objects reference this object. * @return new count of how many referencing objects reference this object.
*/ */
public int addReference(IRSEBaseReferencingObject ref) public int addReference(IRSEBaseReferencingObject ref) {
{
return helper.addReference(ref); return helper.addReference(ref);
} }
/** /**
* Remove a reference, decrement reference count, return new count * Remove a reference, decrement reference count, return new count
* @param ref the referencing object
* @return new count of how many referencing objects reference this object. * @return new count of how many referencing objects reference this object.
*/ */
public int removeReference(IRSEBaseReferencingObject ref) public int removeReference(IRSEBaseReferencingObject ref) {
{
return helper.removeReference(ref); return helper.removeReference(ref);
} }
/** /**
* Return a count of how many referencing objects reference this object. * @return a count of how many referencing objects reference this object.
*/ */
public int getReferenceCount() public int getReferenceCount() {
{
return helper.getReferenceCount(); return helper.getReferenceCount();
} }
/** /**
* Clear the list of referenced objects. * Clear the list of referenced objects.
*/ */
public void removeAllReferences() public void removeAllReferences() {
{
helper.removeAllReferences(); helper.removeAllReferences();
} }
/** /**
* Return a list of all referencing objects of this object * @return a list of all referencing objects of this object
*/ */
public IRSEBaseReferencingObject[] getReferencingObjects() public IRSEBaseReferencingObject[] getReferencingObjects() {
{
return helper.getReferencingObjects(); return helper.getReferencingObjects();
} }
} }

View file

@ -15,34 +15,32 @@
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.references; package org.eclipse.rse.internal.references;
import java.util.Vector; import java.util.Vector;
import org.eclipse.rse.core.references.IRSEBaseReferencedObject; import org.eclipse.rse.core.references.IRSEBaseReferencedObject;
import org.eclipse.rse.core.references.IRSEBaseReferencingObject; import org.eclipse.rse.core.references.IRSEBaseReferencingObject;
/** /**
* This is a class that implements all the methods in the IRSEReferencedObject. * This is a class that implements all the methods in the IRSEReferencedObject.
* It makes implementing this interface trivial. * It makes implementing this interface trivial.
* The easiest use of this class is to subclass it, but since that is not * The easiest use of this class is to subclass it, but since that is not
* always possible, it is not abstract and hence can be leveraged via containment. * always possible, it is not abstract and hence can be leveraged via containment.
*/ */
public class SystemReferencedObjectHelper implements IRSEBaseReferencedObject public class SystemReferencedObjectHelper implements IRSEBaseReferencedObject {
{
private Vector referencingObjects = new Vector(); private Vector referencingObjects = new Vector();
/** /**
* Constructor for SystemReferencedObjectHelper * Constructor for SystemReferencedObjectHelper
*/ */
public SystemReferencedObjectHelper() public SystemReferencedObjectHelper() {
{
super(); super();
} }
/** /**
* @see IRSEBaseReferencedObject#addReference(IRSEBaseReferencingObject) * @see IRSEBaseReferencedObject#addReference(IRSEBaseReferencingObject)
*/ */
public int addReference(IRSEBaseReferencingObject ref) public int addReference(IRSEBaseReferencingObject ref) {
{
referencingObjects.addElement(ref); referencingObjects.addElement(ref);
return referencingObjects.size(); return referencingObjects.size();
} }
@ -50,50 +48,46 @@ public class SystemReferencedObjectHelper implements IRSEBaseReferencedObject
/** /**
* @see IRSEBaseReferencedObject#removeReference(IRSEBaseReferencingObject) * @see IRSEBaseReferencedObject#removeReference(IRSEBaseReferencingObject)
*/ */
public int removeReference(IRSEBaseReferencingObject ref) public int removeReference(IRSEBaseReferencingObject ref) {
{
int before = referencingObjects.size(); int before = referencingObjects.size();
referencingObjects.removeElement(ref); referencingObjects.removeElement(ref);
int after = referencingObjects.size(); int after = referencingObjects.size();
assertThis((after == (before - 1)), "removeReference failed for "+ref); //$NON-NLS-1$ assertThis((after == (before - 1)), "removeReference failed for " + ref); //$NON-NLS-1$
return referencingObjects.size(); return referencingObjects.size();
} }
/** /**
* @see IRSEBaseReferencedObject#getReferenceCount() * @see IRSEBaseReferencedObject#getReferenceCount()
*/ */
public int getReferenceCount() public int getReferenceCount() {
{
return referencingObjects.size(); return referencingObjects.size();
} }
/** /**
* Clear the list of referenced objects. * Clear the list of referenced objects.
*/ */
public void removeAllReferences() public void removeAllReferences() {
{
referencingObjects.removeAllElements(); referencingObjects.removeAllElements();
} }
/** /**
* @see IRSEBaseReferencedObject#getReferencingObjects() * @see IRSEBaseReferencedObject#getReferencingObjects()
*/ */
public IRSEBaseReferencingObject[] getReferencingObjects() public IRSEBaseReferencingObject[] getReferencingObjects() {
{
IRSEBaseReferencingObject[] references = new IRSEBaseReferencingObject[referencingObjects.size()]; IRSEBaseReferencingObject[] references = new IRSEBaseReferencingObject[referencingObjects.size()];
for (int idx=0; idx<referencingObjects.size(); idx++) for (int idx = 0; idx < referencingObjects.size(); idx++)
references[idx] = (IRSEBaseReferencingObject)referencingObjects.elementAt(idx); references[idx] = (IRSEBaseReferencingObject) referencingObjects.elementAt(idx);
return references; return references;
} }
/** /**
* Little assertion method for debugging purposes * Assertion method for debugging purposes. All instances of assertion failure should be removed by
* FIXME Move to common place, protected seems not appropriate * release.
*/ * @param assertion a boolean (usually an expression) that is to be tested
protected void assertThis(boolean assertion, String msg) * @param msg the message printed on System.out
{ */
if (!assertion) protected void assertThis(boolean assertion, String msg) {
System.out.println("ASSERTION FAILED IN SystemReferencedObject: " + msg); //$NON-NLS-1$ if (!assertion) System.out.println("ASSERTION FAILED IN SystemReferencedObject: " + msg); //$NON-NLS-1$
} }
} }