Class Examination

All Implemented Interfaces:
ILightObject, Serializable

public class Examination extends LightObject
Since:
1.0 Dec 28, 2008
Author:
Steph GAUDRY
See Also:
Serialized Form
  • Field Details

  • Constructor Details

    • Examination

      public Examination()
      Creates a new Examination with all default values :
      • id : -1
      • date : now
      • course : new Course
      • maximum : 10
    • Examination

      public Examination(int id)
      Creates a new Examination with all default values :
      • date : now
      • course : new Course
      • maximum : 10
      Parameters:
      id -
    • Examination

      public Examination(Course course)
      Creates a new Examination with some default values :
      • id : -1
      • date : now
      • maximum : 10
      Parameters:
      course - course to set
    • Examination

      public Examination(int id, Course value)
      Creates a new Examination with some default values :
      • date : now
      • maximum : 10
      Parameters:
      id -
      value - course to set
    • Examination

      public Examination(Course course, int maximum)
      Creates a new Examination with default Date (now) and id (-1)
      Parameters:
      course - course to set
      maximum - maximum of the value
    • Examination

      public Examination(int id, Course course, int maximum)
      Creates a new Quotation with default Date (now)
      Parameters:
      id -
      course - course to set
      maximum - maximum of the value
    • Examination

      public Examination(Date date, Course course, int maximum)
      Creates a new Examination with default id (-1)
      Parameters:
      date - date of the quotation
      course - course to set
      maximum - maximum of the value
    • Examination

      public Examination(Date date, Course course)
      Creates a new Examination with some default values :
      • id : -1
      • maximum : 10
      Parameters:
      date - date of the quotation
      course - course to set
    • Examination

      public Examination(int id, Date date, Course course, int maximum)
      Creates a new Examination with some default values :
      • comment : empty string
      Parameters:
      id -
      date - date of the quotation
      course - course to set
      maximum - maximum of the value
    • Examination

      public Examination(int id, Date date, Course course, int maximum, String comment)
      Parameters:
      id -
      date - date of the quotation
      course - course to set
      maximum - maximum of the value
      comment -
  • Method Details

    • addPropertyChangeListener

      public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
      Add a property change listener for a specific property.
      Parameters:
      propertyName - The name of the property to listen on.
      listener - The PropertyChangeListener to be added.
    • removePropertyChangeListener

      public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
      Remove a property change listener for a specific property.
      Parameters:
      propertyName - The name of the property that was listened on.
      listener - The PropertyChangeListener to be removed
    • getAverage

      public Quotation getAverage()
      Iterate all Quotation to retrieve value and compute average if not corresponding to empty quotation or student absent for this examination
      Returns:
    • addQuotation

      public void addQuotation(Student student, Quotation quotation)
      Associates the specified Quotation with the specified Student key in this map (optional operation). If the map previously contained a mapping for the key, the old value is replaced by the specified value.

      Uses Map.put implementation.
      Parameters:
      student - key to store the quotation
      quotation - quotation to store
    • removeQuotation

      public void removeQuotation(Student student)
      Removes the Quotation for a Student key from the quotations map if it is present (optional operation).

      Uses Map.remove implementation.
      Parameters:
      student -
    • getQuotation

      public Quotation getQuotation(Student student)
      Parameters:
      student - key to retrieve the Quotation

      Uses Map.get implementation.
      Returns:
      quotation for the given student, or null if not found
    • getDate

      public Date getDate()
      Returns:
      the date
    • setDate

      public void setDate(Date date)
      Parameters:
      date - the date to set
    • getMaximum

      public int getMaximum()
      Returns:
      the maximum
    • setMaximum

      public void setMaximum(int maximum)
      Parameters:
      maximum - the maximum to set
    • getComment

      public String getComment()
      Returns:
      the comment
    • setComment

      public void setComment(String comment)
      Parameters:
      comment - the comment to set
    • getCourse

      public Course getCourse()
      Returns:
      the course
    • setCourse

      public void setCourse(Course course)
      Don't use this method to add an examination for a course. This method does not make reverse link.
      Use Course.add(Examination) instead of this to make bidirectional link.
      Parameters:
      course - the course to set
    • getQuotations

      public Map<Student,​Quotation> getQuotations()
      Returns:
      the quotations
    • equals

      public boolean equals(Object o)
      Description copied from class: AbstractLightObject
      Indicates whether some other object is "equal to" this LightObject.
      Check is done on following fields :
      • id
      • getDisplay method (Use getDisplay instead of display because getDisplay may be override in child class, and display field may be null).
      Overrides:
      equals in class AbstractLightObject
      Parameters:
      o - the reference object with which to compare.
      Returns:
      true if this LightObject is the same as the obj argument; false otherwise.
      See Also:
      AbstractLightObject.hashCode()
    • hashCode

      public int hashCode()
      Description copied from class: AbstractLightObject
      Returns a hash code value for this LightObject.
      Hash is done on following fields :
      • id
      • ILightObject.getDisplay() method if not null (Use getDisplay instead of display because getDisplay may be override in child class, and display field may be null).
      Overrides:
      hashCode in class AbstractLightObject
      Returns:
      a hash code value for this LightObject.
      See Also:
      AbstractLightObject.equals(Object)
    • toString

      public String toString()
      Returns a string representation of the Examination.
      Format : "date : course (max)"
      Overrides:
      toString in class AbstractLightObject
      Returns:
      a String representation of this Examination
      See Also:
      Object.toString()