public class Register extends java.lang.Object implements java.lang.Comparable<Register>
Constructor and Description |
---|
Register(int id,
double value,
int oclass)
Creates a register from a id, a value attribute and an output class of the item.
|
Register(Register reg)
Creates a register from another existing register
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Register other_register)
Overriden function that symbolizes if the other register is equal, greater or smaller than the original
register with a integer as response
|
boolean |
equals(java.lang.Object obj)
Checks if a register is the same register as another object
|
double |
getAttributeValue()
Gets the value stored in the register
|
int |
getIdentifier()
Gets the identifier of the register itself
|
int |
getOutputClass()
Gets the class of the register
|
int |
hashCode()
Hash-code function for the class that is used when object is inserted in a structure like a hashtable
|
void |
setAttributeValue(double value)
Replaces the value of the corresponding attribute with another new value
|
void |
setIdentifier(int id)
Replaces the value of the identifier of the register with another new identifier
|
void |
setOutputClass(int oclass)
Replaces the class associated with the register with another class
|
java.lang.String |
toString()
Overriden function that converts the class to a string
|
public Register(int id, double value, int oclass)
id
- Identifier of the registervalue
- Value of the corresponding attributeoclass
- Class of the registerpublic Register(Register reg)
reg
- Original register from which we are going to create a copypublic int getIdentifier()
public double getAttributeValue()
public int getOutputClass()
public void setIdentifier(int id)
id
- New identifier of the registerpublic void setAttributeValue(double value)
value
- New value of the corresponding attributepublic void setOutputClass(int oclass)
oclass
- New class of the registerpublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- Object that is checked to see if it is the same registerObject.equals(java.lang.Object)
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public int compareTo(Register other_register)
compareTo
in interface java.lang.Comparable<Register>
other_register
- Register object to compare with.