net.sf.opendse.model
Class Element

java.lang.Object
  extended by net.sf.opendse.model.Element
All Implemented Interfaces:
IAttributes
Direct Known Subclasses:
Edge, Mapping, Node

public class Element
extends java.lang.Object
implements IAttributes

The Element is the default element.


Field Summary
protected  Attributes attributes
          The local attributes of this element.
protected  java.lang.String id
          The unique id.
protected  Element parent
          The parent element.
static java.lang.String TYPE
          The identifier for the type of an element.
 
Constructor Summary
Element(Element parent)
          Constructs a new Element from a parent, i.e., a copy with local attributes.
Element(java.lang.String id)
          Constructs a new Element.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
<O> O
getAttribute(java.lang.String identifier)
          Returns the attribute
 java.util.Set<java.lang.String> getAttributeNames()
          Returns the attribute names.
 Parameter getAttributeParameter(java.lang.String identifier)
          Return the parameter definition or null if the attribute is not defined as parameter.
 Attributes getAttributes()
          Returns the map of all pairs of attributes.
 java.lang.String getId()
          Returns the id.
 java.util.Set<java.lang.String> getLocalAttributeNames()
          Returns the local attribute names.
 Attributes getLocalAttributes()
          Returns the local attributes.
 Element getParent()
          Returns the parent element.
 java.lang.String getType()
          Returns the type of the element.
 int hashCode()
           
 boolean isDefined(java.lang.String identifier)
          Tests whether an attribute is defined.
 void setAttribute(java.lang.String identifier, java.lang.Object object)
          Sets the attribute.
 void setParent(Element element)
          Sets the parent element.
 void setType(java.lang.String type)
          Sets the type of the element.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE

public static java.lang.String TYPE
The identifier for the type of an element.


attributes

protected final Attributes attributes
The local attributes of this element.


parent

protected Element parent
The parent element.


id

protected java.lang.String id
The unique id.

Constructor Detail

Element

public Element(java.lang.String id)
Constructs a new Element.

Parameters:
id - the id

Element

public Element(Element parent)
Constructs a new Element from a parent, i.e., a copy with local attributes.

Parameters:
parent - the parent
Method Detail

getId

public java.lang.String getId()
Returns the id.

Returns:
the id

getParent

public Element getParent()
Returns the parent element.

Returns:
the parent element

setParent

public void setParent(Element element)
Sets the parent element. This is only feasible, if the parent is not set yet. Changing a parent is not permitted.

Parameters:
element - the parent

getAttribute

public <O> O getAttribute(java.lang.String identifier)
Description copied from interface: IAttributes
Returns the attribute

Specified by:
getAttribute in interface IAttributes
Type Parameters:
O - the type of the attribute
Parameters:
identifier - the identifier of the attribute
Returns:
the value of the value of the attribute

isDefined

public boolean isDefined(java.lang.String identifier)
Description copied from interface: IAttributes
Tests whether an attribute is defined.

Specified by:
isDefined in interface IAttributes
Parameters:
identifier - the identifier of the attribute
Returns:
true if defined

getAttributes

public Attributes getAttributes()
Description copied from interface: IAttributes
Returns the map of all pairs of attributes.

Specified by:
getAttributes in interface IAttributes
Returns:
the attribute map

getLocalAttributes

public Attributes getLocalAttributes()
Returns the local attributes.

Returns:
the local attributes

getLocalAttributeNames

public java.util.Set<java.lang.String> getLocalAttributeNames()
Returns the local attribute names.

Returns:
the local attribute names

setAttribute

public void setAttribute(java.lang.String identifier,
                         java.lang.Object object)
Description copied from interface: IAttributes
Sets the attribute.

Specified by:
setAttribute in interface IAttributes
Parameters:
identifier - the identifier of the attribute
object - the value of the attribute

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getAttributeParameter

public Parameter getAttributeParameter(java.lang.String identifier)
Description copied from interface: IAttributes
Return the parameter definition or null if the attribute is not defined as parameter.

Specified by:
getAttributeParameter in interface IAttributes
Parameters:
identifier - the identifier of the attribute
Returns:
the parameter

getAttributeNames

public java.util.Set<java.lang.String> getAttributeNames()
Description copied from interface: IAttributes
Returns the attribute names.

Specified by:
getAttributeNames in interface IAttributes
Returns:
the attribute names

getType

public java.lang.String getType()
Returns the type of the element.

Returns:
the type of the element

setType

public void setType(java.lang.String type)
Sets the type of the element.

Parameters:
type - the type of the element