Class Category

java.lang.Object
ntnu.team1.backend.objects.Category
All Implemented Interfaces:
Serializable

public class Category extends Object implements Serializable
A class that represents a category Implements serializable to be able to store the data
See Also:
Serialized Form
  • Constructor Summary

    Constructors
    Constructor
    Description
    Category​(int ID, javafx.scene.paint.Color color, String name)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals​(Object o)
    The method checks similarity: two Category objects are equal if their name and color are identical Identical similarity - two references to the same object Content similarity - the content of two objects is compared by category name and color
    javafx.scene.paint.Color
    Gets the category color
    int
    Gets the category id
    Gets the name
    void
    setColor​(javafx.scene.paint.Color color)
    Update the color of the category, sets it to int values.
    void
    setName​(String name)
    updates the name of the category
    To string for object

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Category

      public Category(int ID, javafx.scene.paint.Color color, String name)
      Parameters:
      ID - Integer that represents the category`s ID
      color - Color object that represents the color of the category
      name - String that represents the name of the category
  • Method Details

    • getID

      public int getID()
      Gets the category id
      Returns:
      returns the ID of the category
    • getColor

      public javafx.scene.paint.Color getColor()
      Gets the category color
      Returns:
      returns the color of the category
    • getName

      public String getName()
      Gets the name
      Returns:
      returns the name of the category.
    • setColor

      public void setColor(javafx.scene.paint.Color color)
      Update the color of the category, sets it to int values. This gives us the ability to serialize the object
      Parameters:
      color - Color
    • setName

      public void setName(String name)
      updates the name of the category
      Parameters:
      name - Name as a string
    • equals

      public boolean equals(Object o)
      The method checks similarity: two Category objects are equal if their name and color are identical Identical similarity - two references to the same object Content similarity - the content of two objects is compared by category name and color
      Overrides:
      equals in class Object
      Parameters:
      o - Object that is comparing to
      Returns:
      returns true if similarity, false if inequality.
    • toString

      public String toString()
      To string for object
      Overrides:
      toString in class Object
      Returns:
      All relevant information for the object