Interface Palette<T,R>
- Type Parameters:
T- The type this palette will maintainR- The type of registry used to build this palette
- All Known Subinterfaces:
Palette.Immutable<I,,IR> Palette.Mutable<M,MR>
public interface Palette<T,R>
Represents a mapping for types to a local identifier. Can be used for
mapping
Objects to int id's for storage purposes,
or for converting stored information to a representable format back into
Objects.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic interface -
Method Summary
Modifier and TypeMethodDescriptionasMutable(RegistryHolder registry) get(int id) Gets thetyperepresented by the given identifier from the mapping.get(int id, RegistryHolder holder) Gets the identifier for the giventype Tif it exists within the mapping.intGets the highest identifier in this palette.stream()Gets alltype Ts contained in this palette.type()Gets the type of this palette.
-
Method Details
-
type
PaletteType<T,R> type()Gets the type of this palette.- Returns:
- The palette type
-
highestId
int highestId()Gets the highest identifier in this palette.- Returns:
- The highest id
-
get
Gets thetyperepresented by the given identifier from the mapping.- Parameters:
id- The identifier- Returns:
- The type, if found
-
get
-
get
Gets the identifier for the giventype Tif it exists within the mapping.- Parameters:
type- The type- Returns:
- The identifier, if found
-
stream
Gets alltype Ts contained in this palette.- Returns:
- All contained types
-
streamWithIds
-
asMutable
-
asImmutable
Palette.Immutable<T,R> asImmutable()
-