net.sourceforge.cilib.type.types
Class Long

java.lang.Object
  extended by net.sourceforge.cilib.type.types.Numeric
      extended by net.sourceforge.cilib.type.types.Long
All Implemented Interfaces:
Serializable, Comparable<Numeric>, BoundedType, Randomizable, Resetable, Type, Cloneable

public class Long
extends Numeric

Author:
leo
See Also:
Serialized Form

Constructor Summary
Long()
          Create an instance of Long.
Long(long value)
          Create an Long with the specified value.
Long(Long copy)
          Create a copy of the provided instance.
Long(long lower, long upper)
          Create an instance of Long randomly initialised between lower and upper.
 
Method Summary
 int compareTo(Numeric other)
          
 boolean equals(Object other)
          Compare the specified object with this type for equality.
 boolean getBit()
          Get the value of this Numeric.
 Long getClone()
          Create a cloned copy of the current object and return it.
 int getInt()
          Get the value of this Numeric.
 long getLong()
           
 double getReal()
          Get the value of this Numeric.
 String getRepresentation()
          Get the type representation of this Long object as a string.
 int hashCode()
          Return the value of the object itself.
 void randomize(Random random)
          Apply a randomization using the provided Random.
 void readExternal(ObjectInput ois)
          Read off the provided ObjectInput.
 void reset()
          Reset the instance to a predefined state.
 void set(boolean value)
          Set the value of the Numeric.
 void set(double value)
          Set the value of the Numeric.
 void set(int value)
          Set the value of the Numeric.
 void set(String value)
          Set the value of the Numeric.
 void setBit(boolean value)
          Set the bit value with the provided value.
 void setBit(String value)
          Set the bit value with the provided value.
 void setInt(int value)
          Set the integer value with the provided value.
 void setInt(String value)
          Set the integer value with the provided value.
 void setLong(long value)
           
 void setReal(double value)
          Set the real value with the provided value.
 void setReal(String value)
          Set the real value with the provided value.
 String toString()
          
 void writeExternal(ObjectOutput oos)
          Write this Long to the provided ObjectOutput.
 
Methods inherited from class net.sourceforge.cilib.type.types.Numeric
getBounds, setBounds, setBounds
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Long

public Long()
Create an instance of Long.


Long

public Long(long lower,
            long upper)
Create an instance of Long randomly initialised between lower and upper.

Parameters:
lower - The lower bound.
upper - The upper bound.

Long

public Long(long value)
Create an Long with the specified value.

Parameters:
value - The value of the Long.

Long

public Long(Long copy)
Create a copy of the provided instance.

Parameters:
copy - The instance to copy.
Method Detail

getClone

public Long getClone()
Create a cloned copy of the current object and return it. In general the created copy will be a deep copy of the provided instance. As a result this operation an be quite expensive if used incorrectly.

Specified by:
getClone in interface Type
Specified by:
getClone in interface Cloneable
Specified by:
getClone in class Numeric
Returns:
An exact clone of the current object instance.
See Also:
Object.clone()

equals

public boolean equals(Object other)
Compare the specified object with this type for equality. Returns true if and only if the specified object is also an instance of the same type.

Specified by:
equals in interface Type
Overrides:
equals in class Numeric
Parameters:
other - The object to compare.
Returns:
true if equality exists, false otherwise.
See Also:
Object.equals(Object)

hashCode

public int hashCode()
Return the value of the object itself. This is accordance to the manner in which Long.hashCode() operates.

Specified by:
hashCode in interface Type
Overrides:
hashCode in class Numeric
Returns:
The value of this Long representation.
See Also:
Object.equals(Object), Type.equals(Object)

set

public void set(String value)
Set the value of the Numeric.

Specified by:
set in class Numeric
Parameters:
value - The String value to be parsed.

set

public void set(boolean value)
Set the value of the Numeric.

Specified by:
set in class Numeric
Parameters:
value - The boolean value representing the value for this Type.

set

public void set(double value)
Set the value of the Numeric.

Specified by:
set in class Numeric
Parameters:
value - The double value representing the value for this Type.

set

public void set(int value)
Set the value of the Numeric.

Specified by:
set in class Numeric
Parameters:
value - The int value representing the value for this Type.

getBit

public boolean getBit()
Get the value of this Numeric.

Specified by:
getBit in class Numeric
Returns:
The value of this Numeric as a boolean.

setBit

public void setBit(boolean value)
Set the bit value with the provided value.

Specified by:
setBit in class Numeric
Parameters:
value - The value to set.

setBit

public void setBit(String value)
Set the bit value with the provided value.

Specified by:
setBit in class Numeric
Parameters:
value - The value to set.

setLong

public void setLong(long value)

getLong

public long getLong()

getInt

public int getInt()
Get the value of this Numeric.

Specified by:
getInt in class Numeric
Returns:
The value of this Numeric as a int.

setInt

public void setInt(int value)
Set the integer value with the provided value.

Specified by:
setInt in class Numeric
Parameters:
value - The value to set.

setInt

public void setInt(String value)
Set the integer value with the provided value.

Specified by:
setInt in class Numeric
Parameters:
value - The value to set.

getReal

public double getReal()
Get the value of this Numeric.

Specified by:
getReal in class Numeric
Returns:
The value of this Numeric as a double.

setReal

public void setReal(double value)
Set the real value with the provided value.

Specified by:
setReal in class Numeric
Parameters:
value - The value to set.

setReal

public void setReal(String value)
Set the real value with the provided value.

Specified by:
setReal in class Numeric
Parameters:
value - The value to set.

compareTo

public int compareTo(Numeric other)

Specified by:
compareTo in interface Comparable<Numeric>
Specified by:
compareTo in class Numeric

randomize

public void randomize(Random random)
Apply a randomization using the provided Random.

Parameters:
random - The Random to use for the randomization.

reset

public void reset()
Reset the instance to a predefined state.


toString

public String toString()

Overrides:
toString in class Object

getRepresentation

public String getRepresentation()
Get the type representation of this Long object as a string.

Specified by:
getRepresentation in class Numeric
Returns:
The String representation of this Type object.

writeExternal

public void writeExternal(ObjectOutput oos)
                   throws IOException
Write this Long to the provided ObjectOutput.

Parameters:
oos - The ObjectOutput to write on.
Throws:
IOException - If an error occurs during the write operation.

readExternal

public void readExternal(ObjectInput ois)
                  throws IOException,
                         ClassNotFoundException
Read off the provided ObjectInput.

Parameters:
ois - The ObjectInput to read off.
Throws:
IOException - If an I/O error occurs.
ClassNotFoundException - If the class to instantiate was not found.


Copyright © 2009 CIRG. All Rights Reserved.