JML

org.jmlspecs.models
Class JMLString

java.lang.Object
  extended byorg.jmlspecs.models.JMLString
All Implemented Interfaces:
Cloneable, Comparable, JMLComparable, JMLType, Serializable

public class JMLString
extends Object
implements JMLComparable

A reflection of String that implements JMLType.

Version:
$Revision: 1.24 $
Author:
Gary T. Leavens
See Also:
String, JMLType

Field Summary
static JMLString EMPTY
          The empty JMLString.
protected  String str_
          The contents of this object.
 
Constructor Summary
JMLString()
          Initialize the contents of this object to be the empty string.
JMLString(String s)
          Initialize the contents of this object to be the given string.
 
Method Summary
 Object clone()
          Return a clone of this string.
 int compareTo(Object op2)
          Compare this to op2, returning a comparison code.
 int compareTo(JMLString another)
          Compares this to another.
 JMLString concat(char c)
          Produce a new JMLString that is the concatentation of the JMLString and a char.
 JMLString concat(String s)
          Produce a new JMLString that is the concatentation of the JMLString and a String.
 JMLString concat(JMLString s)
          Produce a new JMLString that is the concatentation of two JMLStrings.
 boolean equals(Object s)
          Tell if these two strings are equal.
 boolean equalsIgnoreCase(String another)
          Are these strings equal, except for case?
 boolean equalsIgnoreCase(JMLString another)
          Are these strings equal, except for case?
 int hashCode()
          Return a hash code for this object.
 String toString()
          Return theString.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

str_

protected String str_
The contents of this object.


EMPTY

public static final JMLString EMPTY
The empty JMLString.

See Also:
JMLString()
Constructor Detail

JMLString

public JMLString()
Initialize the contents of this object to be the empty string.

See Also:
EMPTY

JMLString

public JMLString(String s)
          throws IllegalArgumentException
Initialize the contents of this object to be the given string.

Throws:
IllegalArgumentException
Method Detail

clone

public Object clone()
Return a clone of this string.

Specified by:
clone in interface JMLType
Overrides:
clone in class Object

compareTo

public int compareTo(Object op2)
              throws ClassCastException,
                     NullPointerException
Compare this to op2, returning a comparison code.

Specified by:
compareTo in interface JMLComparable
Parameters:
op2 - the object this is compared to.
Throws:
ClassCastException - when o is not a JMLString.
NullPointerException - when o is null.
See Also:
equals(Object), compareTo(JMLString)

compareTo

public int compareTo(JMLString another)
Compares this to another.

See Also:
equals(Object), compareTo(Object)

equals

public boolean equals(Object s)
Tell if these two strings are equal.

Specified by:
equals in interface JMLType
Overrides:
equals in class Object
See Also:
equalsIgnoreCase(String), equalsIgnoreCase(JMLString), compareTo(Object), compareTo(JMLString)

equalsIgnoreCase

public boolean equalsIgnoreCase(JMLString another)
Are these strings equal, except for case?

See Also:
equals(java.lang.Object), equalsIgnoreCase(String), compareTo(Object), compareTo(JMLString)

equalsIgnoreCase

public boolean equalsIgnoreCase(String another)
Are these strings equal, except for case?

See Also:
equals(java.lang.Object), equalsIgnoreCase(JMLString), compareTo(Object), compareTo(JMLString)

hashCode

public int hashCode()
Return a hash code for this object.

Specified by:
hashCode in interface JMLType
Overrides:
hashCode in class Object

toString

public String toString()
Return theString.

Overrides:
toString in class Object

concat

public JMLString concat(JMLString s)
Produce a new JMLString that is the concatentation of two JMLStrings.


concat

public JMLString concat(String s)
Produce a new JMLString that is the concatentation of the JMLString and a String.


concat

public JMLString concat(char c)
Produce a new JMLString that is the concatentation of the JMLString and a char.


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.