aterm
Interface ATermList

All Superinterfaces:
ATerm, aterm.ATermVisitable, aterm.visitor.Visitable

public interface ATermList
extends ATerm

This interface describes the functionality of an ATermList


Field Summary
 
Fields inherited from interface aterm.ATerm
APPL, BLOB, INT, LIST, PLACEHOLDER, REAL
 
Method Summary
 aterm.ATermList append(aterm.ATerm el)
          Appends an element to this list.
 aterm.ATermList concat(aterm.ATermList rhs)
          Concatenates a list to this list.
 aterm.ATerm dictGet(aterm.ATerm key)
          Retrieves an element from a dictionary list.
 aterm.ATermList dictPut(aterm.ATerm key, aterm.ATerm value)
          Sets the value for an element in a dictionary list.
 aterm.ATermList dictRemove(aterm.ATerm key)
          Removes an element from a dictionary list.
 aterm.ATerm elementAt(int i)
          Gets the element at a specific index of this list.
 aterm.ATerm getFirst()
          Gets the first element of this list.
 aterm.ATerm getLast()
          Gets the last element of this list.
 int getLength()
          Gets the length (number of elements) of this list.
 aterm.ATermList getNext()
          Gets the tail (all but the first element) of this list.
 aterm.ATermList getPrefix()
          Gets the prefix (all but the last element) of this list.
 aterm.ATermList getSlice(int start, int end)
          Gets a portion (slice) of this list.
 int indexOf(aterm.ATerm el, int start)
          Gets the index of the first occurance of a term in this list.
 aterm.ATermList insert(aterm.ATerm el)
          Inserts a term in front of this list.
 aterm.ATermList insertAt(aterm.ATerm el, int i)
          Inserts an element at a specific position in this list.
 boolean isEmpty()
          Checks if this list is the empty list.
 int lastIndexOf(aterm.ATerm el, int start)
          Gets the last occurance of a term in this list.
 aterm.ATermList remove(aterm.ATerm el)
          Removes one occurance of an element from this list.
 aterm.ATermList removeAll(aterm.ATerm el)
          Removes all occurances of an element in this list.
 aterm.ATermList removeElementAt(int i)
          Removes the element at a specific index in this list.
 aterm.ATermList replace(aterm.ATerm el, int i)
          Replaces a specific term in this list with another.
 aterm.ATermList reverse()
          Reverses the elements of this list.
 
Methods inherited from interface aterm.ATerm
equals, getAnnotation, getAnnotations, getFactory, getType, hashCode, isEqual, make, match, match, removeAnnotation, removeAnnotations, setAnnotation, setAnnotations, toString, writeToSharedTextFile, writeToTextFile
 
Methods inherited from interface aterm.ATermVisitable
accept
 
Methods inherited from interface aterm.visitor.Visitable
getChildAt, getChildCount, setChildAt
 

Method Detail

isEmpty

public boolean isEmpty()
Checks if this list is the empty list.

Returns:
true if this list is empty, false otherwise.

getLength

public int getLength()
Gets the length (number of elements) of this list.

Returns:
the length of this list.

getFirst

public aterm.ATerm getFirst()
Gets the first element of this list.

Returns:
the first element of this list.

getLast

public aterm.ATerm getLast()
Gets the last element of this list.

Returns:
the last element of this list.

getNext

public aterm.ATermList getNext()
Gets the tail (all but the first element) of this list.

Returns:
the tail of this list.

indexOf

public int indexOf(aterm.ATerm el,
                   int start)
Gets the index of the first occurance of a term in this list. Lookup starts at a given index (0 being the first element).

Parameters:
el - the element to look for.
start - the starting position of the lookup. Negative start implies searching backwards from the tail of the list.
Returns:
the index of the first occurance of el in this list, or -1 if el does not occur.
Throws:
java.lang.IllegalArgumentException - when start > length of list || start < -length
See Also:
lastIndexOf(aterm.ATerm, int)

lastIndexOf

public int lastIndexOf(aterm.ATerm el,
                       int start)
Gets the last occurance of a term in this list. Lookup starts at a given index (0 being the first element).

Parameters:
el - the element to look for.
start - the starting position of the lookup.
Returns:
the index of the last occurance of el in this list, or -1 if el does not occur.
See Also:
indexOf(aterm.ATerm, int)

concat

public aterm.ATermList concat(aterm.ATermList rhs)
Concatenates a list to this list.

Parameters:
rhs - the list to concatenate to this list.
Returns:
the concatenation of this list and rhs

append

public aterm.ATermList append(aterm.ATerm el)
Appends an element to this list.

Parameters:
el - the element to append to this list.
Returns:
a list with el appended to it.

elementAt

public aterm.ATerm elementAt(int i)
Gets the element at a specific index of this list.

Parameters:
i - the index of the required element.
Returns:
the ith element of this list.
Throws:
java.lang.IndexOutOfBoundsException - if i does not refer to a position in this list.

remove

public aterm.ATermList remove(aterm.ATerm el)
Removes one occurance of an element from this list.

Parameters:
el - the element to be removed.
Returns:
this list with one occurance of el removed.

removeElementAt

public aterm.ATermList removeElementAt(int i)
Removes the element at a specific index in this list.

Parameters:
i - the index of the element to be removed.
Returns:
a list with the ith element removed.
Throws:
java.lang.IndexOutOfBoundsException - if i does not refer to a position in this list.

removeAll

public aterm.ATermList removeAll(aterm.ATerm el)
Removes all occurances of an element in this list.

Parameters:
el - the element to be removed.
Returns:
this list with all occurances of el removed.

insert

public aterm.ATermList insert(aterm.ATerm el)
Inserts a term in front of this list.

Parameters:
el - the element to be inserted.
Returns:
a list with el inserted.

insertAt

public aterm.ATermList insertAt(aterm.ATerm el,
                                int i)
Inserts an element at a specific position in this list.

Parameters:
el - the element to be inserted.
i - the index at which to insert.
Returns:
a list with el inserted as ith element.

getPrefix

public aterm.ATermList getPrefix()
Gets the prefix (all but the last element) of this list.

Returns:
the prefix of this list.

getSlice

public aterm.ATermList getSlice(int start,
                                int end)
Gets a portion (slice) of this list.

Parameters:
start - the start of the slice (included).
end - the end of the slice (excluded).
Returns:
the portion of this list between start and end.

replace

public aterm.ATermList replace(aterm.ATerm el,
                               int i)
Replaces a specific term in this list with another.

Parameters:
el - the element to be put into this list.
i - the index of the element in this list to be replaced.
Returns:
this list with the ith element replaced by el.
Throws:
java.lang.IndexOutOfBoundsException - if i does not refer to a position in this list.

reverse

public aterm.ATermList reverse()
Reverses the elements of this list.

Returns:
a reverse order copy of this list.

dictGet

public aterm.ATerm dictGet(aterm.ATerm key)
Retrieves an element from a dictionary list. A dictionary list is a list of [key,value] pairs.

Parameters:
key - the key to look for
Returns:
the value associated with key, or null when key is not present.

dictPut

public aterm.ATermList dictPut(aterm.ATerm key,
                               aterm.ATerm value)
Sets the value for an element in a dictionary list. A dictionary list is a list of [key,value] pairs.

Parameters:
key - the key to set
value - the value to associate with key
Returns:
the new dictionary list

dictRemove

public aterm.ATermList dictRemove(aterm.ATerm key)
Removes an element from a dictionary list. A dictionary list is a list of [key,value] pairs.

Parameters:
key - the key to remove
Returns:
the new dictionary list