|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.bolson.vote.NameVotingSystem org.bolson.vote.NamedHistogram
public class NamedHistogram
The normal vote interface in this case accumulates the ratings into histograms per name.
Nested Class Summary | |
---|---|
protected class |
NamedHistogram.Choice
|
Nested classes/interfaces inherited from class org.bolson.vote.NameVotingSystem |
---|
NameVotingSystem.NameVote, NameVotingSystem.ReverseComparator |
Field Summary | |
---|---|
java.lang.String |
barImgUrl
|
float |
bucketscale
bucketscale used at display time on bucket labels |
boolean |
disableWinners
make getWinners return null |
boolean |
doscaleoffset
doscaleoffset used at display time on bucket labels |
protected static java.lang.String[] |
globalHistChoiceFormat
|
protected static java.lang.String[] |
globalHistRowFormat
|
static java.lang.String |
HIST_CHOICE_AVERAGE
|
static java.lang.String[] |
HIST_CHOICE_keys
|
static java.lang.String |
HIST_CHOICE_LABEL
|
static java.lang.String |
HIST_CHOICE_NAME
|
static java.lang.String |
HIST_CHOICE_ROWS
|
static java.lang.String |
HIST_CHOICE_SUM
|
static java.lang.String |
HIST_CHOICE_VOTES
|
static java.lang.String |
HIST_ROW_HVAL
|
static java.lang.String[] |
HIST_ROW_keys
|
static java.lang.String |
HIST_ROW_SCALED_HVAL
|
static java.lang.String |
HIST_ROW_VALUES_LABEL
|
boolean |
intmode
|
java.lang.String |
labelname
|
boolean |
lowfirst
|
float |
offset
offset used at display time on bucket labels |
boolean |
printPercents
|
boolean |
useSpan
|
Constructor Summary | |
---|---|
NamedHistogram()
equivalent to NamedHistogram( -10, 10 ); |
|
NamedHistogram(int numBuckets,
float minRating,
float maxRating)
Constructor creates a histogram with some number of buckets evenly distributed with the min rating and max rating at the limits. |
|
NamedHistogram(int minint,
int maxint)
Constructor creates a histogram with some number of buckets to contain the possible integer values including minint through maxint. |
Method Summary | |
---|---|
protected int[][] |
counts(java.lang.String[] names)
|
java.lang.StringBuffer |
formatChoice(java.lang.StringBuffer sb,
NamedHistogram.Choice c,
int minBucket,
int maxBucket,
double scale,
java.lang.String[] format)
|
protected void |
formatHistRow(java.lang.StringBuffer sb,
int i,
int hval,
double scale)
|
protected void |
formatHistRow(java.lang.StringBuffer sb,
int i,
int hval,
double scale,
java.lang.String[] histRowFormat)
|
protected NamedHistogram.Choice[] |
getChoices()
|
NameVotingSystem.NameVote[] |
getWinners()
|
protected void |
histRow(java.lang.StringBuffer sb,
int i,
int hval,
double scale)
|
java.lang.StringBuffer |
htmlSummary(java.lang.StringBuffer sb)
Makes HTML tables and CSS span bars to show the histogram. |
java.lang.StringBuffer |
htmlSummary(java.lang.StringBuffer sb,
NameVotingSystem.NameVote[] winners)
Makes HTML tables and CSS span bars to show the histogram. |
java.lang.StringBuffer |
htmlSummary(java.lang.StringBuffer sb,
java.lang.String[] names)
Makes HTML tables and CSS span bars to show the histogram. |
int |
init(java.lang.String[] argv)
Set options for voting system. |
static void |
main(java.lang.String[] argv)
|
java.lang.String |
name()
|
protected java.lang.String[] |
names()
|
protected static java.lang.String[] |
parseFormat(java.lang.String format,
java.lang.String[] keys)
|
java.lang.StringBuffer |
renderChoice(java.lang.StringBuffer sb,
NamedHistogram.Choice c,
int minBucket,
int maxBucket,
double scale)
|
static void |
setGlobalHistRowFormat(java.lang.String format)
Set default format for histogram rows. |
void |
voteRating(NameVotingSystem.NameVote[] vote)
The normal vote interface in this case accumulates the ratings into histograms per name. |
Methods inherited from class org.bolson.vote.NameVotingSystem |
---|
defaultMain, denibble, depercentHexify, fromUrlEncoded, getDebug, getImplNames, getIpmlForName, htmlExplain, htmlExplain, htmlSummary, nameEqStrToVoteArray, nameEqStrToVoteArray, percentHexify, readVotes, registerImpl, resultsHTMLDisplay, sort, urlEncode, voteNameEqStr, voteOrderSpec, voteRating, voteSpecToNameVoteArray, winnerSummaryHTMLTable |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public boolean intmode
public boolean lowfirst
public float bucketscale
public float offset
public boolean doscaleoffset
public boolean disableWinners
public java.lang.String labelname
public java.lang.String barImgUrl
public boolean useSpan
public boolean printPercents
public static final java.lang.String HIST_ROW_VALUES_LABEL
public static final java.lang.String HIST_ROW_SCALED_HVAL
public static final java.lang.String HIST_ROW_HVAL
public static final java.lang.String[] HIST_ROW_keys
protected static java.lang.String[] globalHistRowFormat
public static final java.lang.String HIST_CHOICE_NAME
public static final java.lang.String HIST_CHOICE_LABEL
public static final java.lang.String HIST_CHOICE_ROWS
public static final java.lang.String HIST_CHOICE_SUM
public static final java.lang.String HIST_CHOICE_VOTES
public static final java.lang.String HIST_CHOICE_AVERAGE
public static final java.lang.String[] HIST_CHOICE_keys
protected static java.lang.String[] globalHistChoiceFormat
Constructor Detail |
---|
public NamedHistogram()
public NamedHistogram(int numBuckets, float minRating, float maxRating)
0 1 2 3 4 |----|----|----|----|----| min max 5 buckets each with a width of (buckets/(max-min))Values less than min are accumulated in the min bucket and values greater than max are accumulated in the max bucket.
numBuckets
- number of buctets to accumulate histogram data inminRating
- value of the lowest edge of the lowest bucketmaxRating
- value of the highest edge of the highest bucketpublic NamedHistogram(int minint, int maxint)
0 1 2 3 4 |----|----|----|----|----| min max 5 buckets minint 0, maxint 4 min = -0.5, max = 4.5
minint
- value of lowest bucketmaxint
- value of highest bucketMethod Detail |
---|
public int init(java.lang.String[] argv)
NameVotingSystem
init
in class NameVotingSystem
argv
- array of options, just like main()
public void voteRating(NameVotingSystem.NameVote[] vote)
voteRating
in class NameVotingSystem
vote
- a set of (name,rating) pairsNameVotingSystem.voteRating(Map)
protected java.lang.String[] names()
protected NamedHistogram.Choice[] getChoices()
protected int[][] counts(java.lang.String[] names)
public NameVotingSystem.NameVote[] getWinners()
getWinners
in class NameVotingSystem
public static void setGlobalHistRowFormat(java.lang.String format)
row template:
%valueslabel n,>=n,
%scaledhval
default is:
<tr><td>%valuesLabel</td><td><div style="background-color: #bb99ff; width: %scaledhval">%hval</div></td></tr>\n
format
- string which will be parsed with above %keys to set histogram row formatprotected static java.lang.String[] parseFormat(java.lang.String format, java.lang.String[] keys)
protected void formatHistRow(java.lang.StringBuffer sb, int i, int hval, double scale)
protected void formatHistRow(java.lang.StringBuffer sb, int i, int hval, double scale, java.lang.String[] histRowFormat)
protected void histRow(java.lang.StringBuffer sb, int i, int hval, double scale)
public java.lang.StringBuffer formatChoice(java.lang.StringBuffer sb, NamedHistogram.Choice c, int minBucket, int maxBucket, double scale, java.lang.String[] format)
public java.lang.StringBuffer renderChoice(java.lang.StringBuffer sb, NamedHistogram.Choice c, int minBucket, int maxBucket, double scale)
public java.lang.StringBuffer htmlSummary(java.lang.StringBuffer sb)
htmlSummary
in class NameVotingSystem
sb
- gets HTML summary appended to it.
public java.lang.StringBuffer htmlSummary(java.lang.StringBuffer sb, NameVotingSystem.NameVote[] winners)
sb
- gets HTML summary appended to it.winners
- Histogram will present the choices in the order they are in this array of winners (typically sorted winningest first).
public java.lang.StringBuffer htmlSummary(java.lang.StringBuffer sb, java.lang.String[] names)
sb
- gets HTML summary appended to it.names
- which names to get histogram for, in that order.
public java.lang.String name()
name
in class NameVotingSystem
public static void main(java.lang.String[] argv)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |