de.uka.ipd.consensus.foundation.schema
Interface Rating

All Superinterfaces:
Commentatable, Comparable, Createable, Serializable, Versionable
All Known Implementing Classes:
SQLRatingImpl, TM4JRatingImpl

public interface Rating
extends Versionable, Createable, Commentatable, Serializable, Comparable

This interface represents one rating given by a user to a rateable element.

Version:
2006-06-14
Author:
Thomas Much
See Also:
User, Rateable, RatingManager

Field Summary
static double NEUTRAL
          The proposed neutral value for ratings.
static double NO
          The proposed minimum value for ratings (disagreement).
static double YES
          The proposed maximum value for ratings (agreement).
 
Method Summary
 Collection getHistory()
          Returns a collection of Rating objects that contain all older values for this rating (i.e. the rating for this element from the creator of the rating).
 Rateable getRateable()
          Returns the rated element.
 Version getRatedVersion()
          Returns the version of the rated element.
 double getValue()
          Returns the rating's value from -1.0 to 1.0 (including both values).
 boolean isHistorical()
          Checks if this rating is historic, i.e. if it contains older values than the element's current rating.
 void setValue(double value)
          Changes the rating's value and adds the old values to the history.
 
Methods inherited from interface de.uka.ipd.consensus.foundation.schema.Versionable
getVersion
 
Methods inherited from interface de.uka.ipd.consensus.foundation.schema.Createable
getCreator
 
Methods inherited from interface de.uka.ipd.consensus.foundation.schema.Commentatable
getComment, setComment
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

NO

public static final double NO
The proposed minimum value for ratings (disagreement).

See Also:
Constant Field Values

YES

public static final double YES
The proposed maximum value for ratings (agreement).

See Also:
Constant Field Values

NEUTRAL

public static final double NEUTRAL
The proposed neutral value for ratings.

See Also:
Constant Field Values
Method Detail

getValue

public double getValue()
Returns the rating's value from -1.0 to 1.0 (including both values).

Returns:
the rating's value
See Also:
setValue(double)

setValue

public void setValue(double value)
Changes the rating's value and adds the old values to the history. If this is a historic rating, changing its value has no effect.

Parameters:
value - the new value from -1.0 to 1.0 (including both values)
See Also:
getValue(), getHistory(), isHistorical()

getRateable

public Rateable getRateable()
Returns the rated element. This can be only a concept (topic, association, attribute) or a user. However, if you want to retrieve an association wrapper like Synonym, SuperSubclass or TypeInstance (which are Rateable, too), use OntologyManager.checkInternalRateable() to convert the returned association into one of these wrappers.

Returns:
the rated element
See Also:
OntologyManager.checkInternalRateable(Rateable)

getRatedVersion

public Version getRatedVersion()
Returns the version of the rated element. This is the element's version at the time when the rating was assigned to the element, not necessarily the element's current version.

Returns:
the version of the rated element, may be null if no version information is available

isHistorical

public boolean isHistorical()
Checks if this rating is historic, i.e. if it contains older values than the element's current rating. Historic ratings are read-only.

Returns:
true if this rating belongs to the rating history, false if it is a current rating
See Also:
getHistory(), setValue(double), Commentatable.setComment(User, String)

getHistory

public Collection getHistory()
Returns a collection of Rating objects that contain all older values for this rating (i.e. the rating for this element from the creator of the rating). If this rating is a historical rating itself or if the RatingManager does not support rating histories, an empty collection is returned.

Returns:
a possibly empty collection, never null
See Also:
isHistorical()