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>
annotations
protected Map<String,DapAttribute>
attributes
DAP Attributes attached to this node (as opposed to the xml attributes)protected DapDataset
dataset
protected String
escapedname
Escaped version of shortnameprotected String
fqn
Fully qualified name; note that this is always backslash escapedprotected int
index
Assign unique id to all nodes.protected DapNode
parent
Parent DapNode; may be: - Group (for e.g.protected String
shortname
Unqualified (short) name of this node wrt the tree.protected DapSort
sort
Assign a "sort" to this node to avoid use of instanceof().protected Map<String,String>
xmlattributes
XML Attributes attached to this node.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttribute(DapAttribute attr)
void
addXMLAttribute(String name, String value)
DapNode
annotate(Object id, Object value)
Object
annotation(Object id)
String
computefqn()
Compute the FQN of this nodeDapAttribute
findAttribute(String name)
Map<String,DapAttribute>
getAttributes()
DapNode
getContainer()
Closest containing group, structure, sequenceList<DapNode>
getContainerPath()
Get the transitive list of containers Not including this nodeDapDataset
getDataset()
String
getEscapedShortName()
Here, escaped means backslash escaped short nameString
getFQN()
DapGroup
getGroup()
Closest containing groupList<DapGroup>
getGroupPath()
Get the transitive list of containing groups Possibly including this nodeint
getIndex()
DapNode
getParent()
List<DapNode>
getPath()
Compute the path upto, and including the root Dataset.String
getShortName()
DapSort
getSort()
Map<String,String>
getXMLAttributes()
boolean
isTopLevel()
void
overrideParent(DapNode parent)
Same as setparent except existing parent can be non-nullvoid
removeAttribute(DapAttribute attr)
Used by AbstractDSP to suppress certain attributes.void
removeXMLAttribute(String name)
DapAttribute
setAttribute(DapAttribute attr)
void
setAttributes(Map<String,DapAttribute> alist)
void
setDataset(DapDataset dataset)
void
setIndex(int index)
void
setParent(DapNode parent)
Set the parent DapNode; may sometimes be same as container, but not always (think attributes or maps).void
setShortName(String shortname)
void
setSort(DapSort sort)
String
toString()
-
-
-
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 (including DapDataset) 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 the root Dataset. This node is included as last element in path.- 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()
-
-