From 17ca25453c171de25d8d6dcefb77f728bd010259 Mon Sep 17 00:00:00 2001 From: David Dykstal Date: Wed, 20 Sep 2006 19:36:25 +0000 Subject: [PATCH] [cleanup] format and javadoc --- .../SystemReferencingObjectHelper.java | 91 ++++++++++--------- 1 file changed, 46 insertions(+), 45 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemReferencingObjectHelper.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemReferencingObjectHelper.java index d65a20848a2..d56f7565440 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemReferencingObjectHelper.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemReferencingObjectHelper.java @@ -15,6 +15,7 @@ ********************************************************************************/ package org.eclipse.rse.internal.references; + import org.eclipse.rse.core.references.IRSEBaseReferencedObject; import org.eclipse.rse.core.references.IRSEBaseReferencingObject; @@ -24,61 +25,61 @@ import org.eclipse.rse.core.references.IRSEBaseReferencingObject; * 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. */ -public class SystemReferencingObjectHelper -{ - private IRSEBaseReferencedObject masterObject = null; - private IRSEBaseReferencingObject caller = null; - - /** - * Default constructor. - */ - public SystemReferencingObjectHelper(IRSEBaseReferencingObject caller) - { - super(); - this.caller = caller; - } - - /** - * Constructor that saves effort of calling setReferencedObject. - */ - public SystemReferencingObjectHelper(IRSEBaseReferencingObject caller, IRSEBaseReferencedObject obj) - { - this(caller); - setReferencedObject(obj); - } - +public class SystemReferencingObjectHelper { + + private IRSEBaseReferencedObject masterObject = null; + private IRSEBaseReferencingObject caller = null; + /** - * Set the object to which we reference. + * Default constructor. + * @param caller the reference that this object is helping. + */ + public SystemReferencingObjectHelper(IRSEBaseReferencingObject caller) { + super(); + this.caller = caller; + } + + /** + * Constructor that saves effort of calling setReferencedObject. + * @param caller the reference that this object is helping. + * @param obj the object to which this reference will point. + */ + public SystemReferencingObjectHelper(IRSEBaseReferencingObject caller, IRSEBaseReferencedObject obj) { + this(caller); + setReferencedObject(obj); + } + + /** + * Set the object to which this reference will point. * Stores the reference in memory, replacing whatever was there. - * Also, calls obj.addReference(caller); + * Also calls obj.addReference(caller); + * @param obj the object to which this reference will point. */ - public void setReferencedObject(IRSEBaseReferencedObject obj) - { + public void setReferencedObject(IRSEBaseReferencedObject obj) { this.masterObject = obj; - if (obj != null) - obj.addReference(caller); + if (obj != null) obj.addReference(caller); } - + /** - * Get the object which we reference + * Get the object which is referenced. May be null if the reference is not set or has not been resolved. + * Attempt to resolve the reference. + * @return the referenced object. */ - public IRSEBaseReferencedObject getReferencedObject() - { - return masterObject; + public IRSEBaseReferencedObject getReferencedObject() { + return masterObject; } - + /** - * Fastpath to getReferencedObject().removeReference(this). + * Removes this reference from the referenced object and clears this reference. * Also, nulls out our memory reference. * @return new reference count of master object */ - public int removeReference() - { - int newCount = 0; - IRSEBaseReferencedObject masterObject = getReferencedObject(); - if (masterObject != null) - newCount = masterObject.removeReference(caller); - masterObject = null; - return newCount; - } + public int removeReference() { + int newCount = 0; + IRSEBaseReferencedObject masterObject = getReferencedObject(); + if (masterObject != null) newCount = masterObject.removeReference(caller); + masterObject = null; + return newCount; + } + } \ No newline at end of file