Class Category

  • All Implemented Interfaces:
    java.io.Serializable

    public class Category
    extends java.lang.Object
    implements java.io.Serializable
    A category is a set of objects who's class belongs to a certain categorization. One Category object can specify to which subset of traffic between on origin and destination certain demand data belongs.

    Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
    BSD-style license. See OpenTrafficSim License.

    Version:
    $Revision$, $LastChangedDate$, by $Author$, initial version Sep 15, 2016
    Author:
    Alexander Verbraeck, Peter Knoppers, Wouter Schakel
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Category​(Categorization categorization, java.lang.Object object1, java.lang.Object... objects)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)
      java.lang.Object get​(int i)
      Returns the i'th object.
      <T> T get​(java.lang.Class<T> clazz)
      Returns the object of this category pertaining to the specified class from the category.
      Categorization getCategorization()  
      int hashCode()
      java.lang.String toString()
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • UNCATEGORIZED

        public static final Category UNCATEGORIZED
        Empty category.
    • Constructor Detail

      • Category

        public Category​(Categorization categorization,
                        java.lang.Object object1,
                        java.lang.Object... objects)
        Parameters:
        categorization - Categorization; categorization
        object1 - Object; 1st object
        objects - Object...; other objects
        Throws:
        java.lang.IllegalArgumentException - if the objects do not comply with the categorization
        java.lang.NullPointerException - if any input is null
    • Method Detail

      • get

        public final java.lang.Object get​(int i)
        Returns the i'th object.
        Parameters:
        i - int; index of the object
        Returns:
        the i'th object
        Throws:
        java.lang.IndexOutOfBoundsException - if index i is out of bounds
      • getCategorization

        public final Categorization getCategorization()
        Returns:
        categorization.
      • get

        public final <T> T get​(java.lang.Class<T> clazz)
        Returns the object of this category pertaining to the specified class from the category.
        Type Parameters:
        T - type of the object
        Parameters:
        clazz - Class<T>; class from categorization to get the category object for
        Returns:
        Object; object of this category pertaining to the specified class from the category
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public final boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object