|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.pealfactory.compose.halfleadspliced.Composition
class Composition
Tightly bound to the Composer class, a Composition instance holds the leads of a spliced composition as it is generated. It is also home to analysis methods such as checkRots() and isTrue().
Note that this class has been heavily tuned for performance, and should not be modified without extensive benchmarking on a range of searches.
| Field Summary | |
|---|---|
private int |
f1stPartFalseLead
|
private boolean |
fAllRotsGood
Set if neither fTenorsHomePE nor fNicePartEnds are set |
private int |
fBalance
Method balance 0-100% |
private int |
fBestRot
|
private int[] |
fCOMs
|
private int |
fFirstRot
|
private Lead[] |
fLeads
|
private int[] |
fLength
|
private Method[] |
fMethods
|
private int |
fMusic
Cache last calculated values |
private boolean |
fNicePartEnds
|
private int |
fNLeadsPerPart
|
private int |
fNParts
|
private RowNode |
fPartEnd
|
private RowNode |
fRounds
|
private int[] |
fRowNumBuf
|
private Tables |
fTables
|
private boolean |
fTenorsHomePE
Set if tenors must also be home at part end |
private boolean[] |
fTruthTable
|
private int |
fUnbalance
Count for balance pruning |
private boolean[] |
fZeroTable
|
| Constructor Summary | |
|---|---|
Composition(Method[] methods,
Tables tables,
int nleads,
boolean tenorsHomePE,
boolean nicePE)
|
|
| Method Summary | |
|---|---|
private int |
calcMusic(int rot)
Calculates the total music score of the entire composition starting from the given lead rotation. |
int |
calcMusicRots(int minMusic)
Checks all acceptable rotations of the composition for music score. |
boolean |
checkRots()
Returns true if there is at least one rotation of the composition with an acceptable part end; in this case, fFirstRot is also set to the rotation number of the first acceptable rotation. |
int |
get1stPartFalseLead()
If the composition was false in the first part, returns the lead it went false at, otherwise -1. |
int |
getBalance()
Relies on setBalance() being called by the Composer |
int |
getBestRot()
|
int |
getCOM()
Changes of method per part |
int |
getCOM(int lead)
Get changes of method in composition up to and including this lead (does not include end-start wraparound). |
Lead |
getLead(int n)
Final for speed (inlining) |
int |
getMusic()
Returns music score of best rotation. |
int |
getNLeadsPerPart()
Final for speed (inlining) |
int |
getNParts()
Calculates number of parts from part end. |
OutputComp |
getOutputComp(int score,
boolean lhOnly)
Produces a newly-constructed OutputComp instance populated with the leadheads from the best rotation of the current composition. |
int |
getPartLength(int lead)
Get length of part up to and including this lead |
int |
getUnbalanceCount()
|
private boolean |
isGoodRotPartEnd(int rot)
Returns true if the composition rotation starting from lead rot has an acceptable part end; rot MUST BE GREATER THAN 0! This method also assumes that one of fTenorsHomePE or fNicePartEnds is set, i.e. |
boolean |
isTrue()
Checks the composition is true. |
void |
setBalance(int balance,
int unbalanceCount)
Called by Composer whenever a comp is checked to ensure getBalance() etc is up-to-date |
RowNode |
setLead(int n,
RowNode start,
Method composite,
int call)
Final for speed (inlining) |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private int fNParts
private int fNLeadsPerPart
private Method[] fMethods
private boolean fTenorsHomePE
private boolean fNicePartEnds
private boolean fAllRotsGood
private int[] fCOMs
private Lead[] fLeads
private RowNode fPartEnd
private int fFirstRot
private Tables fTables
private boolean[] fTruthTable
private boolean[] fZeroTable
private int[] fRowNumBuf
private int[] fLength
private RowNode fRounds
private int fBestRot
private int f1stPartFalseLead
private int fMusic
private int fBalance
private int fUnbalance
| Constructor Detail |
|---|
public Composition(Method[] methods,
Tables tables,
int nleads,
boolean tenorsHomePE,
boolean nicePE)
| Method Detail |
|---|
public OutputComp getOutputComp(int score,
boolean lhOnly)
public final int getNLeadsPerPart()
public final Lead getLead(int n)
public final RowNode setLead(int n,
RowNode start,
Method composite,
int call)
public final int getCOM(int lead)
public final int getPartLength(int lead)
public int getCOM()
public final int getNParts()
public int getBestRot()
public final int get1stPartFalseLead()
public final boolean checkRots()
private final boolean isGoodRotPartEnd(int rot)
public int calcMusicRots(int minMusic)
private final int calcMusic(int rot)
Final for speed
public final int getMusic()
public void setBalance(int balance,
int unbalanceCount)
public int getBalance()
public int getUnbalanceCount()
public boolean isTrue()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||