de.uka.ipd.consensus.impl
Class SynonymImpl

java.lang.Object
  extended byde.uka.ipd.consensus.impl.SynonymImpl
All Implemented Interfaces:
Comparable, Rateable, Serializable, Synonym

public class SynonymImpl
extends Object
implements Synonym

TODO

Version:
2006-06-14
Author:
Thomas Much
See Also:
Serialized Form

Constructor Summary
protected SynonymImpl(Topic topic, Topic synonym, Association assoc)
           
 
Method Summary
 Rating addRating(User rater, double value)
          Adds a rating for the given user to this element.
 int compareTo(Object other)
           
 boolean equals(Object other)
           
 double getAverageRatingValue()
          Returns the average value (the arithmetic mean) of all current ratings for this element.
 String getId()
          Returns the id of the element that is unique within the ontology.
 Rating getRating(User rater)
          Returns the rating of the given user for this element.
 Collection getRatings()
          Returns a collection of all current Rating objects (from different users) for this element.
 int getRatingsCount()
          Returns the number of ratings for this element.
 Topic getSynonym()
          Returns the synonymous topic of a synonym-relationship between two topics.
 Topic getTopic()
          Returns the base topic of a synonym-relationship between two topics, i.e. the topic from which the Synonym object is retrieved.
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SynonymImpl

protected SynonymImpl(Topic topic,
                      Topic synonym,
                      Association assoc)
Method Detail

getTopic

public Topic getTopic()
Description copied from interface: Synonym
Returns the base topic of a synonym-relationship between two topics, i.e. the topic from which the Synonym object is retrieved.

Specified by:
getTopic in interface Synonym
Returns:
the base topic, never null

getSynonym

public Topic getSynonym()
Description copied from interface: Synonym
Returns the synonymous topic of a synonym-relationship between two topics.

Specified by:
getSynonym in interface Synonym
Returns:
the synonymous topic, never null

getId

public String getId()
Description copied from interface: Rateable
Returns the id of the element that is unique within the ontology. This is used to distinguish concepts and users.

Specified by:
getId in interface Rateable
Returns:
the id (never empty, never null)

addRating

public Rating addRating(User rater,
                        double value)
                 throws RatingManagerException,
                        DynamicRightsManagerException
Description copied from interface: Rateable
Adds a rating for the given user to this element. If the user has rated the element already, only the rating's value is changed. Otherwise, this method creates and adds a new rating using suitable RatingManager methods.

Specified by:
addRating in interface Rateable
Parameters:
rater - the user who wants to add or change the rating
value - the new value
Returns:
the newly created or the existing but changed rating
Throws:
DynamicRightsManagerException - if the user is not allowed to rate this element
RatingManagerException - if the rating could not be created/changed
See Also:
RatingManager, DynamicRightsManager.mayAddRating(Rating, Rateable)

getRatings

public Collection getRatings()
Description copied from interface: Rateable
Returns a collection of all current Rating objects (from different users) for this element. This method exists just for convenience and delegates to one of the getRatings() methods of RatingManager.

Specified by:
getRatings in interface Rateable
Returns:
a possibly empty collection, never null
See Also:
Rating, RatingManager

getRatingsCount

public int getRatingsCount()
Description copied from interface: Rateable
Returns the number of ratings for this element. Each user can have only one current rating for each element, i.e. historical ratings do not count.

Specified by:
getRatingsCount in interface Rateable
Returns:
the number of ratings for this element.

getRating

public Rating getRating(User rater)
Description copied from interface: Rateable
Returns the rating of the given user for this element. This method exists just for convenience and delegates to one of the getRatings() methods of RatingManager.

Specified by:
getRating in interface Rateable
Parameters:
rater - the user who's rating shall be returned
Returns:
the rating of the user or null if the user hasn't rated this element yet
See Also:
RatingManager

getAverageRatingValue

public double getAverageRatingValue()
Description copied from interface: Rateable
Returns the average value (the arithmetic mean) of all current ratings for this element.

Specified by:
getAverageRatingValue in interface Rateable
Returns:
the arithmetic mean of all ratings for this element

equals

public boolean equals(Object other)

hashCode

public int hashCode()

compareTo

public int compareTo(Object other)
Specified by:
compareTo in interface Comparable

toString

public String toString()