public class HierarchicObject extends HierarchicObjectDMW implements Comparable<HierarchicObject>
| Modifier and Type | Field and Description |
|---|---|
protected HierarchicObject |
parent |
core| Modifier | Constructor and Description |
|---|---|
|
HierarchicObject()
This constructor is used to create a "root" object that has no data and
acts merely as the root of a tree of objects.
|
protected |
HierarchicObject(HierarchicObjectDMO obj,
ClassDefinition cd) |
| Modifier and Type | Method and Description |
|---|---|
void |
addSubComponent(HierarchicObject ce)
Adds a subcomponent to this entry.
|
int |
compareTo(HierarchicObject o)
Implementation of the Comparable interface so that we can sort our children easily.
|
boolean |
equals(Object obj)
If the object is a HierarchicObject and has the same FQN as this object, they're equal.
|
HierarchicObject |
get(int i)
Returns the subcomp at the specified index or null if there are no subcomps or if the index is
out of bounds.
|
String |
getName()
We're overloading this to facilitate the way our JSON implementation will work.
|
HierarchicObject |
getParentObject() |
Iterator<HierarchicObject> |
getSubComps() |
void |
removeSubComponent(HierarchicObject ho) |
void |
removeSubcomponents()
This method removes all entries in our subcomponents Vector.
|
void |
resetParent(HierarchicObject newParent)
This method rehomes a branch of hierarchic objects to sit beneath the specified parent.
|
void |
saveToBuffer(StringBuffer sb,
int padding)
This method saves the entire hierarchy from this point to the string buffer.
|
void |
saveToBuffer(StringBuffer sb,
int padding,
boolean persistentOnly)
This method saves the entire hierarchy from this point to the string buffer.
|
void |
saveToFile(BufferedWriter out,
int padding)
This method will save an entire hierarchy of objects to the file attached to the specified
writer.
|
void |
saveToFile(BufferedWriter out,
int padding,
boolean persistentOnly)
This method will save an entire hierarchy of objects to the file attached to the specified
writer.
|
void |
setParentObject(HierarchicObject p)
This method sets the parent object for this object and reconstructs the FQN
as appropriate.
|
void |
setParentObject(HierarchicObject p,
boolean buildFQN)
This method sets the parent object for this object and reconstructs the FQN
as appropriate.
|
static void |
setSort(boolean f)
Sets the global flag that indicates whether or not we sort our subcomponents
by their FQN or not.
|
int |
size()
Returns the number of sub components.
|
cloneIt, getDMO, getFile, getFQN, getLineNumber, getModificationRecorder, getObjectName, getObjectNameAttribute, hashCode, remFile, remFQN, remLineNumber, setFile, setFile, setFQN, setFQN, setLineNumber, setLineNumberaddAux, applyModifier, getBackRefs, getConstructionClass, getConstructionClassInfo, getConstructionClassName, getDmcObject, getObjectClass, getReferringObjects, getReferringObjectsViaAttribute, hasAux, isReferenced, referenceCount, removeAux, resolveReferences, resolveReferences, serializeIt, setDmcObject, toJSON, toOIF, toOIF, toPersistentOIF, toString, youAreDeletedgetDeleted, getModifier, setDeleted, setModifierprotected HierarchicObject parent
public HierarchicObject()
protected HierarchicObject(HierarchicObjectDMO obj, ClassDefinition cd)
public Iterator<HierarchicObject> getSubComps()
public static void setSort(boolean f)
f - True to sort and false to leave the subcomps in the order they are added.public void setParentObject(HierarchicObject p) throws ResultException, DmcValueException
p - the parent object.ResultException - if there's no value for the naming attribute.DmcValueExceptionpublic void setParentObject(HierarchicObject p, boolean buildFQN) throws ResultException, DmcValueException
p - the parent object.buildFQN - Indicates if we need to reset this object's FQNs based on the parent.ResultException - if there's no value for the naming attribute.DmcValueExceptionpublic void resetParent(HierarchicObject newParent) throws ResultException, DmcValueException
newParent - DmcValueExceptionResultExceptionpublic HierarchicObject getParentObject()
public int size()
public HierarchicObject get(int i)
i - Index of the desired subcomp.public void removeSubcomponents()
public void removeSubComponent(HierarchicObject ho) throws ResultException, DmcValueException
ResultExceptionDmcValueExceptionpublic void addSubComponent(HierarchicObject ce)
ce - public int compareTo(HierarchicObject o)
compareTo in interface Comparable<HierarchicObject>public String getName()
public void saveToFile(BufferedWriter out, int padding) throws IOException
out - Writer to the file you want to save in.padding - The padding to be used when formatting the object..IOExceptionpublic void saveToFile(BufferedWriter out, int padding, boolean persistentOnly) throws IOException
out - Writer to the file you want to save in.padding - The padding to be used when formatting the object..persistentOnly - If true, only persistent objects will be saved. We stop recursing
down a branch when we hit a TRANSIENT object.IOExceptionpublic void saveToBuffer(StringBuffer sb, int padding)
sb - The buffer to which we append the object.padding - The padding to be used when formatting the object.public void saveToBuffer(StringBuffer sb, int padding, boolean persistentOnly)
sb - The buffer to which we append the object.padding - The padding to be used when formatting the object.persistentOnly - If true, only persistent objects will be saved. We stop recursing
down a branch when we hit a TRANSIENT object.public boolean equals(Object obj)
equals in interface DmcNamedObjectIFequals in class HierarchicObjectDMWobj - The comparison object.Copyright © 2023. All rights reserved.