|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.pealfactory.ring.Row
org.pealfactory.ring.ImmutableRow
org.pealfactory.compose.halfleadspliced.RowNode
class RowNode
Represent a single Row together with precalculated table values to increase performance. Every RowNode has a table of pointers (fPermLinks) to those RowNodes which would be reached by every possible place notation permutation in the table of methods. This means expensive place notation operations are not longer necessary - a change can be generated simply by accessing the fPermLink array.
For those RowNodes representing potential leadheads (i.e. any with the treble home) the fPermLinks array also contain pointers to the nodes which would be reached by permutation with any of the leadheads in the table of methods. The leadhead of a composition can therefore be generated by a single table lookup.
Leadhead nodes also contain a table of precalculated music scores for every method (fLeadMusic). This allows music scoring to proceed with just one operation per lead.
For this class, performance is all!
| Field Summary | |
|---|---|
private boolean |
fLeadhead
true if treble at lead |
private int |
fLeadheadNumber
Only valid if treble home |
private int[] |
fLeadMusic
Only set if treble home: music for entire lead of each (composite) method |
private int |
fLeadsTillTenorsHome
Only valid if treble home and tenors together |
private int |
fMusic
Music score for this one row |
private boolean |
fNicePartEnd
|
private int |
fNodeNumber
|
private int |
fNParts
|
private RowNode[] |
fPermLinks
|
private int |
fRegenOffset
|
| Fields inherited from class org.pealfactory.ring.ImmutableRow |
|---|
kROUNDS_ROW |
| Fields inherited from class org.pealfactory.ring.Row |
|---|
fNBells, fRow |
| Fields inherited from interface org.pealfactory.ring.Constants |
|---|
kCALL_BOB, kCALL_EXTREME, kCALL_PLAIN, kCALL_SINGLE, kCALL_USER, kCHAR_CROSS, kCHAR_LH, kMAXNBELLS, kMINNBELLS, kROUNDS |
| Constructor Summary | |
|---|---|
RowNode(Row row,
Tables tables)
|
|
| Method Summary | |
|---|---|
protected void |
calcLeadMusic(Method method)
|
protected void |
calcLeadsToTenorsHome(Method method0)
Must ONLY be called on tenors-together nodes with the treble leading. |
protected void |
calcMusicScore(Music[] music)
|
private void |
calcNicePartEnd(Music[] parts)
|
private void |
calcPartStats()
|
(package private) boolean |
calcPermLinks(Tables tables,
byte[][] pnPerms,
byte[][] leadheadPerms)
Returns false if error. |
int |
getLeadheadNumber()
Final for speed. |
int |
getLeadMusic(int m)
Gets music for entire lead. |
int |
getMusic()
Final for speed (inlining) |
int |
getNodeNumber()
Final for speed (inlining) |
int |
getNParts()
Final for speed (inlining) |
int |
getRegenOffset()
Final for speed. |
boolean |
isLeadhead()
Returns true if treble at lead for this row. |
boolean |
isNicePartEnd()
Final for speed (inlining) |
RowNode |
permute(int permNum)
Final for speed (inlining) |
private int |
score(Music music)
Final for speed. |
void |
setLeadheadNumber(int leadheadNumber)
|
void |
setRegenOffset(boolean tenorsTogether)
Should only be called on tenors-together leadhead nodes. |
| Methods inherited from class org.pealfactory.ring.ImmutableRow |
|---|
applyPermutation, applyPermutation, applyPN, change, hashCode, isPBrow, isRounds, isTenorsHome, isTenorsTogether, permute, permute, setRow, setRow, swap |
| Methods inherited from class org.pealfactory.ring.Row |
|---|
bellAt, calcPermutation, clone, equals, findBell, getCoursingPairBitmap, getNBells, nextCourseBell, nextCourseBellNoTreble, setNBells, test, toBytes, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private int fNodeNumber
private int fMusic
private RowNode[] fPermLinks
private boolean fLeadhead
private int[] fLeadMusic
private int fLeadheadNumber
private int fNParts
private boolean fNicePartEnd
private int fLeadsTillTenorsHome
private int fRegenOffset
| Constructor Detail |
|---|
RowNode(Row row,
Tables tables)
| Method Detail |
|---|
public final RowNode permute(int permNum)
public final int getNodeNumber()
public final int getLeadheadNumber()
public void setLeadheadNumber(int leadheadNumber)
public final int getMusic()
public final boolean isLeadhead()
public final int getNParts()
public final boolean isNicePartEnd()
public final int getLeadMusic(int m)
protected final void calcLeadMusic(Method method)
public final int getRegenOffset()
public final void setRegenOffset(boolean tenorsTogether)
boolean calcPermLinks(Tables tables,
byte[][] pnPerms,
byte[][] leadheadPerms)
private void calcNicePartEnd(Music[] parts)
protected void calcLeadsToTenorsHome(Method method0)
protected void calcMusicScore(Music[] music)
private final int score(Music music)
private void calcPartStats()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||