dguitar.codecs.guitarPro
Class GPDuration

java.lang.Object
  extended bydguitar.codecs.guitarPro.GPDuration
All Implemented Interfaces:
java.lang.Comparable

public class GPDuration
extends java.lang.Object
implements java.lang.Comparable

This class describes a duration read from a Guitar Pro file. Please note there is still an undocumented value used by this class.

Author:
Matthieu Wipliez
See Also:
valueOf(int)

Field Summary
private static GPDuration[] _durations
          The durations.
private static java.lang.String[] _durationsNames
          The durations' names.
private  int _type
          A duration is represented by an integer.
static GPDuration EIGHTH
          An eighth note.
static GPDuration HALF
          A half note.
static GPDuration HUNDRED_TWENTY_EIGHTH
          A hundred twenty-eighth note.
static GPDuration QUARTER
          A quarter note.
static GPDuration SIXTEENTH
          A sixteenth note.
static GPDuration SIXTY_FOURTH
          A sixty-fourth note.
static GPDuration THIRTY_SECOND
          A thirty-second note.
static GPDuration UNKNOWN_DURATION
          An undocumented duration.
static GPDuration WHOLE
          A whole note.
 
Constructor Summary
private GPDuration(int type)
          Creates a new Duration whose type is type.
 
Method Summary
 int compareTo(java.lang.Object obj)
          Compares this duration to another object.
 boolean equals(java.lang.Object obj)
          Returns true if the given object is equal to this.
 int getIndex()
          Returns this duration's index.
 int getType()
          Returns this duration's type.
 java.lang.String toString()
          Returns a string representation of this Duration.
static GPDuration valueOf(int type)
          Returns the GPDuration associated with the value type.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_type

private int _type
A duration is represented by an integer.


WHOLE

public static final GPDuration WHOLE
A whole note.


HALF

public static final GPDuration HALF
A half note.


QUARTER

public static final GPDuration QUARTER
A quarter note.


EIGHTH

public static final GPDuration EIGHTH
An eighth note.


SIXTEENTH

public static final GPDuration SIXTEENTH
A sixteenth note.


THIRTY_SECOND

public static final GPDuration THIRTY_SECOND
A thirty-second note.


SIXTY_FOURTH

public static final GPDuration SIXTY_FOURTH
A sixty-fourth note.


HUNDRED_TWENTY_EIGHTH

public static final GPDuration HUNDRED_TWENTY_EIGHTH
A hundred twenty-eighth note.


UNKNOWN_DURATION

public static final GPDuration UNKNOWN_DURATION
An undocumented duration.


_durations

private static GPDuration[] _durations
The durations.


_durationsNames

private static java.lang.String[] _durationsNames
The durations' names.

Constructor Detail

GPDuration

private GPDuration(int type)
Creates a new Duration whose type is type.

Parameters:
type - the duration value.
Method Detail

compareTo

public int compareTo(java.lang.Object obj)
Compares this duration to another object.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
obj - the object to compare this duration to.
Returns:
the result of the comparison.
See Also:
Comparable.compareTo(Object)

equals

public boolean equals(java.lang.Object obj)
Returns true if the given object is equal to this.

See Also:
Object.equals(java.lang.Object)

getIndex

public int getIndex()
Returns this duration's index.

Returns:
an index number, 0 for Whole note, 1 for half note... and so on

getType

public int getType()
Returns this duration's type.

Returns:
the number that was read from the stream that represents the duration.

toString

public java.lang.String toString()
Returns a string representation of this Duration.


valueOf

public static GPDuration valueOf(int type)
Returns the GPDuration associated with the value type.

Parameters:
type - the duration integer value.
Returns:
the duration object associated.