jInfer

cz.cuni.mff.ksi.jinfer.base.objects.nodes
Class AbstractNamedNode

java.lang.Object
  extended by cz.cuni.mff.ksi.jinfer.base.objects.nodes.AbstractNamedNode
All Implemented Interfaces:
NamedNode
Direct Known Subclasses:
AbstractStructuralNode, Attribute

public abstract class AbstractNamedNode
extends Object
implements NamedNode

Class implementing general features of all nodes in grammar structure. Holds information about name, context, and metadata. By default is immutable, children can implement getMutable() function, to enable creation of temporarily mutable instances, which have to be locked by calling setImmutable() after all fields are set properly.


Field Summary
protected  boolean mutable
          Holds true when node is mutable, false when not.
 
Constructor Summary
  AbstractNamedNode(List<String> context, String name, Map<String,Object> metadata)
          Public constructor, creates immutable node.
protected AbstractNamedNode(List<String> context, String name, Map<String,Object> metadata, boolean mutable)
          Create new node given all members.
 
Method Summary
 List<String> getContext()
          Context of a node is it's absolute XPath in document.
 Map<String,Object> getMetadata()
          General map of objects not coming from document data, but describing more precisely how the data was seen.
 String getName()
          Name of the node.
 boolean isMutable()
          Check whether node is mutable
 void setImmutable()
          Set object to immutable mode (cannot be changed back to mutable).
 void setName(String name)
          Sets the name of node (if mutable).
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mutable

protected boolean mutable
Holds true when node is mutable, false when not.

Constructor Detail

AbstractNamedNode

protected AbstractNamedNode(List<String> context,
                            String name,
                            Map<String,Object> metadata,
                            boolean mutable)
Create new node given all members.

Parameters:
context - context of node in document (if any)
name - name of the node
metadata - any metadata associated with node
mutable - true iff node is to be created as mutable

AbstractNamedNode

public AbstractNamedNode(List<String> context,
                         String name,
                         Map<String,Object> metadata)
Public constructor, creates immutable node.

Parameters:
context - context of node in document (if any)
name - name of the node
metadata - any metadata associated with node
Method Detail

getContext

public List<String> getContext()
Description copied from interface: NamedNode
Context of a node is it's absolute XPath in document. For example from document Element c has context a/b/.

Specified by:
getContext in interface NamedNode
Returns:
list of strings = list of names of elements in XPath

getName

public String getName()
Description copied from interface: NamedNode
Name of the node.

Specified by:
getName in interface NamedNode
Returns:
name of the node.

setName

public void setName(String name)
Sets the name of node (if mutable). Throws IllegalStateException when immutable.

Parameters:
name - new name of node

getMetadata

public Map<String,Object> getMetadata()
Description copied from interface: NamedNode
General map of objects not coming from document data, but describing more precisely how the data was seen. For example may contain location from where the node comes from (from xml file, from query, from schema). And any extensional data needed by inferring methods.

Specified by:
getMetadata in interface NamedNode
Returns:
map

isMutable

public boolean isMutable()
Check whether node is mutable

Returns:
true iff is mutable

setImmutable

public void setImmutable()
Set object to immutable mode (cannot be changed back to mutable). Lock the node for changing.


toString

public String toString()
Overrides:
toString in class Object

jInfer

Generated on Fri Dec 9 00:01:25 CET 2011