Package org.matsim.api.core.v01
Class Id<T>
- java.lang.Object
-
- org.matsim.api.core.v01.Id<T>
-
- All Implemented Interfaces:
Comparable<Id<T>>
public abstract class Id<T> extends Object implements Comparable<Id<T>>
Represents a unique identifier. Note that Ids should not contain any whitespace characters (spaces, tabs, newlines, ...), as this may lead to problems when Ids are written to file and read back in.- Author:
- mrieser / Senozon AG
-
-
Constructor Summary
Constructors Constructor Description Id()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
compareTo(Id<T> o)
static <T> Id<T>
create(long key, Class<T> type)
static <T> Id<T>
create(String key, Class<T> type)
This method supports a cache where ids are stored and re-used per type.static <T> Id<T>
create(Id<?> id, Class<T> type)
static Id<Link>
createLinkId(long key)
static Id<Link>
createLinkId(String str)
static Id<Link>
createLinkId(Id<?> id)
static Id<Node>
createNodeId(long key)
static Id<Node>
createNodeId(String str)
static Id<Node>
createNodeId(Id<?> id)
static Id<Person>
createPersonId(long key)
static Id<Person>
createPersonId(String str)
static Id<Person>
createPersonId(Id<?> id)
static Id<Vehicle>
createVehicleId(long key)
static Id<Vehicle>
createVehicleId(String str)
static Id<Vehicle>
createVehicleId(Id<?> id)
boolean
equals(Object obj)
static <T> Id<T>
get(int index, Class<T> type)
static <T> Id<T>
get(String id, Class<T> type)
static <T> int
getNumberOfIds(Class<T> type)
abstract int
index()
static <T> String
writeId(Id<T> id)
-
-
-
Constructor Detail
-
Id
public Id()
-
-
Method Detail
-
create
public static <T> Id<T> create(String key, Class<T> type)
This method supports a cache where ids are stored and re-used per type.
-
index
public abstract int index()
-
getNumberOfIds
public static <T> int getNumberOfIds(Class<T> type)
-
compareTo
public int compareTo(Id<T> o) throws IllegalArgumentException
- Specified by:
compareTo
in interfaceComparable<T>
- Returns:
0
when the two objects being compared are the same objects, other values according to their ids being compared to each other.- Throws:
IllegalArgumentException
- when the two objects being compared have the same id, but are not the same object because this means they must have different generic types
-
createPersonId
public static Id<Person> createPersonId(long key)
-
createPersonId
public static Id<Person> createPersonId(Id<?> id)
-
createPersonId
public static Id<Person> createPersonId(String str)
-
createLinkId
public static Id<Link> createLinkId(long key)
-
createLinkId
public static Id<Link> createLinkId(Id<?> id)
-
createLinkId
public static Id<Link> createLinkId(String str)
-
createNodeId
public static Id<Node> createNodeId(long key)
-
createNodeId
public static Id<Node> createNodeId(Id<?> id)
-
createNodeId
public static Id<Node> createNodeId(String str)
-
createVehicleId
public static Id<Vehicle> createVehicleId(long key)
-
createVehicleId
public static Id<Vehicle> createVehicleId(Id<?> id)
-
createVehicleId
public static Id<Vehicle> createVehicleId(String str)
-
-