JML

org.jmlspecs.samples.digraph
Class SearchableNode

java.lang.Object
  extended byorg.jmlspecs.samples.digraph.ValueNode
      extended byorg.jmlspecs.samples.digraph.SearchableNode
All Implemented Interfaces:
Cloneable, JMLType, NodeType, Serializable

public class SearchableNode
extends ValueNode

Nodes for searchable graphs.

Author:
Katie Becker, Gary T. Leavens

Class Specifications

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

Model Field Summary
 
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
[spec_public] private  Color color
           
[spec_public] private  int discoverTime
           
[spec_public] private  int finishTime
           
[spec_public] private  SearchableNode predecessor
           
 
Fields inherited from class org.jmlspecs.samples.digraph.ValueNode
value
 
Constructor Summary
  SearchableNode(nullable Object v)
           
protected SearchableNode(nullable Object v, int dT, int fT, nullable SearchableNode pred, nullable Color c)
           
 
Model Method Summary
 
Model methods inherited from class java.lang.Object
hashValue
 
Method Summary
protected  String className()
           
 Object clone()
          Return a clone of this object.
 boolean equals(nullable Object o)
          Test whether this object's value is equal to the given argument.
 Color getColor()
           
 int getDiscoverTime()
           
 int getFinishTime()
           
 SearchableNode getPredecessor()
           
 int hashCode()
          Return a hash code for this object.
protected  void setColor(nullable Color c)
           
protected  void setDiscoverTime(int dTime)
           
protected  void setFinishTime(int fTime)
           
protected  void setPredecessor(nullable SearchableNode p)
           
 String toString()
           
 
Methods inherited from class org.jmlspecs.samples.digraph.ValueNode
getValue, setValue
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

discoverTime

private int discoverTime
Specifications: spec_public

finishTime

private int finishTime
Specifications: spec_public

predecessor

private SearchableNode predecessor
Specifications: spec_public nullable

color

private Color color
Specifications: spec_public nullable
Constructor Detail

SearchableNode

public SearchableNode(nullable Object v)
Specifications:
public normal_behavior
assignable value;
ensures this.value == v;

SearchableNode

protected SearchableNode(nullable Object v,
                         int dT,
                         int fT,
                         nullable SearchableNode pred,
                         nullable Color c)
Specifications:
protected normal_behavior
assignable value, discoverTime, finishTime, predecessor, color;
ensures this.value == v&&this.discoverTime == dT&&this.finishTime == fT&&this.predecessor == pred&&org.jmlspecs.models.JMLNullSafe.equals(this.color,c);
Method Detail

equals

public boolean equals(nullable Object o)
Description copied from interface: JMLType
Test whether this object's value is equal to the given argument.

Specified by:
equals in interface NodeType
Overrides:
equals in class ValueNode
Specifications: (inherited)pure
     also
public normal_behavior
requires o instanceof org.jmlspecs.samples.digraph.SearchableNode;
ensures \result ==> org.jmlspecs.models.JMLNullSafe.equals(this.value,((org.jmlspecs.samples.digraph.SearchableNode)o).value)&&this.discoverTime == ((org.jmlspecs.samples.digraph.SearchableNode)o).discoverTime&&this.finishTime == ((org.jmlspecs.samples.digraph.SearchableNode)o).finishTime&&org.jmlspecs.models.JMLNullSafe.equals(this.predecessor,((org.jmlspecs.samples.digraph.SearchableNode)o).predecessor)&&org.jmlspecs.models.JMLNullSafe.equals(this.color,((org.jmlspecs.samples.digraph.SearchableNode)o).color);
     also
public normal_behavior
requires !(o instanceof org.jmlspecs.samples.digraph.SearchableNode);
ensures \result == false;
Specifications inherited from overridden method equals(Object o) in class ValueNode:
     also
public normal_behavior
requires o instanceof org.jmlspecs.samples.digraph.ValueNode;
ensures \result ==> org.jmlspecs.models.JMLNullSafe.equals(this.value,((org.jmlspecs.samples.digraph.ValueNode)o).value);
     also
public normal_behavior
requires !(o instanceof org.jmlspecs.samples.digraph.ValueNode);
ensures \result == false;
Specifications inherited from overridden method equals(Object obj) in class Object:
       pure
public normal_behavior
requires obj != null;
ensures (* \result is true when obj is "equal to" this object *);
     also
public normal_behavior
requires this == obj;
ensures \result ;
     also
public code normal_behavior
requires obj != null;
ensures \result <==> this == obj;
     also
diverges false;
ensures obj == null ==> !\result ;
Specifications inherited from overridden method equals(Object o) in interface NodeType:
       (class)pure
     also
public normal_behavior
requires !(o instanceof org.jmlspecs.samples.digraph.NodeType);
ensures \result == false;
Specifications inherited from overridden method equals(Object ob2) in interface JMLType:
       pure
     also
public normal_behavior
ensures \result ==> ob2 != null&&(* ob2 is not distinguishable from this, except by using mutation or == *);
    implies_that
public normal_behavior
{|
requires ob2 != null&&ob2 instanceof org.jmlspecs.models.JMLType;
ensures ((org.jmlspecs.models.JMLType)ob2).equals(this) == \result ;
also
requires ob2 == this;
ensures \result <==> true;
|}

hashCode

public int hashCode()
Description copied from interface: JMLType
Return a hash code for this object.

Specified by:
hashCode in interface NodeType
Overrides:
hashCode in class ValueNode
Specifications: (inherited)pure
Specifications inherited from overridden method in class ValueNode:
      --- None ---
Specifications inherited from overridden method in class Object:
public behavior
assignable objectState;
ensures (* \result is a hash code for this object *);
     also
public code normal_behavior
assignable \nothing;
Specifications inherited from overridden method in interface NodeType:
       (class)pure
Specifications inherited from overridden method in interface JMLType:
       pure

clone

public Object clone()
Description copied from interface: JMLType
Return a clone of this object.

Specified by:
clone in interface NodeType
Overrides:
clone in class ValueNode
Specifications: (inherited)pure
     also
public normal_behavior
ensures \result instanceof org.jmlspecs.samples.digraph.SearchableNode&&\fresh(\result )&&((org.jmlspecs.samples.digraph.SearchableNode)\result ).equals(this);
ensures_redundantly \result != this;
Specifications inherited from overridden method in class ValueNode:
       pure non_null
     also
public normal_behavior
ensures \result instanceof org.jmlspecs.samples.digraph.ValueNode&&\fresh(\result )&&((org.jmlspecs.samples.digraph.ValueNode)\result ).equals(this);
ensures_redundantly \result != this;
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]);
Specifications inherited from overridden method in interface NodeType:
       (class)pure
     also
public normal_behavior
ensures \result instanceof org.jmlspecs.samples.digraph.NodeType&&((org.jmlspecs.samples.digraph.NodeType)\result ).equals(this);
Specifications inherited from overridden method in interface JMLType:
       pure
     also
public normal_behavior
ensures \result != null;
ensures \result instanceof org.jmlspecs.models.JMLType;
ensures ((org.jmlspecs.models.JMLType)\result ).equals(this);
    implies_that
ensures \result != null&&\typeof(\result ) <: \type(org.jmlspecs.models.JMLType);

setColor

protected void setColor(nullable Color c)
Specifications:
protected normal_behavior
assignable color;
ensures this.color.equals(c);

getColor

public Color getColor()
Specifications: pure nullable
public normal_behavior
assignable \nothing;
ensures \result != null ==> \result .equals(this.color);

setPredecessor

protected void setPredecessor(nullable SearchableNode p)
Specifications:
protected normal_behavior
assignable predecessor;
ensures this.predecessor == p;

getPredecessor

public SearchableNode getPredecessor()
Specifications: pure nullable
public normal_behavior
assignable \nothing;
ensures \result == this.predecessor;

setFinishTime

protected void setFinishTime(int fTime)
Specifications:
protected normal_behavior
assignable finishTime;
ensures this.finishTime == fTime;

getFinishTime

public int getFinishTime()
Specifications: pure
public normal_behavior
assignable \nothing;
ensures \result == this.finishTime;

setDiscoverTime

protected void setDiscoverTime(int dTime)
Specifications:
protected normal_behavior
assignable discoverTime;
ensures this.discoverTime == dTime;

getDiscoverTime

public int getDiscoverTime()
Specifications: pure
public normal_behavior
assignable \nothing;
ensures \result == this.discoverTime;

className

protected String className()
Specifications: non_null (inherited)pure
Specifications inherited from overridden method in class ValueNode:
       pure

toString

public String toString()
Overrides:
toString in class ValueNode
Specifications: non_null
Specifications inherited from overridden method in class ValueNode:
       non_null
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;

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.