public class Item
extends java.lang.Object
implements java.lang.Comparable
Constructor and Description |
---|
Item()
Default Constructor
|
Item(int variable,
int value)
Parameters Constructor
|
Modifier and Type | Method and Description |
---|---|
Item |
clone()
Clone function
|
int |
compareTo(java.lang.Object a)
Function to compare objects of the Item class
Necessary to be able to use "sort" function
It sorts in an decreasing order of attribute
If equals, in an decreasing order of attribute's value
|
int |
getValue()
It returns the value of the item
|
int |
getVariable()
It returns the variable of the item
|
boolean |
isEqual(Item a)
Function to check if an item is equal to another given
|
void |
setValues(int variable,
int value)
It sets the pair of values to the item
|
public Item()
Default Constructor
public Item(int variable, int value)
Parameters Constructor
variable
- int Value which represents an input attribute of a rulevalue
- int Value attached to the variablepublic void setValues(int variable, int value)
It sets the pair of values to the item
variable
- int Value which represents an input attribute of a rulevalue
- int Value attached to the variablepublic int getVariable()
It returns the variable of the item
public int getValue()
It returns the value of the item
public Item clone()
Clone function
clone
in class java.lang.Object
public boolean isEqual(Item a)
Function to check if an item is equal to another given
a
- Item Item to compare with ourspublic int compareTo(java.lang.Object a)
compareTo
in interface java.lang.Comparable
a
- Item to compare with.