|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.jagrlib.DefaultProperty
cz.cuni.jagrlib.Piece
cz.cuni.jagrlib.piece.StraightRoulette
public class StraightRoulette
Simple roulette-wheel: set of intervals with equal size (i.e. equal probability).
Field Summary | |
---|---|
protected static java.lang.String |
CATEGORY
Object category. |
protected int |
intervals
Number of intervals. |
static RegPiece |
reg
Static registration instance for this class. |
protected static java.lang.String |
TEMPLATE_NAME
Object template identifier. |
Fields inherited from class cz.cuni.jagrlib.Piece |
---|
channels, info, pl, plugs, TEMPLATE_TYPE, userBreak |
Fields inherited from interface cz.cuni.jagrlib.iface.Property |
---|
LOGGING, STATISTICS, TEXT_DESCRIPTION |
Constructor Summary | |
---|---|
StraightRoulette()
|
Method Summary | |
---|---|
int |
convert(long _sum)
Converts a frequency sum to the corresponding symbol. |
long |
get(int _symbol)
Returns the frequency of the given symbol. |
int |
getSymbols()
Returns total number of symbols (intervals). |
long |
left(int _symbol)
Returns the start of the symbol's cummulative frequency interval (the frequency sum of all preceding symbols). |
void |
set(int _symbol,
long _freq)
Sets a single symbol's frequency. |
void |
set(long[] _freq)
Sets frequencies of all symbols at once. |
void |
setSymbols(int _symbols)
Changes total number of symbols (intervals). |
static int |
setTemplate(Template t,
int ord)
General-purpose registration routine. |
long |
total()
Returns the frequency sum of all symbols. |
Methods inherited from class cz.cuni.jagrlib.Piece |
---|
className, connect, findPlug, findPlug, getInfo, getInterface, getInterface, getPlug, getReg, init, isCompatible, isCompatible, isConnected, logError, logWarning, myInterface, newInputPlug, newOptOutputPlug, newOutputPlug, newPlug, noTemplates, propBegin, propBounds, propDefault, propEnd, propEnum, propManipulator, propManipulator, setProgressListener, setRegStrings, setTemplateDynamic, stop |
Methods inherited from class cz.cuni.jagrlib.DefaultProperty |
---|
booleanProperty, booleanProperty, colorDoubleProperty, colorProperty, commit, doubleProperty, doubleProperty, doubleProperty, enumProperty, floatProperty, floatProperty, floatProperty, get, intProperty, intProperty, intProperty, longProperty, longProperty, longProperty, set, set, stringProperty |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface cz.cuni.jagrlib.iface.Property |
---|
commit, get, set |
Field Detail |
---|
protected int intervals
protected static final java.lang.String TEMPLATE_NAME
protected static final java.lang.String CATEGORY
public static final RegPiece reg
Constructor Detail |
---|
public StraightRoulette()
Method Detail |
---|
public void setSymbols(int _symbols)
setSymbols
in interface WheelOfFortune
_symbols
- New number of symbols.getSymbols()
public int getSymbols()
getSymbols
in interface WheelOfFortune
public void set(long[] _freq)
null
parameter).
set
in interface WheelOfFortune
_freq
- Array of new frequencies.
Can be null
for context re-initialization.set(int,long)
,
EntropyHistogram.decimate()
public void set(int _symbol, long _freq)
set
in interface WheelOfFortune
_symbol
- Symbol code._freq
- New frequency of the symbol.set(long[])
,
EntropyHistogram.decimate()
public long total()
left( getSymbols() )
, but might be more effective.
total
in interface WheelOfFortune
left(int)
,
get(int)
,
convert(long)
public long left(int _symbol)
left
in interface WheelOfFortune
_symbol
- Symbol code.
total()
,
get(int)
,
convert(long)
public long get(int _symbol)
left( _symbol + 1 ) - left( _symbol )
.
get
in interface WheelOfFortune
_symbol
- Symbol code.
total()
,
left(int)
,
convert(long)
public int convert(long _sum)
convert
in interface WheelOfFortune
_sum
- Frequency sum of the unknown symbol.
_sum
in it's cummulative frequency interval.total()
,
left(int)
,
get(int)
public static int setTemplate(Template t, int ord)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |