|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.neu.ccs.demeterf.demfgen.lib.List<X>
edu.neu.ccs.demeterf.demfgen.lib.Cons<X>
public class Cons<X>
Represents a Lisp style cons list. You should not use the constructor, use List.push(...) to add an element to the front of the list. It is left public so that the parser generator can parse different lists if needed.
| Nested Class Summary | |
|---|---|
static class |
Cons.first
|
static class |
Cons.rest
|
| Nested classes/interfaces inherited from class edu.neu.ccs.demeterf.demfgen.lib.List |
|---|
List.Build<X>, List.Comp<X>, List.Fold<X,Y>, List.Map<X,Y>, List.Pred<X>, List.Stringer<X>, List.Zip<X,Y,Z> |
| Field Summary | |
|---|---|
X |
first
|
List<X> |
rest
|
| Constructor Summary | |
|---|---|
Cons(X f,
List<X> r)
|
|
| Method Summary | ||
|---|---|---|
List<X> |
add(X a,
int i)
Add an Element to this list at the given index |
|
List<X> |
append(List<X> l)
Append another List to the end of this List |
|
List<X> |
append(X t)
Append an element to the end of this List |
|
boolean |
contains(List.Pred<X> p)
Does this Predicate match anything in this List? |
|
boolean |
contains(X t)
Does the given X occur in this List? |
|
boolean |
containsAll(List<X> l)
Does this List contain all of the given List's Elements? |
|
boolean |
containsAll(List<X> l,
List.Comp<X> c)
Does this List contain all of the given List's Elements using the given comparer? |
|
boolean |
containsAny(List<X> l)
Does this List contain any of the given List's Elements? |
|
boolean |
equals(java.lang.Object o)
|
|
List<X> |
filter(List.Pred<X> p)
Filter out all the non-matching Elements |
|
X |
find(List.Pred<X> p)
Return the first matching X, throws a RuntimeException if not there |
|
X |
find(X t)
Return the given X, throws a RuntimeException if not there |
|
|
foldl(List.Fold<X,Y> f,
Y b)
Fold this List to a single Value (Left to Right) |
|
|
foldr(List.Fold<X,Y> f,
Y b)
Fold this List to a single Value (Right to Left) |
|
int |
hashCode()
|
|
List<X> |
insert(X a,
List.Comp<X> c)
Insert an Element into this SORTED list using the given Comparison |
|
boolean |
isEmpty()
Is this List Empty? |
|
int |
length()
The Length of This List |
|
X |
lookup(int i)
Lookup the i^th item in this List |
|
|
map(List.Map<X,Y> m)
Apply a function to each Element of this List |
|
List<X> |
pop()
Return this List without the first Element |
|
List<X> |
remove(int i)
Remove an Element from this list at the given index |
|
List<X> |
remove(List.Pred<X> p)
Remove the first matching X |
|
List<X> |
remove(X t)
Remove the given X |
|
List<X> |
replace(int i,
X s)
Replace the element at index 'i' with 's' |
|
List<X> |
replace(List.Pred<X> p,
X t)
Replace the first matching X with 't' |
|
List<X> |
replace(X t,
X s)
Replace the first occurence of 't' with 's' |
|
List<X> |
replaceAll(List.Pred<X> p,
X t)
Replace all matching Xs with 't' |
|
List<X> |
replaceAll(X t,
X s)
Replace all occurences of 't' with 's' |
|
List<X> |
reverse(List<X> acc)
Reverse this List with the given Accumulator |
|
List<X> |
reverse(List<X> acc,
int i)
Reverse this List with the given Accumulator |
|
List<X> |
sort(List.Comp<X> c)
Sort this List using the given Comparison |
|
X |
top()
Return the first Element of this List |
|
java.lang.String |
toString(List.Stringer<X> s)
To String using a Stringer (Visitor) |
|
java.lang.String |
toString(java.lang.String sep,
java.lang.String pre)
To String, with a seperator and prefix |
|
|
zip(List.Zip<X,Y,Z> z,
List<Y> l)
Zip two lists (this, and 'l') into a single list, one element at a time |
|
| Methods inherited from class edu.neu.ccs.demeterf.demfgen.lib.List |
|---|
buildlist, create, create, filterout, fold, index, index, iterator, pop, push, push, reverse, reverse, same, same, toArray, toString |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public final X first
public final List<X> rest
| Constructor Detail |
|---|
public Cons(X f,
List<X> r)
| Method Detail |
|---|
public List<X> append(List<X> l)
List
append in class List<X>public List<X> append(X t)
List
append in class List<X>public X top()
List
top in class List<X>public List<X> pop()
List
pop in class List<X>public boolean isEmpty()
List
isEmpty in class List<X>public boolean contains(X t)
List
contains in class List<X>public boolean contains(List.Pred<X> p)
List
contains in class List<X>public boolean containsAny(List<X> l)
List
containsAny in class List<X>public boolean containsAll(List<X> l)
List
containsAll in class List<X>
public boolean containsAll(List<X> l,
List.Comp<X> c)
List
containsAll in class List<X>public X find(X t)
List
find in class List<X>public X find(List.Pred<X> p)
List
find in class List<X>public List<X> remove(X t)
List
remove in class List<X>public List<X> remove(List.Pred<X> p)
List
remove in class List<X>public X lookup(int i)
List
lookup in class List<X>public int length()
List
length in class List<X>
public java.lang.String toString(java.lang.String sep,
java.lang.String pre)
List
toString in class List<X>public java.lang.String toString(List.Stringer<X> s)
List
toString in class List<X>public List<X> filter(List.Pred<X> p)
List
filter in class List<X>
public <Y> Y foldr(List.Fold<X,Y> f,
Y b)
List
foldr in class List<X>
public <Y> Y foldl(List.Fold<X,Y> f,
Y b)
List
foldl in class List<X>public <Y> List<Y> map(List.Map<X,Y> m)
List
map in class List<X>
public List<X> add(X a,
int i)
List
add in class List<X>public List<X> remove(int i)
List
remove in class List<X>
public List<X> insert(X a,
List.Comp<X> c)
List
insert in class List<X>public List<X> sort(List.Comp<X> c)
List
sort in class List<X>public List<X> reverse(List<X> acc)
List
reverse in class List<X>
public List<X> reverse(List<X> acc,
int i)
List
reverse in class List<X>public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object
public <Y,Z> List<Z> zip(List.Zip<X,Y,Z> z,
List<Y> l)
List
zip in class List<X>
public List<X> replace(X t,
X s)
List
replace in class List<X>
public List<X> replace(List.Pred<X> p,
X t)
List
replace in class List<X>
public List<X> replace(int i,
X s)
List
replace in class List<X>
public List<X> replaceAll(X t,
X s)
List
replaceAll in class List<X>
public List<X> replaceAll(List.Pred<X> p,
X t)
List
replaceAll in class List<X>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||