JTP API Documentation

jtp.fol
Class SubstitutableList

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--jtp.fol.SubstitutableList
All Implemented Interfaces:
Collection, List, Serializable, Substitutable
Direct Known Subclasses:
UnifyableList

public class SubstitutableList
extends AbstractList
implements Substitutable, Serializable

A List that can substitute any of its elements with other objects from a substitution mapping.

See Also:
Serialized Form

Field Summary
protected  Object[] args
          the array where the variables are stored
 
Fields inherited from class java.util.AbstractList
modCount
 
Method Summary
 Object get(int index)
           
 int size()
           
 Object substitute(Map m)
          Performs substitution in this object.
 String toString()
           
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Field Detail

args

protected Object[] args
the array where the variables are stored

Method Detail

get

public Object get(int index)
Specified by:
get in interface List
Specified by:
get in class AbstractList

size

public int size()
Specified by:
size in interface List
Specified by:
size in class AbstractCollection

substitute

public Object substitute(Map m)
Description copied from interface: Substitutable
Performs substitution in this object. Specifically, this method produces an object derived from this Substitutable, with every occurrence of each key in the supplied map replaced by the corresponding value. This method shouldn't modify the original Substitutable, but rather construct a new instance, if changes are necessary. If this Substitutable does not contain any of the keys in the map, the method can and should return this.

Note that this method does not have to check if this object is itself a key in the substitution map and therefore has to be replaced. If you need that functionality, SubstUtils.substitute(Object, Map) should be used instead.

Specified by:
substitute in interface Substitutable
Returns:
the result of the substitution

toString

public String toString()
Overrides:
toString in class AbstractCollection

JTP API Documentation