org.niffty
Class Accidental

java.lang.Object
  |
  +--org.niffty.HeirarchyNode
        |
        +--org.niffty.MusicSymbol
              |
              +--org.niffty.Accidental
All Implemented Interfaces:
Anchored

public class Accidental
extends MusicSymbol

An Accidental has a shape and optional tags: small size, parenthesis


Nested Class Summary
static class Accidental.Shape
          An Accidental.Shape has constants for the legal shapes.
 
Field Summary
static DrawShape _flat
           
static DrawShape _natural
           
static DrawShape _sharp
           
 
Fields inherited from class org.niffty.MusicSymbol
_tags
 
Constructor Summary
Accidental(Accidental.Shape shape, Tags tags)
          Creates a new Accidental with the given parameters.
 
Method Summary
 void draw(java.awt.Graphics graphics)
          It is expected that the subclass will override this.
 FinalPoint getScreenHotspot()
          Get the hotspot for this object in screen coordinates.
 Accidental.Shape getShape()
          Returns the shape.
 void invalidate()
          This is automatically called after the object is modified to force this to recompute all its values when the "get" method is called for the value.
 java.lang.String toString()
           
 
Methods inherited from class org.niffty.MusicSymbol
findDefaultAnchor, findLeftPositionedX, findMultiNodes, getIndex, getParentTimeSlice, getTags, isLeftPositionedSymbol, nextInstanceOfInScore, previousInstanceOf, previousInstanceOfInScore, previousInstanceOfInStaff
 
Methods inherited from class org.niffty.HeirarchyNode
addChild, getChild, getChildCount, getParentNode, nextInHeirarchy, previousInHeirarchy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_flat

public static final DrawShape _flat

_natural

public static final DrawShape _natural

_sharp

public static final DrawShape _sharp
Constructor Detail

Accidental

public Accidental(Accidental.Shape shape,
                  Tags tags)
Creates a new Accidental with the given parameters.

Parameters:
shape - the Shape constant. This must not be null.
tags - the tags for this music symbol. If this is null, then this uses an empty Tags object.
Method Detail

getShape

public Accidental.Shape getShape()
Returns the shape.


invalidate

public void invalidate()
This is automatically called after the object is modified to force this to recompute all its values when the "get" method is called for the value.

Overrides:
invalidate in class MusicSymbol

getScreenHotspot

public FinalPoint getScreenHotspot()
Get the hotspot for this object in screen coordinates.

Specified by:
getScreenHotspot in interface Anchored
Overrides:
getScreenHotspot in class MusicSymbol
Returns:
The position of the hotspot in screen coordinates from top-left of screen (not relative to an anchor). This is a FinalPoint and not a Point so that the class can give access to its screen hotspot object knowing that the caller will not modify it. This is more efficient that returning a new Point every time getScreenHotspot() is called.
See Also:
FinalPoint.newPoint()

draw

public void draw(java.awt.Graphics graphics)
Description copied from class: MusicSymbol
It is expected that the subclass will override this.

Overrides:
draw in class MusicSymbol

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object