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 |
Methods inherited from class java.util.AbstractList |
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList |
args
protected Object[] args
- the array where the variables are stored
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