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
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, namely by EntityCatalog.getDefaultLanguage()
.-
Field Summary
Modifier 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
ConstructorDescriptionEntity
(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 TypeMethodDescriptionvoid
Add 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.getName()
Look up the name in the default language, as specified byEntityCatalog.getDefaultLanguage()
Look up the name in the given language.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.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 one EntityCatalog (in the different languages or 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. -
getParser
Gets the default parser for this entity, which accepts the name in the given language.- 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. -
getName
Look up the name in the given language. -
getName
Look up the name in the default language, as specified byEntityCatalog.getDefaultLanguage()
-
getDocumentations
ReturnsMuLi
containing documentation text in different languages. -
getNames
ReturnsMuLi
containing the names in the different languages. -
setDocumentation
Add a documentation text in the given langauge. -
getDocumentation
-
getDocumentation
-
dump
Debugging method to display this entity. Called byEntityCatalog.dump(PrintStream)
-
dump
public void dump()Convenience method, dumping toSystem.err
.
-