|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jmlspecs.models.resolve.StringOfObject
Sequences of non-null object identities. Objects in the sequence are not cloned coming in or going out, and this type uses "==" to compare object identities.
The names in this type are based prnimarily
on the RESOLVE design, but are also chosen to be understandable to
someone familiar with Collection. However, note that
none of the operations does any mutation.
Many of the specifications are translated from William Ogden's
notes for CIS 680 at Ohio State University. (Thanks Bill!) This
is especially true for the ones specified recursively. Specifications
written using the #size and get(int) operations are an
alternative, and often given in the redundant parts.
JMLObjectSequence,
JMLCollection,
TotallyOrderedCompareTo| Field Summary | |
protected JMLObjectSequence |
elements
The sequence of objects that represent this string of objects. |
static StringOfObject |
EMPTY
The empty string of objects. |
private static String |
ILLEGAL_ARG_MSG
Message used in exceptions. |
| Constructor Summary | |
|
StringOfObject()
Initialize this object to be empty string of objects. |
|
StringOfObject(Object elem)
Initialize this object to string containing just the given object. |
protected |
StringOfObject(JMLObjectSequence os)
Initialize this object from the given representation. |
| Method Summary | |
StringOfObject |
add(Object elem)
Add an element to a string at the end. |
StringOfObject |
addAfterIndex(int afterThisOne,
Object elem)
Add an element to a string after the given index. |
StringOfObject |
addAll(Object[] c)
Add all the elements of c at the end of this string, in order from the smallest to the largest index. |
StringOfObject |
addAll(Collection c)
Add all the elements of c, at the end of this string, in the order determined by c's iterator. |
StringOfObject |
addBeforeIndex(int beforeThisOne,
Object elem)
Add an element to a string before the given index. |
StringOfObject |
addFront(Object elem)
Add an element to a string at the front. |
Object |
clone()
Return a clone of this object. |
StringOfObject |
composedWith(StringOfObject s)
Compose this with s. |
StringOfObject |
concat(StringOfObject s)
Concatenate this with s. |
JMLObjectSequenceEnumerator |
elements()
Return an enumerator for this string of objects. |
boolean |
equals(Object x)
Tell if this object is equal to the given argument. |
StringOfObject |
ext(Object elem)
Extend a string with a new element at the end. |
static StringOfObject |
ext(StringOfObject s,
Object elem)
Extend the given string by placing the given element at the end. |
static StringOfObject |
from(Object[] a)
Make an array of objects into a string. |
static StringOfObject |
from(Collection c)
Make a collection into a string. |
Object |
get(int index)
Return the element in the string at the given index. |
boolean |
has(Object elem)
Tell whether the argument is equal to one of the elements in this collection, using the notion of element equality appropriate for the collection. |
int |
hashCode()
Return a hash code for this object. |
int |
int_size()
Tell the size of this string. |
boolean |
isEmpty()
Tell whether this string is empty. |
boolean |
isPrefix(StringOfObject s2)
Tell whether this string occurs as a prefix of the given argument string. |
boolean |
isProperPrefix(StringOfObject s2)
Tell whether this string occurs as a proper prefix of the given argument string. |
boolean |
isProperSuffix(StringOfObject s2)
Tell whether this string occurs as a proper suffix of the given argument string. |
boolean |
isSuffix(StringOfObject s2)
Tell whether this string occurs as a suffix of the given argument string. |
JMLIterator |
iterator()
Return an iterator for this string of objects. |
int |
length()
Tell the length (= size) of this string. |
int |
occurs_ct(Object y)
Tell how many times the given object appears in this string. |
StringOfObject |
pow(int n)
Compose this string with itself the given number of times. |
static StringOfObject |
product(StringOfObject[] a)
Compose all the elements of a in order. |
static StringOfObject |
productFrom(StringOfObject[] a,
int fromIndex)
Compose all the elements of a in order, starting at the given index. |
static StringOfObject |
productFromTo(StringOfObject[] a,
int fromIndex,
int toIndex)
Compose all the elements of a in order, starting with fromIndex, and including elements up to but not including toIndex. |
StringOfObject |
rev()
Return the reverse of the string. |
StringOfObject |
reverse()
Return the reverse of the string. |
static StringOfObject |
singleton(Object elem)
Make a singleton string of objects containing just the given object. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected final JMLObjectSequence elements
private static final String ILLEGAL_ARG_MSG
public static final StringOfObject EMPTY
StringOfObject()| Constructor Detail |
public StringOfObject()
EMPTY,
StringOfObject(Object)
public StringOfObject(Object elem)
throws IllegalArgumentException
IllegalArgumentExceptionStringOfObject(),
singleton(Object)
protected StringOfObject(JMLObjectSequence os)
throws IllegalArgumentException
IllegalArgumentException| Method Detail |
public static StringOfObject singleton(Object elem)
throws IllegalArgumentException
IllegalArgumentExceptionStringOfObject(Object)
public static StringOfObject ext(StringOfObject s,
Object elem)
throws IllegalArgumentException
IllegalArgumentExceptionext(Object),
add(Object),
addFront(Object),
addAfterIndex(int, java.lang.Object),
addBeforeIndex(int, java.lang.Object)
public static StringOfObject from(Object[] a)
throws IllegalArgumentException
IllegalArgumentExceptionfrom(Collection),
addAll(Object[])
public static StringOfObject from(Collection c)
throws IllegalArgumentException
IllegalArgumentExceptionfrom(Object[]),
addAll(Collection)public static StringOfObject product(StringOfObject[] a)
productFrom(StringOfObject[], int),
productFromTo(StringOfObject[], int, int),
composedWith(StringOfObject)
public static StringOfObject productFrom(StringOfObject[] a,
int fromIndex)
#productFrom(StringOfObject[]),
productFromTo(StringOfObject[], int, int),
composedWith(StringOfObject)
public static StringOfObject productFromTo(StringOfObject[] a,
int fromIndex,
int toIndex)
fromIndex - the index of the first string of elements to
compose with.toIndex - one past the index of the elements to compose with.productFrom(StringOfObject[], int),
productFromTo(StringOfObject[], int, int),
composedWith(StringOfObject)
public Object get(int index)
throws IndexOutOfBoundsException
IndexOutOfBoundsExceptionpublic int int_size()
int_size in interface JMLCollectionlength()public int length()
int_size()
public StringOfObject ext(Object elem)
throws IllegalArgumentException
IllegalArgumentExceptionext(StringOfObject, Object),
add(Object),
addFront(Object),
addAfterIndex(int, java.lang.Object),
addBeforeIndex(int, java.lang.Object)
public StringOfObject add(Object elem)
throws IllegalArgumentException
IllegalArgumentExceptionext(Object),
ext(StringOfObject, Object),
addFront(Object),
addAfterIndex(int, java.lang.Object),
addBeforeIndex(int, java.lang.Object)
public StringOfObject addFront(Object elem)
throws IllegalArgumentException
IllegalArgumentExceptionadd(Object),
ext(Object),
ext(StringOfObject, Object),
addAfterIndex(int, java.lang.Object),
addBeforeIndex(int, java.lang.Object)
public StringOfObject addAfterIndex(int afterThisOne,
Object elem)
throws IndexOutOfBoundsException,
IllegalArgumentException
IndexOutOfBoundsException
IllegalArgumentExceptionaddBeforeIndex(int, java.lang.Object),
addFront(Object),
add(Object),
ext(Object),
ext(StringOfObject, Object)
public StringOfObject addBeforeIndex(int beforeThisOne,
Object elem)
throws IndexOutOfBoundsException,
IllegalArgumentException
IndexOutOfBoundsException
IllegalArgumentExceptionaddAfterIndex(int, java.lang.Object),
addFront(Object),
add(Object),
ext(Object),
ext(StringOfObject, Object)public StringOfObject concat(StringOfObject s)
composedWith(org.jmlspecs.models.resolve.StringOfObject)public StringOfObject composedWith(StringOfObject s)
concat(org.jmlspecs.models.resolve.StringOfObject)
public StringOfObject addAll(Collection c)
throws IllegalArgumentException
IllegalArgumentExceptionaddAll(Object[]),
from(Collection)
public StringOfObject addAll(Object[] c)
throws IllegalArgumentException
IllegalArgumentExceptionaddAll(Collection)public StringOfObject rev()
reverse()public StringOfObject reverse()
rev()
public StringOfObject pow(int n)
throws IllegalArgumentException
IllegalArgumentExceptioncomposedWith(org.jmlspecs.models.resolve.StringOfObject)public boolean equals(Object x)
equals in interface JMLTypeequals in class Object#compareTo(Object),
#compareTo(StringOfObject)public Object clone()
JMLType
clone in interface JMLTypeclone in class Objectpublic int occurs_ct(Object y)
public boolean has(Object elem)
JMLCollection
has in interface JMLCollectionpublic boolean isEmpty()
int_size(),
length()public int hashCode()
JMLType
hashCode in interface JMLTypehashCode in class Objectpublic String toString()
toString in class Objectpublic JMLIterator iterator()
iterator in interface JMLCollectionelements()public JMLObjectSequenceEnumerator elements()
iterator()public boolean isPrefix(StringOfObject s2)
isProperPrefix(org.jmlspecs.models.resolve.StringOfObject),
isSuffix(org.jmlspecs.models.resolve.StringOfObject)public boolean isProperPrefix(StringOfObject s2)
isPrefix(org.jmlspecs.models.resolve.StringOfObject),
isProperSuffix(org.jmlspecs.models.resolve.StringOfObject)public boolean isProperSuffix(StringOfObject s2)
isSuffix(org.jmlspecs.models.resolve.StringOfObject),
isProperPrefix(org.jmlspecs.models.resolve.StringOfObject)public boolean isSuffix(StringOfObject s2)
isProperSuffix(org.jmlspecs.models.resolve.StringOfObject),
isPrefix(org.jmlspecs.models.resolve.StringOfObject)
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||