cnrg.itx.ds
Class Digits

java.lang.Object
  |
  +--cnrg.itx.ds.Digits

public class Digits
extends java.lang.Object
implements java.io.Serializable

This class provides an abstraction to digits

See Also:
Serialized Form

Field Summary
private  int[] m_Number
           
 
Constructor Summary
Digits(int num)
          Constructor for integer.
Digits(int[] n)
          Constructor for integer array
Digits(java.lang.String num)
          Constructor for string of digits.
 
Method Summary
private  int[] clone(int[] n)
          Returns a duplicate copy
 int count()
          Count the number of digits in this digits object
 boolean equals(Digits digits)
          Compare with other digits instance to determine if they are identical
 int[] getArray()
          Returns itself represented as an array of int
 int getValue()
          Get the digits value
 java.lang.String toString()
          Returns itself represented as a string
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

m_Number

private int[] m_Number
Constructor Detail

Digits

public Digits(java.lang.String num)
Constructor for string of digits. The constructor does nothing if the input string is not in digits form.
Parameters:
num - string of digits

Digits

public Digits(int num)
Constructor for integer. The constructor does nothing if the input integer is less than 1.
Parameters:
num - integer value

Digits

public Digits(int[] n)
Constructor for integer array
Parameters:
n - array of int
Method Detail

getValue

public int getValue()
Get the digits value
Returns:
integer value of this Digits object

count

public int count()
Count the number of digits in this digits object
Returns:
the number of digits in this object

clone

private int[] clone(int[] n)
Returns a duplicate copy
Parameters:
n - array of int
Returns:
array of int

getArray

public int[] getArray()
Returns itself represented as an array of int
Returns:
array of int

toString

public java.lang.String toString()
Returns itself represented as a string
Returns:
string of digits
Overrides:
toString in class java.lang.Object

equals

public boolean equals(Digits digits)
Compare with other digits instance to determine if they are identical
Parameters:
digits - another digits object to be compared
Returns:
true if identical; false otherwise