rdr.core
Class Case

java.lang.Object
  extended by rdr.core.Case
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class Case
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

Case object. Consists of a set of case values. The definitions for the attributes are found in dm The caseValues match one to one with the domainModel attributes

Author:
Ivan Bindoff
See Also:
Serialized Form

Constructor Summary
Case()
          Makes a new, blank case, with default values using the default domain model.
Case(int id, DomainModel dm)
          Makes a new, blank case, with all default values.
Case(int id, common.datastructures.MyFastVector<Value> caseValues, DomainModel dm)
          Constructs a case object
Case(int id, common.datastructures.MyFastVector<Value> caseValues, common.datastructures.MyFastVector<Attribute> dm)
          Creates a case object dumbly (no error checks) - primarily for cloning
 
Method Summary
 java.lang.Object clone()
          Creates a cloned copy of this Case
 boolean compareToCase(Case compare)
          Method to compare this case with another case, and return if they have all the same values or not Warning: currently only checks if they have the same name
 boolean equals(Case c)
           
 int getId()
           
 Value getValue(Attribute attr)
          Return a particular Value of a particular attribute.
 Value getValue(java.lang.String name)
          Return a particular Value of a particular attribute.
 common.datastructures.MyFastVector<Value> getValues()
           
 java.lang.String[] getValuesArray()
          Get the case values for setting up a JTable with the data
 void setValues(common.datastructures.MyFastVector<Value> caseValues)
          Gives this case a set of values.
 java.lang.String toString()
          Convert the case into an easily readable text representation
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Case

public Case(int id,
            common.datastructures.MyFastVector<Value> caseValues,
            DomainModel dm)
Constructs a case object

Parameters:
id - the case id
caseValues - the set of values which make up the case
dm - the domain model which defines what a case should be like

Case

public Case(int id,
            common.datastructures.MyFastVector<Value> caseValues,
            common.datastructures.MyFastVector<Attribute> dm)
Creates a case object dumbly (no error checks) - primarily for cloning

Parameters:
id -
caseValues -
dm -

Case

public Case()
Makes a new, blank case, with default values using the default domain model.


Case

public Case(int id,
            DomainModel dm)
Makes a new, blank case, with all default values.

Parameters:
id -
dm -
Method Detail

clone

public java.lang.Object clone()
Creates a cloned copy of this Case

Overrides:
clone in class java.lang.Object
Returns:
the cloned case

getValues

public common.datastructures.MyFastVector<Value> getValues()
Returns:
the set of values which make up this case

getId

public int getId()
Returns:
the case's id

getValuesArray

public java.lang.String[] getValuesArray()
Get the case values for setting up a JTable with the data

Returns:
an array of strings which represent this case's data

setValues

public void setValues(common.datastructures.MyFastVector<Value> caseValues)
Gives this case a set of values. Warning: this method doesn't check that the values are of the correct type for the current domain model, so you'll have to do that in advance. Or just use the constructor, which does the check for you.

Parameters:
caseValues - the set of values you want to give this case

toString

public java.lang.String toString()
Convert the case into an easily readable text representation

Overrides:
toString in class java.lang.Object

compareToCase

public boolean compareToCase(Case compare)
Method to compare this case with another case, and return if they have all the same values or not Warning: currently only checks if they have the same name

Parameters:
compare - the case to compare against
Returns:
true if this case is the same as the compare case, false otherwise.

getValue

public Value getValue(java.lang.String name)
Return a particular Value of a particular attribute.

Parameters:
name - the name of the attribute you want to get the value for
Returns:
the value, or null if the attribute can't be found

getValue

public Value getValue(Attribute attr)
Return a particular Value of a particular attribute.

Parameters:
attr - the attribute you want to get the value for
Returns:
the value, or null if the attribute can't be found

equals

public boolean equals(Case c)
Parameters:
c -
Returns:
true if the provided case c has all the same values as this case, or false otherwise.