|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jmlspecs.models.JMLListEqualsNode
An implementation class used in various models. These are
singly-linked list nodes containing objects. The empty
list is represented by null, which makes dealing with these lists
tricky. Normal users should use JMLEqualsSequence instead of this
type to avoid these difficulties.
This type uses ".equals" to compare elements. The cons method does not clone elements that are passed into the list.
JMLEqualsSequence,
JMLEqualsBag,
JMLEqualsSet| Field Summary | |
JMLListEqualsNode |
next
The next node in this list. |
Object |
val
An `equational' specification of lists, for use in the invariant. |
| Constructor Summary | |
JMLListEqualsNode(Object item,
JMLListEqualsNode nxt)
The type of the elements in this list. |
|
| Method Summary | |
JMLListEqualsNode |
append(Object item)
Return a list that consists of this list and the given element. |
Object |
clone()
Return a clone of this object. |
JMLListEqualsNode |
concat(JMLListEqualsNode ls2)
Return a list that is the concatenation of this with the given lists. |
static JMLListEqualsNode |
cons(Object hd,
JMLListEqualsNode tl)
Return a JMLListEqualsNode containing the given element followed by the given list. |
private static boolean |
elem_equals(Object item1,
Object item2)
Tell if the given elements are equal, taking null into account. |
boolean |
equals(Object ls2)
Test whether this object's value is equal to the given argument. |
Object |
getItem(Object item)
Return the zero-based index of the first occurrence of the given element in the list, if there is one |
boolean |
has(Object item)
Tells whether the given element is ".equals" to an element in the list. |
int |
hashCode()
Return a hash code for this object. |
Object |
head()
Return the first element in this list. |
boolean |
headEquals(Object item)
Tell if the head of the list is ".equals" to the given item. |
int |
indexOf(Object item)
Return the zero-based index of the first occurrence of the given element in the list, if there is one |
JMLListEqualsNode |
insertBefore(int n,
Object item)
Return a list that is like this list but with the given item inserted before the given index. |
int |
int_length()
Tells the number of elements in the list; a synonym for size. |
int |
int_size()
Tells the number of elements in the sequence; a synonym for length Tells the number of elements in the sequence; a synonym for length Tells the number of elements in the list; a synonym for length. |
boolean |
isPrefixOf(JMLListEqualsNode ls2)
Tells whether the elements of this list occur, in order, at the beginning of the given list, using ".equals" for comparisons. |
Object |
itemAt(int i)
Return the ith element of a list. |
Object |
last()
Return the last element in this list. |
JMLListEqualsNode |
prefix(int n)
Return a list containing the first n elements in this list. |
JMLListEqualsNode |
prepend(Object item)
Return a list that is like this, but with the given item at the front. |
JMLListEqualsNode |
remove(Object item)
Return a list that is like this list but without the first occurrence of the given item. |
JMLListEqualsNode |
removeItemAt(int n)
Return a list like this list, but without the element at the given zero-based index. |
JMLListEqualsNode |
removeLast()
Return a list containing all but the last element in this. |
JMLListEqualsNode |
removePrefix(int n)
Return a list containing all but the first n elements in this list. |
JMLListEqualsNode |
replaceItemAt(int n,
Object item)
Return a list like this, but with item replacing the element at the given zero-based index. |
JMLListEqualsNode |
reverse()
Return a list that is the reverse of this list. |
String |
toString()
Return a string representation for this list. |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public final Object val
public final JMLListEqualsNode next
| Constructor Detail |
public JMLListEqualsNode(Object item,
JMLListEqualsNode nxt)
item - the object to place at the head of this list.nxt - the _JMLListEqualsNode to make the tail of this list.| Method Detail |
public static JMLListEqualsNode cons(Object hd,
JMLListEqualsNode tl)
hd - the object to place at the head of the result.tl - the JMLListEqualsNode to make the tail of the result.public Object head()
public boolean headEquals(Object item)
has(Object)
private static boolean elem_equals(Object item1,
Object item2)
public Object itemAt(int i)
throws JMLListException
JMLListExceptionReturn the ith element of a list.,
#getItem(int)public int int_size()
public int int_length()
public boolean has(Object item)
public boolean isPrefixOf(JMLListEqualsNode ls2)
public boolean equals(Object ls2)
equals in interface JMLTypeequals in class Objectpublic int hashCode()
hashCode in interface JMLTypehashCode in class Objectpublic int indexOf(Object item)
item - the Object sought in this.
public Object last()
public Object getItem(Object item)
throws JMLListException
item - the Object sought in this list.
JMLListException - if the item does not occur in this list.itemAt(int)public Object clone()
clone in interface JMLTypeclone in class Objectpublic JMLListEqualsNode prefix(int n)
n - the number of elements to leave in the result.
public JMLListEqualsNode removePrefix(int n)
n - the number of elements to remove
public JMLListEqualsNode removeItemAt(int n)
n - the zero-based index into the list.
public JMLListEqualsNode replaceItemAt(int n,
Object item)
n - the zero-based index into this list.item - the item to put at index index
Return a list like this, but with item replacing the element at the
given zero-based index.public JMLListEqualsNode removeLast()
public JMLListEqualsNode concat(JMLListEqualsNode ls2)
ls2 - the list to place at the end of this list in the
result.
public JMLListEqualsNode prepend(Object item)
item - the element to place at the front of the result.public JMLListEqualsNode append(Object item)
public JMLListEqualsNode reverse()
public JMLListEqualsNode insertBefore(int n,
Object item)
throws JMLListException
JMLListExceptionpublic JMLListEqualsNode remove(Object item)
public String toString()
toString in class Object
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||