com.xj.anylogic.engine
Class ActiveObjectLinkedHashSet<E extends ActiveObject>

java.lang.Object
  extended by com.xj.anylogic.engine.ActiveObjectCollection<E>
      extended by com.xj.anylogic.engine.ActiveObjectList<E>
          extended by com.xj.anylogic.engine.ActiveObjectLinkedHashSet<E>
All Implemented Interfaces:
com.xj.anylogic.engine.internal.Child, java.io.Serializable, java.lang.Iterable<E>

public class ActiveObjectLinkedHashSet<E extends ActiveObject>
extends ActiveObjectList<E>

Replicated active object collection based on LinkedHashSet implementation
This collection offers constant time performance for the basic operations (add, remove, contains and size) and guarantees insertion-order during iteration

Note, that due to set-based implementation, element retrieval by its index (get(int)) is extremely slow when rapidly invoked it with random index for large collections. In a similar manner, ActiveObject.getIndex() method of active objects in this collection will be slow too.

Author:
XJ Technologies Company Ltd. www.anylogic.com
See Also:
Serialized Form

Constructor Summary
ActiveObjectLinkedHashSet()
           
 
Method Summary
 void _add(E activeObject)
          This method should not be called by user
Call add_EONAME() method of class containing embedded object with name EONAME
 boolean _remove(E activeObject)
          This method should not be called by user
Call remove_EONAME() method of class containing embedded object with name EONAME
 boolean contains(java.lang.Object activeObject)
          Returns true if this replicated active object contains the specified element.
 E get(int index)
          Returns the active object element at the specified position in this replicated active object.
 boolean isEmpty()
          Returns true if this replicated active object contains no elements.
 java.util.Iterator<E> iterator()
          Returns an iterator over the replicated active object.
 int size()
          Returns the number of elements in this replicated active object.
 java.lang.String toString()
           
 
Methods inherited from class com.xj.anylogic.engine.ActiveObjectCollection
average, average, count, max, max, min, min, random, restoreOwner, sum, sum
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ActiveObjectLinkedHashSet

public ActiveObjectLinkedHashSet()
Method Detail

contains

public boolean contains(java.lang.Object activeObject)
Returns true if this replicated active object contains the specified element. More formally, returns true if and only if this collection contains at least one element e such that (o==null ? e==null : o.equals(e)).
Operation runs in about constant time

Specified by:
contains in class ActiveObjectCollection<E extends ActiveObject>
Parameters:
activeObject - element whose presence in this replicated active object is to be tested
Returns:
true if this replicated active object contains the specified element

isEmpty

public boolean isEmpty()
Description copied from class: ActiveObjectCollection
Returns true if this replicated active object contains no elements.

Specified by:
isEmpty in class ActiveObjectCollection<E extends ActiveObject>
Returns:
true if this replicated active object contains no elements

iterator

public java.util.Iterator<E> iterator()
Returns an iterator over the replicated active object.
This iterator guarantees the insertion order of elements (i.e. the order in which active object were added to this replicated active object list).

Specified by:
iterator in interface java.lang.Iterable<E extends ActiveObject>
Specified by:
iterator in class ActiveObjectList<E extends ActiveObject>
Returns:
an Iterator over the elements in this replicated active object

size

public int size()
Description copied from class: ActiveObjectCollection
Returns the number of elements in this replicated active object.
If this collection contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Specified by:
size in class ActiveObjectCollection<E extends ActiveObject>
Returns:
the number of elements in this replicated active object

get

public E get(int index)
Returns the active object element at the specified position in this replicated active object.
This method is extremely slow when rapidly calling it with random index for large collections

Specified by:
get in class ActiveObjectList<E extends ActiveObject>
Parameters:
index - index of the element to return
Returns:
the element at the specified position in this list
Throws:
java.lang.IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())

_add

public void _add(E activeObject)
Description copied from class: ActiveObjectCollection
This method should not be called by user
Call add_EONAME() method of class containing embedded object with name EONAME

Specified by:
_add in class ActiveObjectCollection<E extends ActiveObject>

_remove

public boolean _remove(E activeObject)
Description copied from class: ActiveObjectCollection
This method should not be called by user
Call remove_EONAME() method of class containing embedded object with name EONAME

Specified by:
_remove in class ActiveObjectCollection<E extends ActiveObject>

toString

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


Copyright © 1991-2008 XJ Technlogies. All Rights Reserved.