org.niffty
Class TimeSignature

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

public class TimeSignature
extends MusicSymbol

A TimeSignature has a top number and bottom number and optional tags: absolute or logical placement, large size, small size.


Field Summary
 
Fields inherited from class org.niffty.MusicSymbol
_tags
 
Constructor Summary
TimeSignature(int topNumber, int bottomNumber, Tags tags)
          Creates a new TimeSignature with the given parameters.
 
Method Summary
 void draw(java.awt.Graphics graphics)
          It is expected that the subclass will override this.
 int getBottomNumber()
          Returns the bottom number of the time signature.
 FinalPoint getScreenHotspot()
          Get the hotspot for this object in screen coordinates.
 int getTopNumber()
          Returns the top number of the time signature.
 void invalidate()
          This is automatically called after the object is modified to to force this to recompute all its values when the "get" method is called for the value.
 boolean isLeftPositionedSymbol()
          Return true if this is a symbol, like a cleff change, which appears to the left of the main symbol in the time slice, like the stem.
 java.lang.String toString()
           
 
Methods inherited from class org.niffty.MusicSymbol
findDefaultAnchor, findLeftPositionedX, findMultiNodes, getIndex, getParentTimeSlice, getTags, 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
 

Constructor Detail

TimeSignature

public TimeSignature(int topNumber,
                     int bottomNumber,
                     Tags tags)
Creates a new TimeSignature with the given parameters.

Parameters:
topNumber - see getTopNumber()
bottomNumber - see getBottomNumber()
tags - the tags for this music symbol. If this is null, then this uses an empty Tags object.
Method Detail

getTopNumber

public int getTopNumber()
Returns the top number of the time signature. For common time, top number = -1, bottom number = -1 For cut time, top number = -2, bottom number = -1


getBottomNumber

public int getBottomNumber()
Returns the bottom number of the time signature. For common time, top number = -1, bottom number = -1 For cut time, top number = -2, bottom number = -1


isLeftPositionedSymbol

public boolean isLeftPositionedSymbol()
Description copied from class: MusicSymbol
Return true if this is a symbol, like a cleff change, which appears to the left of the main symbol in the time slice, like the stem. The default return value is false but Cleff, TimeSignature, etc. should override and return true.

Overrides:
isLeftPositionedSymbol in class MusicSymbol

invalidate

public void invalidate()
This is automatically called after the object is modified to 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