public final class CountNodeJS extends JavaScriptObject implements CountNode
SacRegisterJS
,
Category:PositionModifier and Type | Field and Description |
---|---|
static JsArray<CountNodeJS> |
NULL_BOARD
An array of length 20 filled with
null values.
|
DART_SECTOR_MAX
Modifier | Constructor and Description |
---|---|
protected |
CountNodeJS() |
Modifier and Type | Method and Description |
---|---|
String |
candidateName()
Identifies the candidate selected by the
person, for whom a vote is to be cast if the person is a
voter.
|
CountJS |
count()
The parent count of this count node.
|
byte |
dartSector()
The dart sector occupied by this node, if any.
|
Long |
directVoterCount()
The number of other nodes that name this node as a candidate.
|
String |
displayTitle()
The display title of the person's position, or null if there is none.
|
static CountNodeJS |
findNode(String name,
JsArray<CountNodeJS> nodes)
Returns the node of the specified name from the array of nodes, or null if there
is no such node.
|
(package private) void |
init(String name,
JsMap<CountNodeJS> wiredNodes,
CountJS count)
Initializes this node from a server response.
|
(package private) void |
initVoters(JsArrayString voterNames,
JsMap<CountNodeJS> wiredNodes)
Initializes this node's voters from a server
response.
|
boolean |
isBaseCandidate()
Answers whether this node is a root candidate or a cycler.
|
boolean |
isCandidate()
Answers whether this node has a voter.
|
boolean |
isCycler()
Answers whether this node is voting for a voter of it's own, directly or
indirectly.
|
boolean |
isRootCandidate()
Answers whether this node is a candidate who is not a voter.
|
boolean |
isVoter()
|
String |
name()
The mailish username of the person for whom this node accounts.
|
<R extends SacRegisterJS> |
register(String countingMethodName,
String accountName)
Returns this node's superaccount register for the specified counting method and
account name; or null if no such register exists.
|
<R extends SacRegisterJS> |
registers()
Superaccount registers at this node, indexed first by the page name of the
counting method, then by the account name.
|
StringBuilder |
requestVoters_loc(StringBuilder b)
Appends the location for calls to
requestVoters and returns the
string builder. |
JsonpRequest<CountCache.WAPResponse> |
requestVoters(String loc,
AsyncCallback<CountNodeJS> callback)
Requests this node's voters from the count engine.
|
SacRegisterJS_v |
voteRegister()
The vote register at this node.
|
JsArray<CountNodeJS> |
voters()
A sparse array of the dart sectored voters, if
known.
|
_delete, _get, _getBoolean, _getByte, _getChar, _getDouble, _getFloat, _getInt, _getShort, _getString, _hasOwnProperty, _hasProperty, _propertyIsEnumerable, _set, _setBoolean, _setByte, _setChar, _setDouble, _setFloat, _setInt, _setShort, _setString, cast, createArray, createArray, createFunction, createObject, equals, hashCode, toSource, toString
public static final JsArray<CountNodeJS> NULL_BOARD
protected CountNodeJS()
void init(String name, JsMap<CountNodeJS> wiredNodes, CountJS count)
wiredNodes
- the "nodes" as received in the response.name()
void initVoters(JsArrayString voterNames, JsMap<CountNodeJS> wiredNodes)
voterNames
- the 'voters' as named in the response.wiredNodes
- the "nodes" as received in the response.public static CountNodeJS findNode(String name, JsArray<CountNodeJS> nodes)
nodes
- the array of nodes to search, which may contain null elements.public <R extends SacRegisterJS> R register(String countingMethodName, String accountName)
public <R extends SacRegisterJS> JsMap<CountingMethodJS<R>> registers()
CountWAP
public JsonpRequest<CountCache.WAPResponse> requestVoters(String loc, AsyncCallback<CountNodeJS> callback)
callback
- the callback to receive the response, the response being
this count node with its voters set.voters()
,
requestVoters_loc(StringBuilder)
public StringBuilder requestVoters_loc(StringBuilder b)
requestVoters
and returns the
string builder.public SacRegisterJS_v voteRegister()
public JsArray<CountNodeJS> voters()
requestVoters(String,AsyncCallback)
,
initVoters(JsArrayString,JsMap)
public String candidateName()
CountNode
candidateName
in interface CountNode
public byte dartSector()
CountNode
A cycler has two roles for purposes of sectoring: voter and end-candidate. If the cycler is not among the top 20 of end-candidates, then she (or he) will occupy no sector in either role. Otherwise she will occupy the same sector in both roles. It is therefore possible that she (now in the role of voter) will displace a co-voting peer from a pre-occupied sector. This is the one exception to the rule of non-displacement. To illustrate, consider the cycle pictured below. If the cycle is formed by (s) casting for (c), then it is possible for one of (p) to be forced to a different dart sector.
( ) ( ) \ ( ) / \ | / \ | / | ( ) \|/ | vote flow \ ( )---(s) (p) V \ / \ / \ / \ / ( ) (c)----(p) \ / \ / ( )---( ) <---
Dart sector assignments are persisted from count to count in the voter input table. Reassignments occur at count time due to collisions from vote shifts and these are persisted individually. Where a count based on an old snapshot of the voter input is remounted, the reassignments of that count might (supposedly) clobber those of historically more recent counts. The result would be a degree of sector displacement surfacing on the next count, based on a new snapshot of the voter input. This should be corrected when voter input storage is expanded to include historical vote shifts and other changes of vote data, as sector reassignments would then be recorded in historical sequence.
Acknowledgement: Dart sectoring was first proposed by Thomas von der Elbe. See Start/Metagov 2011-April/003824.
dartSector
in interface CountNode
public Long directVoterCount()
CountNode
directVoterCount
in interface CountNode
public String displayTitle()
CountNode
displayTitle
in interface CountNode
public boolean isBaseCandidate()
CountNode
isBaseCandidate
in interface CountNode
public boolean isCandidate()
CountNode
isCandidate
in interface CountNode
public boolean isCycler()
CountNode
isCycler
in interface CountNode
public boolean isRootCandidate()
CountNode
isRootCandidate
in interface CountNode
public boolean isVoter()
CountNode
isVoter
in interface CountNode