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.List
elements
The 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 void
addElement(java.lang.Object k)
Add an element to the group.boolean
contains(java.lang.Object k)
Check if the group contains the given element.java.util.List
getElements()
Returns a list of the elements.java.lang.Object
getSingelton()
If there is only one element in the group, return this element, elsenull
boolean
isSingelton()
Returnstrue
, if there is only one one element in the group.java.util.Iterator
iterator()
Returns the iterator over the elements.void
removeElement(java.lang.Object k)
Remove an element from the group.int
size()
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:
addElement
in interfaceIComponentGroup
- Parameters:
k
- The element to add.
-
removeElement
public void removeElement(java.lang.Object k)
Remove an element from the group.- Specified by:
removeElement
in interfaceIComponentGroup
- Parameters:
k
- The element to remove.
-
getElements
public java.util.List getElements()
Returns a list of the elements.- Specified by:
getElements
in interfaceIComponentGroup
- Returns:
- The list of element.
-
size
public int size()
Returns the size (number of elements) for the group.- Specified by:
size
in interfaceIComponentGroup
- Returns:
- The size of the group.
-
iterator
public java.util.Iterator iterator()
Returns the iterator over the elements.- Specified by:
iterator
in interfaceIComponentGroup
- Returns:
- The iterator
-
contains
public boolean contains(java.lang.Object k)
Check if the group contains the given element.- Specified by:
contains
in interfaceIComponentGroup
- Parameters:
k
- The element to check.- Returns:
true
if 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:
true
if the size of the group is one.
-
-