Class TopListElement

java.lang.Object
yearreview.app.data.processor.toplist.TopListElement

public class TopListElement extends Object
A TopListElement contains a TopListCompatibleItem and it's associated Values. The Values can be updated using the addValue(yearreview.app.util.value.Value)-function to make implementing the adapters easier.
Author:
ColdStone37
  • Field Details

    • count

      private static int count
      Counts the TopListElements already in existence.
    • id

      private final int id
      Identifier of the element. Unique over all TopListElements.
    • item

      private final TopListCompatibleItem item
      Item to display information from.
    • values

      private final Map<ValueType,Value> values
      Values of the element, used for sorting and displaying.
  • Constructor Details

    • TopListElement

      public TopListElement(TopListCompatibleItem item, Value value)
      Constructs a TopListElement from an item and a Value.
      Parameters:
      item - item to get information from
      value - Value to associate to the item
    • TopListElement

      public TopListElement(TopListCompatibleItem item, List<Value> values)
      Constructs a TopListElement from an item and a list of Values.
      Parameters:
      item - item to get information from
      values - Values to associate to the item
  • Method Details

    • addValue

      public void addValue(Value value)
      Adds a given Value to the internal Value of that type.
      Parameters:
      value - Value to add to internal Value
    • getValue

      public Value getValue(ValueType type)
      Gets the Value associated to the item with a certain type.
      Parameters:
      type - type of Value to get from the element
      Returns:
      associated Value or null if no Value of that type exists
    • getItem

      public TopListCompatibleItem getItem()
      Gets the item of the element.
      Returns:
      Item used to get information from