JML

org.jmlspecs.samples.list.node2
Class OneWayNode

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

public class OneWayNode
extends Object


Class Specifications
protected invariant_redundantly this.nextLink_ != null;
protected invariant this.nextNode_ == this.nextLink_.node;
public invariant_redundantly this.entries != null&&this.allButFirst != null;
public invariant this.entries.equals(this.allButFirst.insertFront(this.theEntry));
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  Link nextLink_
           
protected  OneWayNode nextNode_
           
 
Constructor Summary
protected OneWayNode()
           
  OneWayNode(nullable Object ent)
           
  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 getEntry()
           
 Link getNextLink()
           
 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Model Field Detail

entries

public JMLObjectSequence entries
Specifications:
datagroup contains: org.jmlspecs.samples.list.node2.TwoWayNode.prevEntries allButFirst theEntry 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: allButFirst
datagroup contains: org.jmlspecs.samples.list.node2.TwoWayNode.nextDL nextNode_ nextLink_
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

nextLink_

protected Link nextLink_
Specifications: nullable
is in groups: nextNode
Constructor Detail

OneWayNode

protected OneWayNode()

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

public OneWayNode(nullable Object ent,
                  nullable OneWayNode nxtNode)
Specifications:
public normal_behavior
assignable entries;
ensures this.theEntry == ent&&this.entries.itemAt(0) == ent&&this.nextNode == 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: nullable
protected normal_behavior
assignable \nothing;
ensures \result == this.nextNode;

getNextLink

public Link getNextLink()
Specifications: pure nullable
public normal_behavior
assignable \nothing;
ensures \result .node == 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 allButFirst;
ensures this.allButFirst.equals(\old(this.allButFirst).trailer());
     also
requires this.allButFirst.isEmpty();
assignable \nothing;
ensures this.allButFirst.isEmpty();

hasNext

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

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.