cgp.runtime
Class ListType

java.lang.Object
  |
  +--cgp.runtime.Type
        |
        +--cgp.runtime.ListType

public class ListType
extends Type


Field Summary
private  java.util.LinkedList theList
           
 
Fields inherited from class cgp.runtime.Type
kbStack, scopeStack, type
 
Constructor Summary
ListType()
           
ListType(java.util.LinkedList list)
           
ListType(Type[] values)
           
 
Method Summary
 ListType append(Type x)
          Append a value to this list and return the mutated list.
 Type eqOp(Type other)
           
 boolean equals(java.lang.Object other)
           
 NumberType getLength()
          Getter and setter methods for attributes.
 Type getNthOp(Type n)
          Return the Nth element of this list.
 java.util.LinkedList getValue()
           
 BooleanType hasMember(Type x)
          Is x a member of this list? Note that this is a shallow test.
 Type member(Type x)
          Is x a member of this list, or of a sub-list of this list? If so, return the sub-list within which it is embedded.
 ListType merge(Type x)
          Merge another list with this list, appending the former's members to the latter's, and returning the mutated list.
 Type neOp(Type other)
           
 ListType prepend(Type x)
          Prepend a value to this list and return the mutated list.
 void setNthOp(Type n, Type value)
          Set the Nth element of this list.
 java.lang.String toString()
           
 
Methods inherited from class cgp.runtime.Type
addOp, andOp, divideOp, geOp, getAttr, getKBStack, getScopeStack, getType, gtOp, invokeMemberFunc, isOp, leOp, ltOp, modulusOp, multiplyOp, negateOp, notOp, operationError, orOp, setAttr, setKBStack, setScopeStack, setType, subtractOp
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

theList

private java.util.LinkedList theList
Constructor Detail

ListType

public ListType()

ListType

public ListType(java.util.LinkedList list)

ListType

public ListType(Type[] values)
Method Detail

getValue

public java.util.LinkedList getValue()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

eqOp

public Type eqOp(Type other)
Overrides:
eqOp in class Type

neOp

public Type neOp(Type other)
Overrides:
neOp in class Type

getNthOp

public Type getNthOp(Type n)
Return the Nth element of this list. The first valid index is 1 and the last is the list's length.
Overrides:
getNthOp in class Type

setNthOp

public void setNthOp(Type n,
                     Type value)
Set the Nth element of this list. The first valid index is 1 and the last is the list's length.
Overrides:
setNthOp in class Type

getLength

public NumberType getLength()
Getter and setter methods for attributes.

hasMember

public BooleanType hasMember(Type x)
Is x a member of this list? Note that this is a shallow test.

member

public Type member(Type x)
Is x a member of this list, or of a sub-list of this list? If so, return the sub-list within which it is embedded. Note that this may be the outermost list.

prepend

public ListType prepend(Type x)
Prepend a value to this list and return the mutated list.

append

public ListType append(Type x)
Append a value to this list and return the mutated list.

merge

public ListType merge(Type x)
Merge another list with this list, appending the former's members to the latter's, and returning the mutated list.