JML

org.jmlspecs.samples.list.node
Class OneWayNode

java.lang.Object
  extended byorg.jmlspecs.samples.list.node.OneWayNode
Direct Known Subclasses:
TwoWayNode

public class OneWayNode
extends Object


Class Specifications
public invariant_redundantly this.entries != null&&this.allButFirst != null;
protected represents theEntry <- this.entry_;
protected represents nextNode <- this.nextNode_;
protected represents entries <- this.nextEntries().insertFront(this.entry_);
protected represents allButFirst <- this.nextEntries();

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

Model Field Summary
 JMLObjectSequence allButFirst
           
 JMLObjectSequence entries
           
 OneWayNode nextNode
           
 Object theEntry
           
 
Model fields inherited from class java.lang.Object
_getClass, objectState, theString
 
Ghost Field Summary
 
Ghost fields inherited from class java.lang.Object
objectTimesFinalized, owner
 
Field Summary
protected  Object entry_
           
protected  OneWayNode nextNode_
           
 
Constructor Summary
  OneWayNode()
           
  OneWayNode(nullable Object ent)
           
protected OneWayNode(nullable Object ent, nullable OneWayNode nxtNode)
           
 
Model Method Summary
 JMLObjectSequence nextEntries()
           
 JMLObjectSequence nextEntries(nullable OneWayNode curr)
           
 
Model methods inherited from class java.lang.Object
hashValue
 
Method Summary
 Object clone()
           
 Object getEntry()
           
 OneWayNode getNextNode()
           
 boolean hasNext()
           
 void insertAfter(nullable Object newEntry)
           
 void removeNextNode()
           
 void setEntry(nullable Object newEntry)
           
protected  String stringOfEntries(nullable OneWayNode curr)
          Returns the string concatentation of all nodes following this node up to and excluding the end of the chain or this, which ever is reached first (i.e. this method will terminate even for circular lists).
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Model Field Detail

entries

public JMLObjectSequence entries
Specifications:
datagroup contains: org.jmlspecs.samples.list.node.TwoWayNode.prevEntries allButFirst theEntry nextNode entry_ nextNode_.entries

allButFirst

public JMLObjectSequence allButFirst
Specifications:
is in groups: entries
datagroup contains: nextNode nextNode_.entries nextNode_.allButFirst

theEntry

public Object theEntry
Specifications: nullable
is in groups: entries
datagroup contains: entry_

nextNode

public OneWayNode nextNode
Specifications: nullable
is in groups: entries allButFirst
datagroup contains: org.jmlspecs.samples.list.node.TwoWayNode.nextDL nextNode_
Field Detail

entry_

protected Object entry_
Specifications: nullable
is in groups: theEntry entries

nextNode_

protected OneWayNode nextNode_
Specifications: nullable
is in groups: nextNode
maps nextNode_.entries \into entries allButFirst, nextNode_.allButFirst \into allButFirst
Constructor Detail

OneWayNode

public OneWayNode()
Specifications:
public normal_behavior
assignable entries;
ensures this.theEntry == null&&this.entries.int_size() == 1&&this.entries.itemAt(0) == null&&this.allButFirst.isEmpty();

OneWayNode

public OneWayNode(nullable Object ent)
Specifications:
public normal_behavior
assignable entries;
ensures this.theEntry == ent&&this.entries.int_size() == 1&&this.entries.itemAt(0) == ent&&this.allButFirst.isEmpty();

OneWayNode

protected OneWayNode(nullable Object ent,
                     nullable OneWayNode nxtNode)
Model Method Detail

nextEntries

public JMLObjectSequence nextEntries()
Specifications: pure

nextEntries

public JMLObjectSequence nextEntries(nullable OneWayNode curr)
Specifications: pure
Method Detail

getEntry

public Object getEntry()
Specifications: pure nullable
public normal_behavior
assignable \nothing;
ensures \result == this.theEntry;

setEntry

public void setEntry(nullable Object newEntry)
Specifications:
public normal_behavior
assignable theEntry;
ensures this.theEntry == newEntry&&this.entries.itemAt(0) == newEntry;

getNextNode

public OneWayNode getNextNode()
Specifications: pure nullable
public normal_behavior
assignable \nothing;
ensures \result == this.nextNode;

insertAfter

public void insertAfter(nullable Object newEntry)
Specifications:
public normal_behavior
assignable allButFirst;
ensures this.allButFirst.equals(\old(this.allButFirst).insertFront(newEntry));

removeNextNode

public void removeNextNode()
Specifications:
public normal_behavior
requires !this.allButFirst.isEmpty();
assignable entries;
ensures this.allButFirst.equals(\old(this.allButFirst).trailer());
     also
requires this.allButFirst.isEmpty();
assignable \nothing;
ensures \not_modified(entries);

hasNext

public boolean hasNext()
Specifications:
public normal_behavior
assignable \nothing;
ensures \result == (this.nextNode != null);

clone

public Object clone()
Overrides:
clone in class Object
Specifications:
     also
public normal_behavior
assignable \nothing;
ensures \result instanceof org.jmlspecs.samples.list.node.OneWayNode&&((org.jmlspecs.samples.list.node.OneWayNode)\result ).entries.equals(this.entries);
Specifications inherited from overridden method in class Object:
       non_null
protected normal_behavior
requires this instanceof java.lang.Cloneable;
assignable \nothing;
ensures \result != null;
ensures \typeof(\result ) == \typeof(this);
ensures (* \result is a clone of this *);
     also
protected normal_behavior
requires this.getClass().isArray();
assignable \nothing;
ensures \elemtype(\typeof(\result )) == \elemtype(\typeof(this));
ensures ((java.lang.Object[])\result ).length == ((java.lang.Object[])this).length;
ensures ( \forall int i; 0 <= i&&i < ((java.lang.Object[])this).length; ((java.lang.Object[])\result )[i] == ((java.lang.Object[])this)[i]);
     also
requires this.getClass().isArray();
assignable \nothing;
ensures \elemtype(\typeof(\result )) == \elemtype(\typeof(this));
ensures java.lang.reflect.Array.getLength(\result ) == java.lang.reflect.Array.getLength(this);
ensures ( \forall int i; 0 <= i&&i < java.lang.reflect.Array.getLength(this); ( \exists java.lang.Object result_i; result_i == java.lang.reflect.Array.get(\result ,i); (result_i == null&&java.lang.reflect.Array.get(this,i) == null)||(result_i != null&&result_i.equals(java.lang.reflect.Array.get(this,i)))));
     also
protected exceptional_behavior
requires !(this instanceof java.lang.Cloneable);
assignable \nothing;
signals_only java.lang.CloneNotSupportedException;
     also
protected normal_behavior
requires \elemtype(\typeof(this)) <: \type(java.lang.Object);
assignable \nothing;
ensures \elemtype(\typeof(\result )) == \elemtype(\typeof(this));
ensures ((java.lang.Object[])\result ).length == ((java.lang.Object[])this).length;
ensures ( \forall int i; 0 <= i&&i < ((java.lang.Object[])this).length; ((java.lang.Object[])\result )[i] == ((java.lang.Object[])this)[i]);
     also
protected normal_behavior
requires \elemtype(\typeof(this)) == \type(int);
assignable \nothing;
ensures \elemtype(\typeof(\result )) == \elemtype(\typeof(this));
ensures ((int[])\result ).length == ((int[])this).length;
ensures ( \forall int i; 0 <= i&&i < ((int[])this).length; ((int[])\result )[i] == ((int[])this)[i]);
     also
protected normal_behavior
requires \elemtype(\typeof(this)) == \type(byte);
assignable \nothing;
ensures \elemtype(\typeof(\result )) == \elemtype(\typeof(this));
ensures ((byte[])\result ).length == ((byte[])this).length;
ensures ( \forall int i; 0 <= i&&i < ((byte[])this).length; ((byte[])\result )[i] == ((byte[])this)[i]);
     also
protected normal_behavior
requires \elemtype(\typeof(this)) == \type(char);
assignable \nothing;
ensures \elemtype(\typeof(\result )) == \elemtype(\typeof(this));
ensures ((char[])\result ).length == ((char[])this).length;
ensures ( \forall int i; 0 <= i&&i < ((char[])this).length; ((char[])\result )[i] == ((char[])this)[i]);
     also
protected normal_behavior
requires \elemtype(\typeof(this)) == \type(long);
assignable \nothing;
ensures \elemtype(\typeof(\result )) == \elemtype(\typeof(this));
ensures ((long[])\result ).length == ((long[])this).length;
ensures ( \forall int i; 0 <= i&&i < ((long[])this).length; ((long[])\result )[i] == ((long[])this)[i]);
     also
protected normal_behavior
requires \elemtype(\typeof(this)) == \type(short);
assignable \nothing;
ensures \elemtype(\typeof(\result )) == \elemtype(\typeof(this));
ensures ((short[])\result ).length == ((short[])this).length;
ensures ( \forall int i; 0 <= i&&i < ((short[])this).length; ((short[])\result )[i] == ((short[])this)[i]);
     also
protected normal_behavior
requires \elemtype(\typeof(this)) == \type(boolean);
assignable \nothing;
ensures \elemtype(\typeof(\result )) == \elemtype(\typeof(this));
ensures ((boolean[])\result ).length == ((boolean[])this).length;
ensures ( \forall int i; 0 <= i&&i < ((boolean[])this).length; ((boolean[])\result )[i] == ((boolean[])this)[i]);
     also
protected normal_behavior
requires \elemtype(\typeof(this)) == \type(float);
assignable \nothing;
ensures \elemtype(\typeof(\result )) == \elemtype(\typeof(this));
ensures ((float[])\result ).length == ((float[])this).length;
ensures ( \forall int i; 0 <= i&&i < ((float[])this).length; (java.lang.Float.isNaN(((float[])\result )[i])&&java.lang.Float.isNaN(((float[])this)[i]))||((float[])\result )[i] == ((float[])this)[i]);
     also
protected normal_behavior
requires \elemtype(\typeof(this)) == \type(double);
assignable \nothing;
ensures \elemtype(\typeof(\result )) == \elemtype(\typeof(this));
ensures ((double[])\result ).length == ((double[])this).length;
ensures ( \forall int i; 0 <= i&&i < ((double[])this).length; (java.lang.Double.isNaN(((double[])\result )[i])&&java.lang.Double.isNaN(((double[])this)[i]))||((double[])\result )[i] == ((double[])this)[i]);

toString

public String toString()
Overrides:
toString in class Object
Specifications: pure
Specifications inherited from overridden method in class Object:
       non_null
public normal_behavior
assignable objectState;
ensures \result != null&&\result .equals(this.theString);
ensures (* \result is a string representation of this object *);
     also
public code normal_behavior
assignable \nothing;
ensures \result != null&&(* \result is the instance's class name, followed by an @, followed by the instance's hashcode in hex *);
     also
public code model_program { ... }
    implies_that
assignable objectState;
ensures \result != null;

stringOfEntries

protected String stringOfEntries(nullable OneWayNode curr)
Returns the string concatentation of all nodes following this node up to and excluding the end of the chain or this, which ever is reached first (i.e. this method will terminate even for circular lists).

Specifications: pure

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.