new DelegationSet(value)
A DelegationSet holds a list of DelegationSet.Delegation entries which is
used as the content of a Link instance. If you add elements with add(), then
the list is a set sorted by preference number then by name. But wireDecode
will add the elements from the wire encoding, preserving the given order and
possible duplicates (in which case a DelegationSet really holds a "list" and
not necessarily a "set").
Create a new DelegationSet object, possibly copying values from another
object.
Parameters:
Name | Type | Description |
---|---|---|
value |
DelegationSet | (optional) If value is a DelegationSet, copy its values. |
- Source:
Classes
Methods
add(preference, name)
Add a new DelegationSet.Delegation to the list of delegations, sorted by
preference number then by name. If there is already a delegation with the
same name, update its preference, and remove any extra delegations with the
same name.
Parameters:
Name | Type | Description |
---|---|---|
preference |
number | The preference number. |
name |
Name | The delegation name. This makes a copy of the name. |
- Source:
addUnsorted(preference, name)
Add a new DelegationSet.Delegation to the end of the list of delegations,
without sorting or updating any existing entries. This is useful for adding
preferences from a wire encoding, preserving the supplied ordering and
possible duplicates.
Parameters:
Name | Type | Description |
---|---|---|
preference |
number | The preference number. |
name |
Name | The delegation name. This makes a copy of the name. |
- Source:
clear()
Clear the list of delegations.
- Source:
find(name) → {number}
Find the first delegation with the given name and return its index.
Parameters:
Name | Type | Description |
---|---|---|
name |
Name | Then name of the delegation to find. |
- Source:
Returns:
The index of the delegation, or -1 if not found.
- Type
- number
get(i) → {DelegationSet.Delegation}
Get the delegation at the given index, according to the ordering described
in add().
Parameters:
Name | Type | Description |
---|---|---|
i |
number | The index of the component, starting from 0. |
- Source:
Returns:
The delegation at the index.
getChangeCount() → {number}
Get the change count, which is incremented each time this object is changed.
- Source:
Returns:
The change count.
- Type
- number
remove(name) → {boolean}
Remove every DelegationSet.Delegation with the given name.
Parameters:
Name | Type | Description |
---|---|---|
name |
Name | The name to match the name of the delegation(s) to be removed. |
- Source:
Returns:
True if a DelegationSet.Delegation was removed, otherwise
false.
- Type
- boolean
size() → {number}
Get the number of delegation entries.
- Source:
Returns:
The number of delegation entries.
- Type
- number
wireDecode(input, wireFormat)
Decode the input using a particular wire format and update this DelegationSet.
Parameters:
Name | Type | Description |
---|---|---|
input |
Blob | Buffer | The buffer with the bytes to decode. |
wireFormat |
WireFormat | (optional) A WireFormat object used to decode this object. If omitted, use WireFormat.getDefaultWireFormat(). |
- Source:
wireEncode(wireFormat) → {Blob}
Encode this DelegationSet for a particular wire format.
Parameters:
Name | Type | Description |
---|---|---|
wireFormat |
WireFormat | (optional) A WireFormat object used to encode this object. If omitted, use WireFormat.getDefaultWireFormat(). |
- Source:
Returns:
The encoded buffer in a Blob object.
- Type
- Blob