Package jade.content.abs
Class AbsContentElementList
- java.lang.Object
-
- jade.content.abs.AbsContentElementList
-
- All Implemented Interfaces:
AbsContentElement,AbsObject,ContentElement,Serializable,Serializable
public class AbsContentElementList extends Object implements AbsContentElement
An abstract descriptor that can hold a list of generic content element expressions.- Author:
- Federico Bergenti - Universita` di Parma, Giovanni Caire - TILAB
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface jade.content.abs.AbsObject
ABS_AGENT_ACTION, ABS_AGGREGATE, ABS_CONCEPT, ABS_CONCEPT_SLOT_FUNCTION, ABS_CONTENT_ELEMENT_LIST, ABS_IRE, ABS_PREDICATE, ABS_PRIMITIVE, ABS_REFERENCE, ABS_VARIABLE, UNKNOWN
-
-
Constructor Summary
Constructors Constructor Description AbsContentElementList()Construct an Abstract descriptor to hold a content element list
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(AbsContentElement element)Add a new element (that must be a content element) to this content element list.voidclear()Clear all the elements in this content element list.booleancontains(AbsContentElement element)Test if a given content element is contained in this content element list.AbsContentElementget(int i)Retrieves thei-th element in this content element list.AbsObjectgetAbsObject(String name)Makes no sense in the case of an AbsContentElementList that has no attribute --> Just return nullintgetAbsType()intgetCount()Return the number of elements in the list.String[]getNames()Makes no sense in the case of an AbsContentElementList that has no attribute --> Just return nullStringgetTypeName()inthashCode()intindexOf(AbsContentElement element)Returns the position of an element within this content element list.booleanisAContentExpression()Return true if this Abstract Content Element represents a ContentExpression of the SL Grammar (see also FIPA-SL specifications).booleanisEmpty()Test if the content element list is empty.booleanisGrounded()Tests if this AbsContentElementList is grounded, i.e., if no one of its elements is associated with a variableIteratoriterator()AbsContentElementremove(int index)Removes the element at the given position from this content element list.voidsetIsAContentExpression(boolean flag)Set the isAContentExpression flag to the passed value.intsize()Retrieves the number of elements in this content element list.AbsContentElement[]toArray()Retrieve all elements in this content element list in the form of an array.StringtoString()This method is here just for debugging.
-
-
-
Method Detail
-
add
public void add(AbsContentElement element)
Add a new element (that must be a content element) to this content element list.- Parameters:
element- The element to add.
-
size
public int size()
Retrieves the number of elements in this content element list.- Returns:
- The number of elements.
-
get
public AbsContentElement get(int i)
Retrieves thei-th element in this content element list.- Parameters:
i- The index of the element to retrieve.- Returns:
- The element.
-
iterator
public Iterator iterator()
- Returns:
- An
Iteratorover the elements of this content element list.
-
clear
public void clear()
Clear all the elements in this content element list.
-
contains
public boolean contains(AbsContentElement element)
Test if a given content element is contained in this content element list.- Returns:
trueif the given content element is contained in this content element list.
-
indexOf
public int indexOf(AbsContentElement element)
Returns the position of an element within this content element list.- Returns:
- The position of an element within this content element list or -1 if the given element is not contained in this content element list.
-
remove
public AbsContentElement remove(int index)
Removes the element at the given position from this content element list.- Returns:
- The removed element.
-
isEmpty
public boolean isEmpty()
Test if the content element list is empty.- Returns:
trueif this content element list does not contain any element.
-
toArray
public AbsContentElement[] toArray()
Retrieve all elements in this content element list in the form of an array.- Returns:
- An array containing all elements in this content element list.
-
getTypeName
public String getTypeName()
- Specified by:
getTypeNamein interfaceAbsObject- Returns:
- The name of the type of the object held by this abstract descriptor.
- See Also:
AbsObject.getTypeName()
-
getAbsObject
public AbsObject getAbsObject(String name)
Makes no sense in the case of an AbsContentElementList that has no attribute --> Just return null- Specified by:
getAbsObjectin interfaceAbsObject- Parameters:
name- The name of the attribute.- Returns:
- value The value of the attribute.
-
getNames
public String[] getNames()
Makes no sense in the case of an AbsContentElementList that has no attribute --> Just return null
-
isGrounded
public boolean isGrounded()
Tests if this AbsContentElementList is grounded, i.e., if no one of its elements is associated with a variable- Specified by:
isGroundedin interfaceAbsObject- Returns:
trueif the object is grounded.
-
getCount
public int getCount()
Return the number of elements in the list. Is equivalent tosize()
-
toString
public String toString()
This method is here just for debugging. Notice that it is highly innefficient. The method StringCodec.encode() should be used instead.
-
isAContentExpression
public boolean isAContentExpression()
Description copied from interface:AbsContentElementReturn true if this Abstract Content Element represents a ContentExpression of the SL Grammar (see also FIPA-SL specifications).- Specified by:
isAContentExpressionin interfaceAbsContentElement- Returns:
- true if this Abstract Content Element represents a ContentExpression of the SL Grammar (see also FIPA-SL specifications), false otherwise
- See Also:
AbsContent.isAContentExpression
-
setIsAContentExpression
public void setIsAContentExpression(boolean flag)
Description copied from interface:AbsContentElementSet the isAContentExpression flag to the passed value. By default, if this method was not called, this value is intialized to false.- Specified by:
setIsAContentExpressionin interfaceAbsContentElement- Parameters:
flag- true if this Abstract Content Element represents a ContentExpression of the SL Grammar (see also FIPA-SL specifications), false otherwise
-
getAbsType
public int getAbsType()
- Specified by:
getAbsTypein interfaceAbsObject
-
-