Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.uka.ipd.consensus.foundation.schema
Interface Rateable

All Superinterfaces:
  Serializable

All Known Subinterfaces:
  Association, Attribute, Concept, SuperSubclass, Synonym, Topic, TypeInstance, User

All Known Implementing Classes:
  AssociationImpl, AttributeImpl, SuperSubclassImpl, SynonymImpl, TM4JTopicWrapper, TopicImpl, TypeInstanceImpl, UserImpl

public interface Rateable
extends Serializable

This is a mixin interface for rateable elements.

Version:
  2006-06-14
Author:
  Thomas Much
See Also:
  `Rating`

Method Summary
`Rating` | `addRating(User rater, double value)` Adds a rating for the given user to this element.
`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.

Method Detail

### getId

    public String getId()

  Returns the id of the element that is unique within the ontology. This is used to distinguish concepts and users.

  Returns:
    the id (never empty, never `null`)

### addRating

    public Rating addRating(User rater,
                            double value)
                     throws RatingManagerException,
                            DynamicRightsManagerException

  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.

  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:
    `RatingManagerException` - if the rating could not be created/changed
    `DynamicRightsManagerException` - if the user is not allowed to rate this element
  See Also:
    `RatingManager`, `DynamicRightsManager.mayAddRating(Rating, Rateable)`

### getRatings

    public Collection getRatings()

  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`.

  Returns:
    a possibly empty collection, never `null`
  See Also:
    `Rating`, `RatingManager`

### getRatingsCount

    public int getRatingsCount()

  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.

  Returns:
    the number of ratings for this element.

### getRating

    public Rating getRating(User rater)

  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`.

  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()

  Returns the average value (the arithmetic mean) of all current ratings for this element.

  Returns:
    the arithmetic mean of all ratings for this element

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD