public class Preference
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Preference.Relation
Relations describe the logical relation between preferences.
|
Constructor and Description |
---|
Preference()
Default constructor for Preference.
|
Preference(int issue1,
int issue2,
Preference.Relation relation,
boolean isQuery)
Creates a preference that stores the issue numbers, a simple relation, and whether the preference represents a query or a statement.
|
Preference(Preference pref)
Constructor for Preference that makes a copy of another Preference.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o)
Implementation of the equals method for Preference.
|
int |
getIssue1()
returns the first issue of the Preference.
|
int |
getIssue2()
returns the second issue of the preference.
|
Preference.Relation |
getRelation()
returns the relation of the Preference.
|
boolean |
isQuery()
returns whether or not the Preference is a query.
|
void |
setIssue1(int issue1)
Sets the first issue of the preference.
|
void |
setIssue2(int issue2)
Sets the second issue of the preference.
|
void |
setQuery(boolean isQuery)
Sets whether or not the preference is a query about the adversary's preference.
|
void |
setRelation(Preference.Relation relation)
Sets the relation of the preference.
|
java.lang.String |
toString()
A method to turn the Preference into plaintext.
|
public Preference()
public Preference(Preference pref)
pref
- the Preference to be copied.public Preference(int issue1, int issue2, Preference.Relation relation, boolean isQuery)
issue1
- a numerical code for the issue (or -1 if no issue)issue2
- a numerical code for the issue (or -1 if no issue)relation
- an enum of types of Relations (>, <, =, etc.)isQuery
- if the preference is a query (Do you like?) vs. a statement (I like.)public void setRelation(Preference.Relation relation)
relation
- the relation to setpublic void setIssue1(int issue1)
issue1
- the numerical value to set as issue1.public void setIssue2(int issue2)
issue2
- the numerical value to set as issue2.public void setQuery(boolean isQuery)
isQuery
- the value to set this.isQuery as.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- The preference to compare to.public Preference.Relation getRelation()
public int getIssue1()
public int getIssue2()
public boolean isQuery()
public java.lang.String toString()
toString
in class java.lang.Object