Package moise.os

Class CardinalitySet<T extends Identifiable>

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Iterable<T>

    public class CardinalitySet<T extends Identifiable>
    extends java.lang.Object
    implements java.io.Serializable, java.lang.Iterable<T>
    Represents a collection with cardinality (e.g. RoleA needs (1,50) players).
    Author:
    Jomi Fred Hubner
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      CardinalitySet()  
    • Method Summary

      Modifier and Type Method Description
      void add​(T o)
      adds an object with default cardinality
      void add​(T o, Cardinality c)
      adds an object with a specific cardinality
      boolean contains​(java.lang.String id)  
      boolean contains​(T o)  
      T get​(java.lang.String id)  
      java.util.Collection<T> getAll()  
      Cardinality getCardinality​(T o)
      returns the cardinality for one object collect here, if not specified, returns the default cardinality
      boolean isEmpty()  
      java.util.Iterator<T> iterator()  
      void remove​(T o)  
      void setCardinality​(T o, Cardinality c)
      sets the cardinality on an object already in the collection*
      int size()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Constructor Detail

      • CardinalitySet

        public CardinalitySet()
    • Method Detail

      • add

        public void add​(T o)
        adds an object with default cardinality
      • add

        public void add​(T o,
                        Cardinality c)
        adds an object with a specific cardinality
      • contains

        public boolean contains​(T o)
      • contains

        public boolean contains​(java.lang.String id)
      • get

        public T get​(java.lang.String id)
      • getAll

        public java.util.Collection<T> getAll()
      • remove

        public void remove​(T o)
      • setCardinality

        public void setCardinality​(T o,
                                   Cardinality c)
        sets the cardinality on an object already in the collection*
      • getCardinality

        public Cardinality getCardinality​(T o)
        returns the cardinality for one object collect here, if not specified, returns the default cardinality
      • isEmpty

        public boolean isEmpty()
      • size

        public int size()
      • iterator

        public java.util.Iterator<T> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<T extends Identifiable>