jasi.simple.defi
Class SimpleElementHandler

java.lang.Object
  extended by jasi.simple.defi.SimpleElementHandler
All Implemented Interfaces:
Element, SimObject, SimpleObject, java.io.Serializable, java.lang.Comparable<Element>
Direct Known Subclasses:
SimpleElement

public abstract class SimpleElementHandler
extends java.lang.Object
implements Element, SimpleObject

The container of a simple element's attributes. This example does not extend an element bean, it implements the element interface only and contains an element adapter.

See Also:
Serialized Form

Field Summary
protected  ElementAdapter listener
          The element listener.
 
Fields inherited from interface jasi.sim.basic.element.Element
COMPARATOR
 
Constructor Summary
protected SimpleElementHandler()
          Construct container of a simple element's attributes.
protected SimpleElementHandler(Id id)
          Construct container of a simple element's attributes.
 
Method Summary
 int compareTo(Element o)
          Compares this object with the specified object for order.
 Element delete()
          Delete this simple element.
 java.lang.String[] getHistory()
          Get the history attribute.
 java.lang.String getHistory(int index)
          Get an indexed item of this element's history.
 Id getId()
          Retrieve the element's ID.
 SimValue getKey()
          Returns this simulation element external key.
 java.lang.String getValue()
          Get the value attribute.
 boolean isDeleted()
          Check the existence of this element.
 void registered(Elements elements)
          Set the listener for property changes and element manager of this element.
 void setHistory(int index, java.lang.String item)
          Set an indexed item of this element's history.
 void setHistory(java.lang.String[] history)
          Set the history attribute.
 void setId(Id id)
          Set the element's ID.
 void setKey(SimValue key)
          Set this simulation element external key.
 void setValue(java.lang.String value)
          Set the value attribute.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jasi.simple.model.SimpleObject
emptyContent, fillContent, readContent
 

Field Detail

listener

protected ElementAdapter listener
The element listener.

Constructor Detail

SimpleElementHandler

protected SimpleElementHandler()
Construct container of a simple element's attributes.


SimpleElementHandler

protected SimpleElementHandler(Id id)
Construct container of a simple element's attributes.

Parameters:
id - The simulation element's ID.
Method Detail

delete

public Element delete()
Delete this simple element.

Specified by:
delete in interface Element
Returns:
The deleted element.
See Also:
AbstractElementBean.delete()

toString

public java.lang.String toString()
Returns a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
The string.

setValue

public final void setValue(java.lang.String value)
Set the value attribute.

Parameters:
value - The new value of the attribute.

getValue

public final java.lang.String getValue()
Get the value attribute.

Returns:
Its value.

getHistory

public final java.lang.String getHistory(int index)
Get an indexed item of this element's history.

Parameters:
index - The index.
Returns:
The item.

setHistory

public final void setHistory(int index,
                             java.lang.String item)
Set an indexed item of this element's history.

Parameters:
index - The index.
item - The item.

getHistory

public final java.lang.String[] getHistory()
Get the history attribute.

Returns:
Its value.

setHistory

public final void setHistory(java.lang.String[] history)
Set the history attribute.

Parameters:
history - The new value of this attribute.

getKey

public final SimValue getKey()
Returns this simulation element external key.

Specified by:
getKey in interface Element
Returns:
The external key. This method returns null, when key is not set previously.

isDeleted

public final boolean isDeleted()
Check the existence of this element. This method returns true, if the delete-method has been invoked before.

Specified by:
isDeleted in interface Element
Returns:
True, if element has been deleted.

registered

public final void registered(Elements elements)
Set the listener for property changes and element manager of this element.

Specified by:
registered in interface Element
Parameters:
elements - The property change listener and element manager.

setKey

public final void setKey(SimValue key)
Set this simulation element external key. The external key will not change, if already set before. It is used as marker for this simulation element when communicating with external components.

Specified by:
setKey in interface Element
Parameters:
key - The external key.
Throws:
java.lang.IllegalStateException - Whenever key is already set.

compareTo

public final int compareTo(Element o)
Compares this object with the specified object for order. Implementation of Comparable interface. The elements are compared in the order of their IDs.

Specified by:
compareTo in interface java.lang.Comparable<Element>
Parameters:
o - The element to be compared.
Returns:
A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

getId

public final Id getId()
Retrieve the element's ID. Each simulation element obtains during its registration a unique, increasing number for identification.

Specified by:
getId in interface SimObject
Returns:
The ID. This method returns null, when ID is not set previously.

setId

public final void setId(Id id)
Set the element's ID. Each simulation element obtains during its registration a unique, increasing number for identification. If ID is already set, it will not be changed.

Specified by:
setId in interface SimObject
Parameters:
id - The ID.
Throws:
IdAlreadySetException - Whenever ID is already set.