Class Categorization
- java.lang.Object
-
- org.opentrafficsim.road.gtu.strategical.od.Categorization
-
- All Implemented Interfaces:
java.io.Serializable
,Identifiable
public class Categorization extends java.lang.Object implements java.io.Serializable, Identifiable
A categorization determines for what part of traffic certain demand data is applicable. By default, this is always for a given origin-destination pair and time period. A categorization adds to this additional segregation. For example, per lane, per vehicle class, etc.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
-
-
Field Summary
Fields Modifier and Type Field Description static Categorization
UNCATEGORIZED
Empty categorization.
-
Constructor Summary
Constructors Constructor Description Categorization(java.lang.String id, java.lang.Class<?> class1, java.lang.Class<?>... classes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
entails(java.lang.Class<?> clazz)
Returns whether the categorization contains a class that is, or is a sub type of, the given class.boolean
equals(java.lang.Object obj)
java.lang.Class<?>
get(int i)
Returns the i'th class.java.lang.String
getId()
int
hashCode()
int
size()
Returns the number of category classes defined.java.lang.String
toString()
-
-
-
Field Detail
-
UNCATEGORIZED
public static final Categorization UNCATEGORIZED
Empty categorization.
-
-
Constructor Detail
-
Categorization
public Categorization(java.lang.String id, java.lang.Class<?> class1, java.lang.Class<?>... classes)
- Parameters:
id
- String; Idclass1
- Class<?>; 1st classclasses
- Class<?>...; other classes- Throws:
java.lang.IllegalArgumentException
- if any class is given multiple timesjava.lang.NullPointerException
- if any input is null
-
-
Method Detail
-
size
public final int size()
Returns the number of category classes defined.- Returns:
- number of category classes defined
-
get
public final java.lang.Class<?> get(int i)
Returns the i'th class.- Parameters:
i
- int; index of the class- Returns:
- the i'th class
- Throws:
java.lang.IndexOutOfBoundsException
- if index i is out of bounds
-
getId
public final java.lang.String getId()
- Specified by:
getId
in interfaceIdentifiable
- Returns:
- id.
-
entails
public final boolean entails(java.lang.Class<?> clazz)
Returns whether the categorization contains a class that is, or is a sub type of, the given class.- Parameters:
clazz
- Class<?>; class to check- Returns:
- whether the categorization contains a class that is, or is a sub type of, the given class
-
hashCode
public final int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public final boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public final java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-