Enum Class Audience

java.lang.Object
java.lang.Enum<Audience>
de.hsh.graja.comment.applicability.Audience
All Implemented Interfaces:
Serializable, Comparable<Audience>, Constable

public enum Audience extends Enum<Audience>

This enum specifies the audience of a comment. There are basically two audiences: students and teachers. A comment usually has one of the following audience values:

  • STUDENT: if the comment is for students only,
  • TEACHER: if the comment is for teachers only,
  • BOTH: if the comment is for students and teachers.

A fourth value of this enum is NONE which is used to characterize e. g. an empty set of comments, whose target audience is neither teachers nor students.

  • Enum Constant Details

    • STUDENT

      public static final Audience STUDENT
      The comment is for students only
    • TEACHER

      public static final Audience TEACHER
      The comment is for teachers only
    • BOTH

      public static final Audience BOTH
      The comment is for students and teachers
    • NONE

      public static final Audience NONE
      The comment is neither for students nor for teachers. This value is used to characterize e. g. an empty set of comments.
  • Method Details

    • values

      public static Audience[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Audience valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • isSubAudienceOfOrEqual

      public boolean isSubAudienceOfOrEqual(Audience other)

      Returns true, if the other audience is broader than or equal to this audience.

      • If this audience equals NONE or other audience equals BOTH, then return true.
      • Otherwise, if this audience equals BOTH or other audience equals NONE, then return false.
      • Otherwise return, whether this audience and the other audience are equal.
      Parameters:
      other - another audience
      Returns:
      true, if the other audience is broader than or equal to this audience.
    • getAudienceUnion

      public static Audience getAudienceUnion(Audience a, Audience b)

      Returns the audience resulting from the union of two audiences.

      • If one of the two parameters is null or equals NONE, then the other parameter is returned.
      • Otherwise, if one of the two parameters equals BOTH, then BOTH is returned.
      • Otherwise, if a and b are not equal, it returns BOTH.
      • Otherwise a and b are equal and the method returns a.
      Parameters:
      a - an audience
      b - another audience
      Returns:
      the union of both audiences.
    • getAudienceIntersection

      public static Audience getAudienceIntersection(Audience a, Audience b)

      Returns the audience resulting from the intersection of two audiences.

      • If one of the two parameters is null or equals NONE, then NONE is returned.
      • Otherwise, if one of the two parameters equals BOTH, then the other parameter is returned.
      • Otherwise, if a and b are not equal, it returns NONE.
      • Otherwise a and b are equal and the method returns a.
      Parameters:
      a - an audience
      b - another audience
      Returns:
      the intersection of both audiences.