Package dap4.core.dmr
Class DapNode
- java.lang.Object
-
- dap4.core.dmr.DapNode
-
- Direct Known Subclasses:
DapAttribute,DapDimension,DapEnumConst,DapGroup,DapMap,DapType,DapVariable
public abstract class DapNode extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<Object,Object>annotationsprotected Map<String,DapAttribute>attributesDAP Attributes attached to this node (as opposed to the xml attributes)protected DapDatasetdatasetprotected StringescapednameEscaped version of shortnameprotected StringfqnFully qualified name; note that this is always backslash escapedprotected intindexAssign unique id to all nodes.protected DapNodeparentParent DapNode; may be: - Group (for e.g.protected StringshortnameUnqualified (short) name of this node wrt the tree.protected DapSortsortAssign a "sort" to this node to avoid use of instanceof().protected Map<String,String>xmlattributesXML Attributes attached to this node.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttribute(DapAttribute attr)voidaddXMLAttribute(String name, String value)DapNodeannotate(Object id, Object value)Objectannotation(Object id)Stringcomputefqn()Compute the FQN of this nodeDapAttributefindAttribute(String name)Map<String,DapAttribute>getAttributes()DapNodegetContainer()Closest containing group, structure, sequenceList<DapNode>getContainerPath()Get the transitive list of containers Not including this nodeDapDatasetgetDataset()StringgetEscapedShortName()Here, escaped means backslash escaped short nameStringgetFQN()DapGroupgetGroup()Closest containing groupList<DapGroup>getGroupPath()Get the transitive list of containing groups Possibly including this nodeintgetIndex()DapNodegetParent()List<DapNode>getPath()Compute the path upto, and including some specified containing node (null=>root) The containing node is included as is this node.StringgetShortName()DapSortgetSort()Map<String,String>getXMLAttributes()booleanisTopLevel()voidoverrideParent(DapNode parent)Same as setparent except existing parent can be non-nullvoidremoveAttribute(DapAttribute attr)Used by AbstractDSP to suppress certain attributes.voidremoveXMLAttribute(String name)DapAttributesetAttribute(DapAttribute attr)voidsetAttributes(Map<String,DapAttribute> alist)voidsetDataset(DapDataset dataset)voidsetIndex(int index)voidsetParent(DapNode parent)Set the parent DapNode; may sometimes be same as container, but not always (think attributes or maps).voidsetShortName(String shortname)voidsetSort(DapSort sort)StringtoString()
-
-
-
Field Detail
-
sort
protected DapSort sort
Assign a "sort" to this node to avoid use of instanceof().
-
index
protected int index
Assign unique id to all nodes. Id is unique relative to the whole tree only. and reflects the order within nodelist
-
shortname
protected String shortname
Unqualified (short) name of this node wrt the tree. This is raw (unescaped)
-
escapedname
protected String escapedname
Escaped version of shortname
-
parent
protected DapNode parent
Parent DapNode; may be: - Group (for e.g. variables, dimensions, and Types), - Structure, Sequence for Fields - Variable (for e.g. attributes or maps).
-
dataset
protected DapDataset dataset
-
fqn
protected String fqn
Fully qualified name; note that this is always backslash escaped
-
attributes
protected Map<String,DapAttribute> attributes
DAP Attributes attached to this node (as opposed to the xml attributes)
-
xmlattributes
protected Map<String,String> xmlattributes
XML Attributes attached to this node. Used to pass reserved extra info to the client.
-
-
Constructor Detail
-
DapNode
public DapNode()
-
DapNode
public DapNode(String shortname)
-
-
Method Detail
-
getAttributes
public Map<String,DapAttribute> getAttributes()
-
setAttributes
public void setAttributes(Map<String,DapAttribute> alist)
-
setAttribute
public DapAttribute setAttribute(DapAttribute attr) throws DapException
- Throws:
DapException
-
addAttribute
public void addAttribute(DapAttribute attr) throws DapException
- Throws:
DapException
-
removeAttribute
public void removeAttribute(DapAttribute attr) throws DapException
Used by AbstractDSP to suppress certain attributes.- Parameters:
attr-- Throws:
DapException
-
findAttribute
public DapAttribute findAttribute(String name)
-
addXMLAttribute
public void addXMLAttribute(String name, String value) throws DapException
- Throws:
DapException
-
removeXMLAttribute
public void removeXMLAttribute(String name) throws DapException
- Throws:
DapException
-
getSort
public DapSort getSort()
-
setSort
public void setSort(DapSort sort)
-
getIndex
public int getIndex()
-
setIndex
public void setIndex(int index)
-
getDataset
public DapDataset getDataset()
-
setDataset
public void setDataset(DapDataset dataset)
-
getGroup
public DapGroup getGroup()
Closest containing group- Returns:
- closest group not equal to this or null if this is a DapDataset
-
getContainer
public DapNode getContainer()
Closest containing group, structure, sequence- Returns:
- closest container
-
getParent
public DapNode getParent()
-
setParent
public void setParent(DapNode parent)
Set the parent DapNode; may sometimes be same as container, but not always (think attributes or maps). Invariant: parent must be either a group or a variable. We can infer the container, so set that also.- Parameters:
parent- the proposed parent node
-
overrideParent
public void overrideParent(DapNode parent)
Same as setparent except existing parent can be non-null- Parameters:
parent- the proposed parent node
-
getShortName
public String getShortName()
-
setShortName
public void setShortName(String shortname)
-
getEscapedShortName
public String getEscapedShortName()
Here, escaped means backslash escaped short name- Returns:
- escaped name
-
getFQN
public String getFQN()
-
getPath
public List<DapNode> getPath()
Compute the path upto, and including some specified containing node (null=>root) The containing node is included as is this node.- Returns:
- ordered list of parent nodes
-
getContainerPath
public List<DapNode> getContainerPath()
Get the transitive list of containers Not including this node- Returns:
- list of container nodes
-
getGroupPath
public List<DapGroup> getGroupPath()
Get the transitive list of containing groups Possibly including this node- Returns:
- list of group nodes
-
computefqn
public String computefqn()
Compute the FQN of this node
-
isTopLevel
public boolean isTopLevel()
-
-