ru.novosoft.dc.core.util
Class Strings

java.lang.Object
  |
  +--ru.novosoft.dc.core.util.Strings

public class Strings
extends java.lang.Object
implements java.lang.Cloneable, java.lang.Comparable

The class contains an array of values of the String type. The array length is specifed while constructing. Two primitive operations, namely set and get, are provided. The class allows the deep copy and deep compare operations. It implements the Comparable interface which compares the lexicographical ordering of two String arrays. The toString method returns the first string in the array.


Constructor Summary
Strings(int size)
          Construct an array of values of the specified size.
Strings(java.lang.String[] parameters)
          Construct an object as a wrapper of the specified array of values.
 
Method Summary
 java.lang.Object clone()
          Create a deep copy of this object.
 int compareTo(java.lang.Object obj)
          Compare this object with the specified object for order.
 boolean equals(java.lang.Object obj)
          Compare this object with another vector of values and return true if they coinside.
 java.lang.String get(int index)
          Return the value of the specified index.
 java.lang.String set(int index, java.lang.String value)
          Set a value of the specified index and return it.
 int size()
          Return a length of the array.
 java.lang.String toString()
          Return a value of 0th index.
 java.lang.String[] values()
          Return the array of values wrapped by this object.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Strings

public Strings(int size)
Construct an array of values of the specified size.

Strings

public Strings(java.lang.String[] parameters)
Construct an object as a wrapper of the specified array of values.
Method Detail

size

public final int size()
Return a length of the array.

values

public final java.lang.String[] values()
Return the array of values wrapped by this object.

get

public final java.lang.String get(int index)
Return the value of the specified index.

set

public final java.lang.String set(int index,
                                  java.lang.String value)
Set a value of the specified index and return it.

clone

public java.lang.Object clone()
Create a deep copy of this object.
Overrides:
clone in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Compare this object with another vector of values and return true if they coinside.
Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(java.lang.Object obj)
Compare this object with the specified object for order. The strings are compared lexicographically in increasing order of indices. Null value preceeds any other string. String array of lesser size preceeds to string array of greater size if their common part is equal
Specified by:
compareTo in interface java.lang.Comparable
Throws:
ClassCastException - if the object to be compared is not of Strings type.

toString

public java.lang.String toString()
Return a value of 0th index.
Overrides:
toString in class java.lang.Object