Class LevelIdentifier
- java.lang.Object
-
- fr.univ_artois.lgi2a.similar.microkernel.LevelIdentifier
-
public final class LevelIdentifier extends Object
The object identifying one level involved in a simulation.Usage
To facilitate the access to level identifiers, it is recommended to create a class containing the identifier of each level as a static value. This avoids any misspelling when referring to a level.
Example
The following code shows how to create the level identifiers for a simulation of the road traffic, containing a "Traffic" level where vehicles move in the infrastructure of the road network, and a "GPS" level where the GPS tells vehicles how they can navigate.
public class LevelsOfRoadTrafficSimulation { public static final LevelIdentifier TRAFFICLEVEL = new LevelIdentifier( "Traffic level" ); public static final LevelIdentifier GPSLEVEL = new LevelIdentifier( "GPS level" ); }
- Author:
- Yoann Kubera
-
-
Constructor Summary
Constructors Constructor Description LevelIdentifier(String identifier)
Builds an instance of this class using a specific value for the level identifier.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
Check if this level identifier is equal to another level identifier.int
hashCode()
Gets the hash code of this object.String
toString()
Gets a printable version of the level identifier.
-
-
-
Constructor Detail
-
LevelIdentifier
public LevelIdentifier(String identifier)
Builds an instance of this class using a specific value for the level identifier.- Parameters:
identifier
- The identifier of the level. This value should be unique.- Throws:
IllegalArgumentException
- Ifidentifier
isnull
.
-
-