org.rubato.math.arith
Class RingString

java.lang.Object
  extended by org.rubato.math.arith.RingString
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<RingString>
Direct Known Subclasses:
CString, QString, RString, ZnString, ZString

public abstract class RingString
extends java.lang.Object
implements java.lang.Comparable<RingString>, java.io.Serializable, java.lang.Cloneable

The ring of strings. Strings are represented by sum(a_i*s_i), where the a_i are elements in a ring and the s_i are character strings (String).

See Also:
Serialized Form

Constructor Summary
RingString(RingString rs)
          Creates a new RingString instance.
 
Method Summary
 void add(RingString x)
          Add x to this.
abstract  java.lang.Object clone()
           
 int compareTo(RingString rs)
           
 RingString difference(RingString x)
          Returns the difference of this and x.
 boolean equals(java.lang.Object object)
          Two RingString's are equal if they have the same character strings and the corresponding factors of each are equal.
static double[] fold(RingString[] elements)
           
 java.lang.Object getFactorForString(java.lang.String word)
          Returns the factor for the character string.
 java.lang.String getString()
          Returns one character string in the RingString.
 java.util.Set<java.lang.String> getStrings()
          Returns a Set of all the strings in the terms of the RingString.
 int hashCode()
           
 void multiply(RingString x)
          Multiply this by x.
 void negate()
          Negate all factors in this.
 RingString negated()
          Returns this with all factors negated.
 RingString product(RingString x)
          Returns the product of this and x
 void scale(java.lang.Object x)
          Scale this by x.
 RingString scaled(java.lang.Object x)
          Returns this scaled by x.
 java.lang.String stringRep()
           
static double StringToDouble(java.lang.String s)
           
 void subtract(RingString x)
          Subtract x from this.
 RingString sum(RingString x)
          Returns the sum of this and x.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RingString

public RingString(RingString rs)
Creates a new RingString instance. Copy constructor.

Method Detail

getString

public java.lang.String getString()
Returns one character string in the RingString. If the RingString has more than one term, the returned string may be any one of these. If the RingString is empty, null is returned.


getStrings

public java.util.Set<java.lang.String> getStrings()
Returns a Set of all the strings in the terms of the RingString.


getFactorForString

public java.lang.Object getFactorForString(java.lang.String word)
Returns the factor for the character string.


sum

public RingString sum(RingString x)
Returns the sum of this and x.

Returns:
a new RingString object

add

public void add(RingString x)
Add x to this.


difference

public RingString difference(RingString x)
Returns the difference of this and x.

Returns:
a new RingString object.

subtract

public void subtract(RingString x)
Subtract x from this.


product

public RingString product(RingString x)
Returns the product of this and x

Returns:
a new RingString object

multiply

public void multiply(RingString x)
Multiply this by x.


negated

public RingString negated()
Returns this with all factors negated.


negate

public void negate()
Negate all factors in this.


scaled

public RingString scaled(java.lang.Object x)
Returns this scaled by x.

Returns:
a new RingString object

scale

public void scale(java.lang.Object x)
Scale this by x.


equals

public boolean equals(java.lang.Object object)
Two RingString's are equal if they have the same character strings and the corresponding factors of each are equal.

Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(RingString rs)
Specified by:
compareTo in interface java.lang.Comparable<RingString>

clone

public abstract java.lang.Object clone()
Overrides:
clone in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

stringRep

public java.lang.String stringRep()

StringToDouble

public static double StringToDouble(java.lang.String s)

fold

public static double[] fold(RingString[] elements)