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
FieldsModifier and TypeFieldDescriptionThe default language to present its entities and the catalogue itself.The multi-lingual catalog of entities contained.static final MuLiConstant for constructing an entity without any name.protected final MuLiThe name of this catalog, which in most cases is different in different human languages, like .static final StringLanguage code of a pseudo language, used to index symbolic, non-national representations.static final StringLanguage code for the unicode symbols as a translation target (=pseudo language). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEntityName(E entity, String lang, String name) Put one additional name for an entity, beyond those defined at creation.voidaddEntityNames(E entity, MuLi humanNames) Put additional names for an entity, beyond those defined at creation.static booleandoesNotOverrideSymbolic(MuLi muli) Checks whether the symbolic language is used in the MuLi argument.voiddump(PrintStream ps) Debugging method to print its contents.Returns the default language to present the contained entities and the catalogue itself, if any.Returns all entities contained.Returns theEntitywith the given name in the catalog's default language, or "null" if no such present.Returns theEntitywith 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 theEntitywith 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.voidlendFrom(EntityCatalog<? extends E> origCat, String lang, String name) Duplicate the reference to an entity in a different catalog by this catalog.ownName()The name of the catalog in its default language, or in some fall-back, see.invalid reference
MuLi#get(String)voidChanges 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:
-
NO_NAMES
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.
-
-
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
The name of the catalog in its default language, or in some fall-back, see.invalid reference
MuLi#get(String)- Returns:
- null if no default language is given, or no name therein.
-
dump
Debugging method to print its contents. @see Catalog#dump(PrintStream) -
getDefaultLanguage
Returns the default language to present the contained entities and the catalogue itself, if any. -
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 theEntitywith the given name in the in given language, or "null" if no such present. -
getEntity
Returns theEntitywith the given name in the catalog's default language, or "null" if no such present. -
getSymbolic
Returns theEntitywith 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:
getParserin interfaceTranslet.Parseable<E extends Entity>
-
getParser
Get a parser which accepts the names of the entities in the default language.- Specified by:
getParserin 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.
-