Package eu.bandm.tscore.base
Class Entity<E extends Entity>
java.lang.Object
eu.bandm.tscore.base.Entity<E>
- All Implemented Interfaces:
Translet.Parseable<E>
- Direct Known Subclasses:
Accidental
,Artikulation
,Clef
,ClefUsage
,Color_rgb_8
,DoppelHaken
,FunctionalGender
,FunctionalInterval
,FunctionalKey
,Haken
,InterpolationKind
,MixedNoteheadAddendum
,OctaveRegister
,Ornament
,PitchModOctave
,RelWert
,ScalaNumAbstrPOcts
Base class for all things which are in a certain multi-lingual catalog, and
have a common parser for their symbolic appearance in scores,
and which form a common semantic domain.
Attention
The type parameter of each subclass must be that subclass itself! It is needed to parametrize instantiation, of the above-mentioned catalog, parsers, etc. Eg.:
Every constructor requires the
The basic architecture of tscore is multi lingual, based on the
Attention
The type parameter of each subclass must be that subclass itself! It is needed to parametrize instantiation, of the above-mentioned catalog, parsers, etc. Eg.:
public class Articulation extends Entity <Articulation>
Every constructor requires the
EntityCatalog
into which the
new Entity instance is stored. (So the relation from Entity to
EntityCatalog is "many-to-one").
The basic architecture of tscore is multi lingual, based on the
eu.bandm.tools.muli
package. Therefore the
different constructors may get more than one "name" argument, and there
are different retrieve methods for names.
Please note that a default for the language is defined one level
above, in the catalog, namely by EntityCatalog.getDefaultLanguage()
.
So are the MuLi objects for the entity instances.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected EntityCatalog
<E> The multi-lingual catalog in which this entitiy is contained.protected MuLi
The multi-lingual explanation texts for this entitiy. -
Constructor Summary
ConstructorsConstructorDescriptionEntity
(EntityCatalog<E> catalog) Creates a new entity with (possibly) multiple names in multiple languages.Entity
(EntityCatalog<E> catalog, MuLi humanNames) Creates a new entity with (possibly) multiple names in multiple languages.Entity
(EntityCatalog<E> catalog, String lang, String name) Creates a new entity with only one name.Creates a new entity with (possibly) multiple names in multiple languages. -
Method Summary
Modifier and TypeMethodDescriptionAdd a further name.void
dump()
Convenience method, dumping toSystem.err
.void
dump
(PrintStream ps) Debugging method to display this entity.The multi-lingual catalog in which this entitiy is contained.getDocumentation
(String language) ReturnsMuLi
containing documentation text in different languages.Look up the name in the given languages, or in default.getNames()
ReturnsMuLi
containing the names in the different languages.Gets the default parser for this entity, which accepts the name in the default language, as specified byEntityCatalog.getDefaultLanguage()
Gets the default parser for this entity, which accepts the name in the given language only.getSpecific
(String language) Return the name stored under a particular key.void
setDocumentation
(String language, String doc) Add a documentation text in the given langauge.toString()
Get any name, preferable in theEntityCatalog.SYMBOLIC
language, as defined inMuLi.get(String...)
.Get the name according to the given language priority, as defined inMuLi.get(String...)
.
-
Field Details
-
catalog
The multi-lingual catalog in which this entitiy is contained. -
documentations
The multi-lingual explanation texts for this entitiy.
-
-
Constructor Details
-
Entity
Creates a new entity with (possibly) multiple names in multiple languages. This constructor is special as it does not define any name, but the the names must be added afterwards by callingEntityCatalog.addEntityNames(Entity,MuLi)
, or sim.ATTENTION The uniqeness of the names of the different entities in the same EntityCatalog (in different languages or in the same language) is not checked.
- Parameters:
catalog
- where to enter the new instance
-
Entity
Creates a new entity with (possibly) multiple names in multiple languages. Further names can be added afterwards by callingEntityCatalog.addEntityNames(Entity,MuLi)
, or sim.ATTENTION The uniqeness of the names of the different entities in one EntityCatalog (in the different languages or even in the same language) is curently not checked.
- Parameters:
catalog
- where to enter the new instancenames
- mapping from language to name
-
Entity
Creates a new entity with only one name. Further names can be added afterwards by callingEntityCatalog.addEntityNames(Entity,MuLi)
, or sim.ATTENTION The uniqeness of the names of the different entities in one EntityCatalog (in the different languages or the same language) is not checked.
- Parameters:
catalog
- where to enter the new instancelang
- language of the namename
- name of the entity
-
Entity
Creates a new entity with (possibly) multiple names in multiple languages. Further names can be added afterwards by callingEntityCatalog.addEntityNames(Entity,MuLi)
, or sim.ATTENTION The uniqeness of the names of the different entities in one EntityCatalog (in the different languages or the same language) is not checked.
- Parameters:
catalog
- where to enter the new instancehumanNames
- mapping from language to name
-
-
Method Details
-
getCatalog
The multi-lingual catalog in which this entitiy is contained. -
addName
Add a further name.- Returns:
- this instance, to support chained invocations.
-
getParser
Gets the default parser for this entity, which accepts the name in the given language only.- Specified by:
getParser
in interfaceTranslet.Parseable<E extends Entity>
-
getParser
Gets the default parser for this entity, which accepts the name in the default language, as specified byEntityCatalog.getDefaultLanguage()
- Specified by:
getParser
in interfaceTranslet.Parseable<E extends Entity>
-
toString
Get the name according to the given language priority, as defined inMuLi.get(String...)
. If this fails, get built-inObject.toString()
conversion result. -
toString
Get any name, preferable in theEntityCatalog.SYMBOLIC
language, as defined inMuLi.get(String...)
. If this fails, get built-inObject.toString()
conversion result. -
getSpecific
Return the name stored under a particular key. In contrast to other methods, no fall-back mechanisms take place. -
getName
Look up the name in the given languages, or in default. If the list is empty, try theinvalid @link
{@link EntityCatalog#getDefaultLanguage(),
EntityCatalog.SYMBOLIC
. -
getNames
ReturnsMuLi
containing the names in the different languages. -
getDocumentations
ReturnsMuLi
containing documentation text in different languages. -
setDocumentation
Add a documentation text in the given langauge. -
getDocumentation
-
getDocumentation
- Returns:
- the documentation text in the default language,
as specified by
EntityCatalog.getDefaultLanguage()
-
dump
Debugging method to display this entity. Called byEntityCatalog.dump(PrintStream)
-
dump
public void dump()Convenience method, dumping toSystem.err
.
-