JML

java.util
Class RandomAccessSubList

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byjava.util.SubList
              extended byjava.util.RandomAccessSubList
All Implemented Interfaces:
Collection, List, RandomAccess

class RandomAccessSubList
extends SubList
implements RandomAccess


Class Specifications

Specifications inherited from class AbstractList
protected initially this.modCount == 0;

Specifications inherited from class Object
represents objectState <- org.jmlspecs.lang.JMLDataGroup.IT;
public represents _getClass <- \typeof(this);

Specifications inherited from interface List
instance public represents theCollection <- this.theList.toBag();

Specifications inherited from interface Collection
instance public invariant this.elementType == this.theCollection.elementType;
instance public invariant this.containsNull == this.theCollection.containsNull;
instance public invariant !this.nullElementsSupported ==> !this.containsNull;

Model Field Summary
 
Model fields inherited from class java.lang.Object
_getClass, objectState, theString
 
Model fields inherited from interface java.util.List
theList
 
Model fields inherited from interface java.util.Collection
addOperationSupported, elementState, nullElementsSupported, removeOperationSupported, theCollection
 
Ghost Field Summary
 
Ghost fields inherited from class java.lang.Object
objectTimesFinalized, owner
 
Ghost fields inherited from interface java.util.Collection
containsNull, elementType
 
Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
(package private) RandomAccessSubList(AbstractList list, int fromIndex, int toIndex)
           
 
Model Method Summary
 
Model methods inherited from class java.lang.Object
hashValue
 
Model methods inherited from interface java.util.Collection
hashValue
 
Method Summary
 void add(int index, Object element)
           
 boolean addAll(int index, Collection c)
           
 boolean addAll(Collection c)
           
 Object get(int index)
           
 Iterator iterator()
           
 ListIterator listIterator(int index)
           
 Object remove(int index)
           
protected  void removeRange(int fromIndex, int toIndex)
           
 Object set(int index, Object element)
           
 int size()
           
 List subList(int fromIndex, int toIndex)
           
 
Methods inherited from class java.util.AbstractList
add, clear, equals, hashCode, indexOf, lastIndexOf, listIterator
 
Methods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Constructor Detail

RandomAccessSubList

RandomAccessSubList(AbstractList list,
                    int fromIndex,
                    int toIndex)
Method Detail

subList

public List subList(int fromIndex,
                    int toIndex)
Specified by:
subList in interface List
Overrides:
subList in class SubList
Specifications: (inherited)pure
Specifications inherited from overridden method in class SubList:
      --- None ---
Specifications inherited from overridden method in class AbstractList:
       pure
Specifications inherited from overridden method subList(int fromIndex, int toIndex) in interface List:
       pure
public normal_behavior
requires 0 <= fromIndex&&fromIndex <= this.size()&&0 <= toIndex&&toIndex <= this.size()&&fromIndex <= toIndex;
assignable \nothing;
ensures \result != null&&\result .theList.equals(this.theList.subsequence(fromIndex,toIndex));
     also
public exceptional_behavior
requires !(0 <= fromIndex&&fromIndex <= this.size())||!(0 <= toIndex&&toIndex <= this.size())||!(fromIndex <= toIndex);
assignable \nothing;
signals_only java.lang.IndexOutOfBoundsException;
    implies_that
public normal_behavior
requires 0 <= fromIndex&&fromIndex <= toIndex;

set

public Object set(int index,
                  Object element)
Specified by:
set in interface List
Overrides:
set in class AbstractList
Specifications inherited from overridden method set(int index, Object element) in class AbstractList:
     also
protected exceptional_behavior
requires \typeof(this) == \type(java.util.AbstractList);
assignable \nothing;
signals_only java.lang.UnsupportedOperationException;
Specifications inherited from overridden method set(int index, Object element) in interface List:
public behavior
requires !this.containsNull ==> element != null;
requires (element == null)||\typeof(element) <: this.elementType;
{|
requires 0 <= index&&index < this.size();
assignable theCollection;
ensures \result == (\old(this.theList.get(index)));
ensures this.theList.equals(\old(this.theList.subsequence(0,index)).insertBack(element).concat(\old(this.theList.subsequence(index+1,this.size()))));
signals_only java.lang.UnsupportedOperationException, java.lang.ClassCastException, java.lang.NullPointerException, java.lang.IllegalArgumentException;
signals (java.lang.UnsupportedOperationException) (* set method not supported by list *);
signals (java.lang.ClassCastException) (* class of specified element prevents it from being added to this *);
signals (java.lang.NullPointerException) (* element is null and null elements not supported by this *);
signals (java.lang.IllegalArgumentException) (* some aspect of element prevents it from being added to this *);
also
requires !(0 <= index&&index < this.size());
assignable \nothing;
ensures false;
signals_only java.lang.UnsupportedOperationException, java.lang.IndexOutOfBoundsException;
|}

get

public Object get(int index)
Specifications: (inherited)pure
Specifications inherited from overridden method in class AbstractList:
       pure
Specifications inherited from overridden method get(int index) in interface List:
       pure
public normal_behavior
requires 0 <= index&&index < this.size();
assignable \nothing;
ensures \result == this.theList.get(index);
     also
public exceptional_behavior
requires !(0 <= index&&index < this.size());
assignable \nothing;
signals_only java.lang.IndexOutOfBoundsException;
    implies_that
public normal_behavior
requires index >= 0;
ensures (\result == null)||\typeof(\result ) <: this.elementType;
ensures !this.containsNull ==> \result != null;

size

public int size()
Specifications: (inherited)pure
Specifications inherited from overridden method in class AbstractCollection:
       pure
Specifications inherited from overridden method in interface List:
       pure
Specifications inherited from overridden method in interface Collection:
       pure
public normal_behavior
assignable \nothing;
ensures \result == this.theCollection.int_size();
ensures \result >= 0;

add

public void add(int index,
                Object element)
Specified by:
add in interface List
Overrides:
add in class AbstractList
Specifications inherited from overridden method add(int index, Object element) in class AbstractList:
     also
protected exceptional_behavior
requires \typeof(this) == \type(java.util.AbstractList);
assignable \nothing;
signals_only java.lang.UnsupportedOperationException;
Specifications inherited from overridden method add(int index, Object element) in interface List:
public behavior
requires !this.containsNull ==> element != null;
requires (element == null)||\typeof(element) <: this.elementType;
{|
requires 0 <= index&&index <= this.size();
assignable theCollection;
ensures (element == null&&this.theList.get(index) == null)||(this.theList.get(index).equals(element))&&( \forall int i; 0 <= i&&i < index; (this.theList.get(i) == null&&\old(this.theList).get(i) == null)||this.theList.get(i).equals(\old(this.theList.get(i))))&&( \forall int i; index <= i&&i < \old(this.size()); (this.theList.get((int)(i+1)) == null&&\old(this.theList).get(i) == null)||this.theList.get((int)(i+1)).equals(\old(this.theList.get(i))));
signals_only java.lang.UnsupportedOperationException, java.lang.ClassCastException, java.lang.NullPointerException, java.lang.IllegalArgumentException;
signals (java.lang.UnsupportedOperationException) (* add method not supported by list *);
signals (java.lang.ClassCastException) (* class of specified element prevents it from being added to this *);
signals (java.lang.NullPointerException) (* element is null and null elements are not supported by this *);
signals (java.lang.IllegalArgumentException) (* some aspect of element prevents it from being added to this *);
also
requires !(0 <= index&&index <= this.size());
assignable \nothing;
ensures false;
signals_only java.lang.UnsupportedOperationException, java.lang.IndexOutOfBoundsException;
|}

remove

public Object remove(int index)
Specified by:
remove in interface List
Overrides:
remove in class AbstractList
Specifications inherited from overridden method remove(int index) in class AbstractList:
     also
protected exceptional_behavior
requires \typeof(this) == \type(java.util.AbstractList);
assignable \nothing;
signals_only java.lang.UnsupportedOperationException;
Specifications inherited from overridden method remove(int index) in interface List:
public behavior
{|
requires 0 <= index&&index < this.size();
assignable theCollection;
ensures \result == (\old(this.theList.get(index)));
ensures ( \forall int i; 0 <= i&&i < index; (this.theList.get(i) == null&&\old(this.theList).get(i) == null)||this.theList.get(i) == (\old(this.theList.get(i))))&&( \forall \bigint i; index <= i&&i < (\old(this.size()-1)); (this.theList.get((int)i) == null&&\old(this.theList).get((int)(i+1)) == null)||this.theList.get((int)i) == (\old(this.theList.get((int)(i+1)))));
signals_only java.lang.UnsupportedOperationException;
signals (java.lang.UnsupportedOperationException) (* remove method not supported by list *);
also
requires 0 <= index&&index < this.size();
assignable theCollection;
ensures (\result == null)||\typeof(\result ) <: this.elementType;
ensures !this.containsNull ==> \result != null;
also
requires !(0 <= index&&index < this.size());
assignable \nothing;
ensures false;
signals_only java.lang.UnsupportedOperationException, java.lang.IndexOutOfBoundsException;
|}

removeRange

protected void removeRange(int fromIndex,
                           int toIndex)
Overrides:
removeRange in class AbstractList
Specifications inherited from overridden method removeRange(int fromIndex, int toIndex) in class AbstractList:
protected normal_behavior
requires 0 <= fromIndex&&fromIndex <= toIndex&&toIndex <= this.size();
{|
requires fromIndex == toIndex;
assignable \nothing;
also
requires fromIndex < toIndex&&toIndex < this.size();
assignable theCollection;
ensures this.theList.equals(\old(this.theList.subsequence(0,fromIndex).concat(this.theList.subsequence(toIndex,this.size()))));
|}

addAll

public boolean addAll(Collection c)
Specified by:
addAll in interface List
Overrides:
addAll in class AbstractCollection
Specifications inherited from overridden method in class AbstractCollection:
      --- None ---
Specifications inherited from overridden method in interface List:
      --- None ---
Specifications inherited from overridden method addAll(Collection c) in interface Collection:
public behavior
requires c != null;
requires c.elementType <: this.elementType;
requires !this.containsNull ==> !c.containsNull;
assignable theCollection;
ensures this.theCollection.equals(\old(this.theCollection).union(c.theCollection));
signals_only java.lang.UnsupportedOperationException, java.lang.ClassCastException, java.lang.IllegalArgumentException, java.lang.NullPointerException;
signals (java.lang.UnsupportedOperationException) (* this does not support addAll *);
signals (java.lang.ClassCastException) (* class of specified element prevents it from being added to this *);
signals (java.lang.IllegalArgumentException) (* some aspect of this element prevents it from being added to this *);
signals (java.lang.NullPointerException) (* argument contains null elements and this does not support null elements *);
     also
public exceptional_behavior
requires c == null;
assignable \nothing;
signals_only java.lang.NullPointerException;

addAll

public boolean addAll(int index,
                      Collection c)
Specified by:
addAll in interface List
Overrides:
addAll in class AbstractList
Specifications inherited from overridden method in class AbstractList:
      --- None ---
Specifications inherited from overridden method addAll(int index, Collection c) in interface List:
public behavior
requires c != null;
requires 0 <= index&&index <= this.size();
requires c.elementType <: this.elementType;
requires !this.containsNull ==> !c.containsNull;
assignable theCollection;
ensures \result ==> this.theList.equals(\old(this.theList.subsequence(0,index)).concat(org.jmlspecs.models.JMLEqualsSequence.convertFrom(c)).concat(\old(this.theList.subsequence(index,this.size()))));
signals_only java.lang.UnsupportedOperationException, java.lang.IllegalArgumentException;
signals (java.lang.UnsupportedOperationException) (* if this operation is not supported *);
signals (java.lang.IllegalArgumentException) (* if some aspect of c prevents its elements from being added to the list *);
     also
public exceptional_behavior
requires c == null||!(0 <= index&&index <= this.size())||!(c.elementType <: this.elementType)||(!this.containsNull&&c.containsNull);
assignable \nothing;
signals_only java.lang.UnsupportedOperationException, java.lang.ClassCastException, java.lang.NullPointerException, java.lang.IndexOutOfBoundsException;
signals (java.lang.ClassCastException) c != null&&!(c.elementType <: this.elementType);
signals (java.lang.NullPointerException) c == null;
signals (java.lang.IndexOutOfBoundsException) !(0 <= index&&index <= this.size());

iterator

public Iterator iterator()
Specified by:
iterator in interface List
Overrides:
iterator in class AbstractList
Specifications: (inherited)pure
Specifications inherited from overridden method in class AbstractList:
       pure
Specifications inherited from overridden method in class AbstractCollection:
       pure
Specifications inherited from overridden method in interface List:
       pure
     also
public behavior
assignable \nothing;
ensures \result != null;
ensures this.size() < 2147483647 ==> ( \forall int i; 0 <= i&&i < this.size(); \result .hasNext(i)&&\result .nthNextElement(i) == this.toArray()[i]);
Specifications inherited from overridden method in interface Collection:
       pure non_null
public normal_behavior
assignable \nothing;
ensures \result != null;
ensures \result .elementType == this.elementType;
ensures this.containsNull == \result .returnsNull;
     also
public normal_behavior
ensures ( \forall int i; 0 <= i&&i < this.size(); this.theCollection.has(\result .nthNextElement(i)));
ensures ( \forall java.lang.Object o; ; this.theCollection.has(o) ==> ( \exists int i; 0 <= i&&i < this.size(); o.equals(\result .nthNextElement(i))));
ensures this.size() > 0 ==> \result .hasNext((int)(this.size()-1));
ensures !\result .hasNext((int)(this.size()));
ensures_redundantly ( \forall int i; 0 <= i&&i < this.size(); this.contains(\result .nthNextElement(i)));
ensures_redundantly this.size() != 0 ==> \result .moreElements;

listIterator

public ListIterator listIterator(int index)
Specified by:
listIterator in interface List
Overrides:
listIterator in class AbstractList
Specifications: (inherited)pure
Specifications inherited from overridden method in class AbstractList:
       pure
Specifications inherited from overridden method listIterator(int index) in interface List:
       pure non_null
public normal_behavior
requires 0 <= index&&index < this.size();
assignable \nothing;
ensures \result != null&&this.size() < 2147483647 ==> ( \forall int i; index <= i&&i < this.size(); \result .hasNext(i)&&\result .nthNextElement(i) == this.toArray()[i]);
     also
public exceptional_behavior
requires index < 0&&this.size() <= index;
signals_only java.lang.IndexOutOfBoundsException;
    implies_that
ensures \result .elementType == this.elementType;
ensures this.containsNull == \result .returnsNull;

JML

JML is Copyright (C) 1998-2002 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This release depends on code from the MultiJava project and is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.