public final class TemplateThing extends DBObject implements Thing, Comparable<TemplateThing>
Constructor and Description |
---|
TemplateThing(String type)
Create a new non-database-stored TemplateThing.
|
TemplateThing(String type,
Project project)
Create a new database-stored TemplateThing.
|
TemplateThing(String type,
Project project,
long id)
Reconstruct a TemplateThing from the database.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addChild(Thing child) |
void |
addToDatabase(Project project)
Recursive into children! Will add the attributes as well and grab an id for this instance.
|
boolean |
canHaveAsChild(Thing thing) |
TemplateThing |
clone(Project pr,
boolean copy_id)
Recursive into children: clones the whole tree from this node downward.
|
ArrayList<TemplateThing> |
collectAllChildren(ArrayList<TemplateThing> al)
Recursive into children.
|
HashSet<TemplateThing> |
collectSimilarThings(TemplateThing tt,
HashSet<TemplateThing> hs)
Recursive into children, find those of the given type that have the same immediate parent type as the given TemplateThing.
|
HashSet<TemplateThing> |
collectSimilarThings2(TemplateThing tt,
HashSet<TemplateThing> hs)
Recursive into children, find those of the same type as the given TemplateThing and whose number of children is the same to those of the given TemplateThing (to exclude nested types).
|
HashSet<TemplateThing> |
collectThingsOfEqualType(TemplateThing tt,
HashSet<TemplateThing> hs)
Find things of the same type, even if their parents are different, recusively into children.
|
int |
compareTo(TemplateThing o)
Compares the String type, for sorting purposes.
|
void |
debug(String indent) |
void |
exportDTD(StringBuilder sb_header,
HashSet<String> hs,
String indent)
Only the header !ELEMENT and !ATTLIST.
|
void |
exportXMLTemplate(StringBuffer sb_header,
StringBuffer sb_body,
HashSet<String> hs,
String indent) |
Thing |
findChild(Object ob)
Ah, we love interfaces don't we.
|
ArrayList<TemplateThing> |
getChildren() |
TemplateThing |
getChildTemplate(String type) |
String |
getInfo()
Return information on this node and its object.
|
Object |
getObject()
Returns null always, for TemplateThings don't hold any real object.
|
Thing |
getParent() |
protected ArrayList<TemplateThing> |
getTemplatePathTo(String type,
ArrayList<TemplateThing> al)
Returns the list of parents to reach a particular child, starting at this, and including the child.
|
String |
getType() |
HashMap<String,TemplateThing> |
getUniqueTypes(HashMap<String,TemplateThing> ht)
Recursive into children.
|
String |
getValue() |
boolean |
hasChildren() |
boolean |
isExpanded() |
boolean |
isNested()
Determine whether this instance is nested inside the tree of an instance of the same type (for example, a neurite_branch inside another neurite_branch)
|
boolean |
remove(boolean check)
Subclasses can override this method to perform other tasks before removing itself from the database.
|
boolean |
removeChild(TemplateThing child) |
protected void |
rename(String new_name)
Change the type to new_name.
|
void |
setParent(Thing parent) |
void |
setup(ArrayList<TemplateThing> al_children)
For reconstruction purposes.
|
void |
setValue(String value) |
Thing |
shallowCopy()
A new copy with same type, same project, same id, but no parent and no children.
|
String |
toString() |
boolean |
uniquePathExists(String type)
Check if a unique path exists through the child trees until reaching a Thing of the given type.
|
addToDatabase, exportXML, getId, getProject, getShortTitle, getTitle, getUniqueIdentifier, removeFromDatabase, updateInDatabase, updateInDatabase
public TemplateThing(String type)
public TemplateThing(String type, Project project)
public Thing shallowCopy()
shallowCopy
in interface Thing
public void setup(ArrayList<TemplateThing> al_children)
public void addToDatabase(Project project)
public void setValue(String value)
public String getValue()
public String toString()
public TemplateThing getChildTemplate(String type)
public ArrayList<TemplateThing> getChildren()
getChildren
in interface Thing
public boolean hasChildren()
hasChildren
in interface Thing
public boolean canHaveAsChild(Thing thing)
canHaveAsChild
in interface Thing
public boolean uniquePathExists(String type)
protected ArrayList<TemplateThing> getTemplatePathTo(String type, ArrayList<TemplateThing> al)
public Object getObject()
public Thing findChild(Object ob)
public HashMap<String,TemplateThing> getUniqueTypes(HashMap<String,TemplateThing> ht)
public ArrayList<TemplateThing> collectAllChildren(ArrayList<TemplateThing> al)
protected void rename(String new_name)
public boolean remove(boolean check)
DBObject
public boolean removeChild(TemplateThing child)
public HashSet<TemplateThing> collectSimilarThings(TemplateThing tt, HashSet<TemplateThing> hs)
public HashSet<TemplateThing> collectSimilarThings2(TemplateThing tt, HashSet<TemplateThing> hs)
public HashSet<TemplateThing> collectThingsOfEqualType(TemplateThing tt, HashSet<TemplateThing> hs)
public boolean isNested()
public void exportDTD(StringBuilder sb_header, HashSet<String> hs, String indent)
public void exportXMLTemplate(StringBuffer sb_header, StringBuffer sb_body, HashSet<String> hs, String indent)
public boolean isExpanded()
isExpanded
in interface Thing
public String getInfo()
public TemplateThing clone(Project pr, boolean copy_id)
public int compareTo(TemplateThing o)
compareTo
in interface Comparable<TemplateThing>
Copyright © 2015–2021 Fiji. All rights reserved.