Package jadex.tools.comanalyzer.graph
Class ComponentGroup
- java.lang.Object
-
- jadex.tools.comanalyzer.graph.ComponentGroup
-
- All Implemented Interfaces:
IComponentGroup
- Direct Known Subclasses:
GraphCanvas.AgentGroup,GraphCanvas.MessageGroup
public class ComponentGroup extends java.lang.Object implements IComponentGroup
Base class for Groups (of Agents or Messages) in the ComponentGroupMultiGraph.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.ListelementsThe elements of the group
-
Constructor Summary
Constructors Constructor Description ComponentGroup()Create a new group.ComponentGroup(java.util.List elements)Create a new group with given elements.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddElement(java.lang.Object k)Add an element to the group.booleancontains(java.lang.Object k)Check if the group contains the given element.java.util.ListgetElements()Returns a list of the elements.java.lang.ObjectgetSingelton()If there is only one element in the group, return this element, elsenullbooleanisSingelton()Returnstrue, if there is only one one element in the group.java.util.Iteratoriterator()Returns the iterator over the elements.voidremoveElement(java.lang.Object k)Remove an element from the group.intsize()Returns the size (number of elements) for the group.
-
-
-
Method Detail
-
addElement
public void addElement(java.lang.Object k)
Add an element to the group.- Specified by:
addElementin interfaceIComponentGroup- Parameters:
k- The element to add.
-
removeElement
public void removeElement(java.lang.Object k)
Remove an element from the group.- Specified by:
removeElementin interfaceIComponentGroup- Parameters:
k- The element to remove.
-
getElements
public java.util.List getElements()
Returns a list of the elements.- Specified by:
getElementsin interfaceIComponentGroup- Returns:
- The list of element.
-
size
public int size()
Returns the size (number of elements) for the group.- Specified by:
sizein interfaceIComponentGroup- Returns:
- The size of the group.
-
iterator
public java.util.Iterator iterator()
Returns the iterator over the elements.- Specified by:
iteratorin interfaceIComponentGroup- Returns:
- The iterator
-
contains
public boolean contains(java.lang.Object k)
Check if the group contains the given element.- Specified by:
containsin interfaceIComponentGroup- Parameters:
k- The element to check.- Returns:
trueif the group contains the element.
-
getSingelton
public java.lang.Object getSingelton()
If there is only one element in the group, return this element, elsenull- Returns:
- The element if there is only one element in the group.
-
isSingelton
public boolean isSingelton()
Returnstrue, if there is only one one element in the group.- Returns:
trueif the size of the group is one.
-
-