Re: [Lily4jedit-devel] Re: Getting Note Position from Note Token
Brought to you by:
fodber
From: Bertalan F. <fo...@fr...> - 2004-11-30 10:37:36
|
> public Note toNote() { > Note note = new Note(getPitchPos()); > note.setDuration(getDurFraction()); // Is there a better way to store >duration in the note class, eg. using singer integer and can be >converted to string or fraction easily? > > What would you do with a note duration of 13/64? What integer would you use? There should not be a toNote() in the NoteToken class, because all code constructing Note objects is to be encapsulated in the Note class. If I need a Note object, I look at the constructors of it... I know that toNote() would not make harm, but that would be a nasty duplication in the logic. For other attributes, like dynamics, etc. I don't know if the current class structure is enough. Actually a Note should only have pitch and duration. There is some musical structure that can contain markups, etc. assigned to that Notes. It is very likely that for this purpose an Articulation class exists, that is associated unidirectly by the Note class. The NoteToken class may contain not just the Note's textual representation, but the Articulation's as well. Or an Articulation Token should exist. I must distinguish again with Tokens, because Tokens always contains attributes that are only related to there concrete position, structure in the text. Bert |