Package eu.bandm.tscore.base
Class EntityCatalog<E extends Entity>
java.lang.Object
eu.bandm.tscore.base.EntityCatalog<E>
- All Implemented Interfaces:
Translet.Parseable<E>
Contains collection of basic score entities used as parameter values,
indexed and documented in a multi lingual way.
Each
Entity
must be contained in one such EntityCatalog.
The name and documentation of the catalog itself is also multi lingual.
This class also defines a pseudo language for symbolic, non-national representations.
-
Field Summary
Modifier and TypeFieldDescriptionThe default language to present its entities and the catalogue itself, if any.The multi-lingual catalog of entities contained.static final MuLi
Constant for constructing an entity without any name.protected MuLi
The name of this catalog, which in most cases is different in different human languages, like .static final String
Language code of a pseudo language, used to index symbolic, non-national representations.static final String
Language code for the unicode symbols as a translation target (=pseudo language). -
Constructor Summary
ConstructorDescriptionEntityCatalog
(Class<E> itemClass, String defaultLang, MuLi ownNames) Constructor configuring all fields ocmpletely.EntityCatalog
(Class<E> itemClass, String defaultLang, String defaultLangOwnName) Constructor with slightly restricted values. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addEntityName
(E entity, String lang, String name) Put one additional name for an entity, beyond those defined at creation.void
addEntityNames
(E entity, MuLi humanNames) Put additional names for an entity, beyond those defined at creation.static boolean
doesNotOverrideSymbolic
(MuLi muli) Checks whether the symbolic language is used in the MuLi argument.void
dump
(PrintStream ps) Debugging method to print its contents.Returns all entities contained.Returns theEntity
with the given name in the catalog's default language, or "null" if no such present.Returns theEntity
with the given name in the in given language, or "null" if no such present.getName()
Returns the name of the catalog, in the default language or "null" if no such is present.Returns the name of the catalog, in the given language, or "null" if no such is present.Returns all names of the givenEntity
.Get a parser which accepts the names of the entities in the default language.Get a parser which accepts the names of the entities in the given language and returns the possibly found Entity as its value.getSymbolic
(String name) Returns theEntity
with the given name in the symboolic language, or "null" if no such present.<F extends E>
voidlend
(F ent) Duplicate the reference to an entity in a different catalog by this catalog.void
lendFrom
(EntityCatalog<? extends E> origCat, String lang, String name) Duplicate the reference to an entity in a different catalog by this catalog.ownName()
void
Changes default language dynamically.
-
Field Details
-
symbolic
Language code of a pseudo language, used to index symbolic, non-national representations. E.g. articulation indications like "." or "^" for "staccato" are indexed by this language code, while the wording "staccato" would be indexed by "it", meaning "Italian".- See Also:
-
unicode
Language code for the unicode symbols as a translation target (=pseudo language). Used to represent the one-symbol unicode representation, if present.- See Also:
-
noNames
Constant for constructing an entity without any name. -
ownNames
The name of this catalog, which in most cases is different in different human languages, like . -
entityNames
The multi-lingual catalog of entities contained. -
defaultLang
The default language to present its entities and the catalogue itself, if any.
-
-
Constructor Details
-
EntityCatalog
Constructor configuring all fields ocmpletely.- Parameters:
itemClass
- the class of all entities contained in the new catalog.defaultLang
- the language code used as default for all entities contained herein, and for name and doc of the catalog itself.ownNames
- the names of the catalog, possibly in more than one language.
-
EntityCatalog
Constructor with slightly restricted values.- Parameters:
itemClass
- the class of all entities contained in the new catalog.defaultLang
- the language code used as default for all entities contained herein, and for name and doc of the catalog itself.defaultLangOwnName
- only one name for the catalog itself, in its default language.
-
-
Method Details
-
doesNotOverrideSymbolic
Checks whether the symbolic language is used in the MuLi argument. Called in all cases where the symbolic representation is calculated and may not be set by the user explicitly. -
ownName
-
dump
Debugging method to print its contents. @see Catalog#dump(PrintStream) -
getDefaultLanguage
- Returns:
- default language, see constructor doc.
-
setDefaultLanguage
Changes default language dynamically. Currently there is NO CHECK whether the new value is sensible. FIXME? -
getName
Returns the name of the catalog, in the default language or "null" if no such is present. -
getName
Returns the name of the catalog, in the given language, or "null" if no such is present. -
getEntity
Returns theEntity
with the given name in the in given language, or "null" if no such present. -
getEntity
Returns theEntity
with the given name in the catalog's default language, or "null" if no such present. -
getSymbolic
Returns theEntity
with the given name in the symboolic language, or "null" if no such present. -
getEntities
Returns all entities contained. -
getNames
Returns all names of the givenEntity
. -
addEntityNames
Put additional names for an entity, beyond those defined at creation. -
addEntityName
Put one additional name for an entity, beyond those defined at creation. -
getParser
Get a parser which accepts the names of the entities in the given language and returns the possibly found Entity as its value. Recurs toTranslet._CAT
, see there for the behaviour in case of failure.- Specified by:
getParser
in interfaceTranslet.Parseable<E extends Entity>
-
getParser
Get a parser which accepts the names of the entities in the default language.- Specified by:
getParser
in interfaceTranslet.Parseable<E extends Entity>
-
lendFrom
Duplicate the reference to an entity in a different catalog by this catalog. ATTENION: Only the currently defined names are copied. Later added names (in other languages) will not show up in this catalog. This catalog is a secondary catalog to retrieve this entity; its primary catalog (set on its construction) is not altered. This method is useful for selections and local enhancements of collections. -
lend
Duplicate the reference to an entity in a different catalog by this catalog. ATTENION: Only the currently defined names are copied. Later added names (in other languages) will not show up in this catalog. This catalog is a secondary catalog to retrieve this entity; its primary catalog (set on its construction) is not altered. This method is useful for selections and local enhancements of collections.
-