All Packages Class Hierarchy This Package Previous Next Index
Class guinea.ui.RankOrderAnswer
java.lang.Object
|
+----guinea.ui.RankOrderAnswer
- public class RankOrderAnswer
- extends Object
- implements Cloneable, Serializable
Variable Index
- ·
labels
- The labels.
- ·
ranks
- The ranks for corresponding labels.
Constructor Index
- ·
RankOrderAnswer()
- Construct a new object.
- ·
RankOrderAnswer(int)
- Construct a new rank order answer object.
- ·
RankOrderAnswer(String[])
- Construct a new rank order answer object.
- ·
RankOrderAnswer(String[], int[])
- Construct a new rank order answer object.
Method Index
- ·
areAllRanksGiven()
- Tell whether all labels have been ranked.
- ·
clearLabels()
- Clear all labels.
- ·
clearRanks()
- Clear ranks for all labels.
- ·
clone()
- Clone the object.
- ·
getLabel(int)
-
- ·
getLabelIndex(String)
-
- ·
getLabels()
- Get the labels.
- ·
getNumLabels()
-
- ·
getRank(int)
- Get the rank of a label.
- ·
getRank(String)
- Get the rank of a label.
- ·
getRankIndex(int)
-
- ·
getRankLabel(int)
-
- ·
getRanks()
- Get the ranks.
- ·
numGivenRanks()
- Get number of labels that have been ranked.
- ·
setLabels(String[])
- Set labels.
- ·
setRank(int, int)
- Set the rank of a label.
- ·
setRank(String, int)
- Set the rank of a label.
- ·
setRanks(int[])
- Set ranks.
- ·
toString()
- Get a string representation of the answer object.
Variables
·
labels
protected String labels[]
- The labels.
·
ranks
protected int ranks[]
- The ranks for corresponding labels.
Constructors
·
RankOrderAnswer
public RankOrderAnswer()
- Construct a new object. Labels and ranks are yet
unallocated.
·
RankOrderAnswer
public RankOrderAnswer(int numRanks)
- Construct a new rank order answer object. Initializes empty
arrays for labels and ranks.
- Parameters:
- numRanks - Number of labels and ranks.
·
RankOrderAnswer
public RankOrderAnswer(String labels[])
- Construct a new rank order answer object. Initializes labels
from array given as a parameter. Allocates equal amount of
room for corresponding ranks.
- Parameters:
- labels - Labels for ranking order answer.
·
RankOrderAnswer
public RankOrderAnswer(String labels[],
int ranks[])
- Construct a new rank order answer object. Initializes labels
and ranks from arrays given as parameters.
- Parameters:
- labels - Labels for ranking order answer.
- ranks - Initial ranks for corresponding labels.
Methods
·
clearRanks
public void clearRanks()
- Clear ranks for all labels. The rank for each label is set to
zero (meaning that a rank for that label hasn't been set).
·
clearLabels
public void clearLabels()
- Clear all labels. A
null
is set as the label.
·
setLabels
public void setLabels(String labels[])
- Set labels. Ranks are cleared also.
- Parameters:
- labels - Labels for rank order answer.
·
setRanks
public void setRanks(int ranks[])
- Set ranks.
- Parameters:
- ranks - The ranks of corresponding labels.
·
areAllRanksGiven
public boolean areAllRanksGiven()
- Tell whether all labels have been ranked. All labels have
been ranked if all ranks are greater than zero.
- Returns:
-
true
if all ranks have been given.
·
numGivenRanks
public int numGivenRanks()
- Get number of labels that have been ranked.
- Returns:
- Number of labels that have been ranked.
·
getRank
public int getRank(int index)
- Get the rank of a label.
- Parameters:
- index - The index of the label whose rank to get from
rank array.
- Returns:
- The rank for a label. Zero means that the label
hasn't have been given a rank yet.
·
getLabel
public String getLabel(int index)
·
getRank
public int getRank(String label)
- Get the rank of a label.
- Parameters:
- label - The label whose rank to get.
- Returns:
- The rank for a label. Zero means that the label
hasn't have been given a rank yet.
·
getLabelIndex
public int getLabelIndex(String label)
·
getRankIndex
public int getRankIndex(int rank)
·
getRankLabel
public String getRankLabel(int rank)
·
getNumLabels
public int getNumLabels()
·
setRank
public void setRank(int index,
int rank)
- Set the rank of a label.
- Parameters:
- index - The index of the label whose rank to set in the
rank array.
- rank - The rank for the label. Zero means that the label
hasn't have been given a rank yet.
·
setRank
public void setRank(String label,
int rank)
- Set the rank of a label.
- Parameters:
- label - The label whose rank to set.
- rank - The rank for a label. Zero means that the label
hasn't have been given a rank yet.
·
getLabels
public String[] getLabels()
- Get the labels.
- Returns:
- An array of labels.
·
getRanks
public int[] getRanks()
- Get the ranks.
- Returns:
- An array of ranks.
·
toString
public String toString()
- Get a string representation of the answer object. The string
contains a comma separated list of labels in the order they
are ranked. The label having rank of 1 is the first. Labels
that have no rank are not shown.
- Returns:
- A string showing the ranking order.
- Overrides:
- toString in class Object
·
clone
public Object clone()
- Clone the object.
- Returns:
- A new clone of the object.
- Overrides:
- clone in class Object
All Packages Class Hierarchy This Package Previous Next Index