de.uka.ipd.consensus.impl
Class SuperSubclassImpl

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

public class SuperSubclassImpl
extends Object
implements SuperSubclass

TODO

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

Constructor Summary
protected SuperSubclassImpl(Topic subclass, Topic superclass, 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 getSubclass()
          Returns the subclass topic of a superclass-subclass-relationship between two topics.
 Topic getSuperclass()
          Returns the superclass topic of a superclass-subclass-relationship between two topics.
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SuperSubclassImpl

protected SuperSubclassImpl(Topic subclass,
                            Topic superclass,
                            Association assoc)
Method Detail

getSuperclass

public Topic getSuperclass()
Description copied from interface: SuperSubclass
Returns the superclass topic of a superclass-subclass-relationship between two topics.

Specified by:
getSuperclass in interface SuperSubclass
Returns:
the superclass topic, never null

getSubclass

public Topic getSubclass()
Description copied from interface: SuperSubclass
Returns the subclass topic of a superclass-subclass-relationship between two topics.

Specified by:
getSubclass in interface SuperSubclass
Returns:
the subclass 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()