final class DartScoping extends Object implements Scoping
Switch | Controlled state | Default |
---|---|---|
s | The scoping state. Its form is s=poll-name*votepath. The vote path is optional. Examples are "s=Sys/p/sandbox" and "s=Sys/p/sandbox*9kc2". | None, which means all positions in all polls. |
When the stage is ready to be initialized, this scoping model sets the actor and poll according to the 's' switch. It thereafter keeps itself and the stage in synchrony. At present it cannot synchonize to a change of actor on the stage, however, nor can it honour the configuration of a default actor; when these become necessary, please refer to the implementation plan in the code.
Scoping
,
Category:Position,
CountNode.dartSector()
Modifier and Type | Field and Description |
---|---|
(package private) static String |
DIGIT_ENCODER
A string of encoded digits for use in translation from radix 10 to 21.
|
Constructor and Description |
---|
DartScoping(Spool _spool)
Constructs a DartScoping.
|
Modifier and Type | Method and Description |
---|---|
HandlerRegistration |
addHandler(ScopeChangeHandler handler)
Registers a handler to receive change events fired from this scoping model.
|
(package private) static StringBuilder |
appendSwitch(StringBuilder b,
String pollName,
String votepath)
Appends a value for the 's' scoping switch to accord with the specified
parameters.
|
(package private) byte |
dartSector(int v)
Decodes the dart sector for the specified offset along the votepath.
|
(package private) String |
pollName()
The name of the poll in which the user takes a position, or null if no poll is
specified.
|
(package private) void |
syncActorToStage(CountNodeJS nodeOnVotepath,
String votepathFromNode)
Prompts this scoping model to set the stage actor if that is wanted.
|
String |
toString() |
(package private) String |
votepath()
The path of a vote expressed as a sequence of count nodes, each node being
identified by an encoded dart sector.
|
static final String DIGIT_ENCODER
char radix21Digit = DIGIT_ENCODER[radix10DartSector];
public DartScoping(Spool _spool)
_spool
- the spool for the release of associated holds. When unwound it
releases the holds of the instance and thereby disables it.IllegalStateException
- if the stage is configured with a default actor, which is not currently
supported.static StringBuilder appendSwitch(StringBuilder b, String pollName, String votepath)
pollName()
,
votepath()
byte dartSector(int v)
v
- the character offset along the votepath.votepath()
,
CountNode.dartSector()
final String pollName()
Poll.name()
void syncActorToStage(CountNodeJS nodeOnVotepath, String votepathFromNode)
nodeOnVotepath
- a node that is on the current votepath, or null if a
missing node is detected.votepathFromNode
- the votepath from the node to the terminal candidate,
which may be null if the node is null.String votepath()
"0123456789bcdfghjkmnp"
Dart sectors are therefore encoded as single digits in the range 1 to p. For example, the path of encoded digits "9kc2" decodes to sector numbers (9, 17, 11, 2).
dartSector(int)
,
CountNode.dartSector()
public HandlerRegistration addHandler(ScopeChangeHandler handler)
Scoping
addHandler
in interface Scoping
ScopeChangeEvent.addHandler(ScopeChangeHandler)