public abstract class IntRangeManager extends Object
startUpdate()
followed by zero or more
calls to addRange(int, int, boolean)
followed by a call to finishUpdate()
.
Calls to enableRange(int, int, java.lang.String)
and disableRange(int, int, java.lang.String)
will perform
an incremental update operation if the enabled ranges have changed.
A full update operation (i.e. after a radio reset) can be performed
by a call to updateRanges()
.
Clients are identified by String (the name associated with the User ID
of the caller) so that a call to remove a range can be mapped to the
client that enabled that range (or else rejected).Modifier | Constructor and Description |
---|---|
protected |
IntRangeManager() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
addRange(int startId,
int endId,
boolean selected)
Called after
startUpdate() to indicate a range of enabled
or disabled values. |
boolean |
disableRange(int startId,
int endId,
String client)
Disable a range for the specified client and update ranges
if necessary.
|
boolean |
enableRange(int startId,
int endId,
String client)
Enable a range for the specified client and update ranges
if necessary.
|
protected abstract boolean |
finishUpdate()
Called to indicate the end of a range update started by the
previous call to
startUpdate() . |
boolean |
isEmpty()
Returns whether the list of ranges is completely empty.
|
protected abstract void |
startUpdate()
Called when the list of enabled ranges has changed.
|
protected boolean |
tryAddRanges(int startId,
int endId,
boolean selected)
Enable or disable a single range of message identifiers.
|
boolean |
updateRanges()
Perform a complete update operation (enable all ranges).
|
public boolean enableRange(int startId, int endId, String client)
finishUpdate()
returns failure,
false is returned and the range is not added.startId
- the first id included in the rangeendId
- the last id included in the rangeclient
- the client requesting the enabled rangepublic boolean disableRange(int startId, int endId, String client)
finishUpdate()
returns failure,
false is returned and the range is not removed.startId
- the first id included in the rangeendId
- the last id included in the rangeclient
- the client requesting to disable the rangepublic boolean updateRanges()
startUpdate()
, followed by zero or
more calls to addRange(int, int, boolean)
, followed by finishUpdate()
.protected boolean tryAddRanges(int startId, int endId, boolean selected)
startId
- the first id included in the rangeendId
- the last id included in the rangeselected
- true to enable range, false to disable rangepublic boolean isEmpty()
protected abstract void startUpdate()
addRange(int, int, boolean)
followed by
a call to finishUpdate()
.protected abstract void addRange(int startId, int endId, boolean selected)
startUpdate()
to indicate a range of enabled
or disabled values.startId
- the first id included in the rangeendId
- the last id included in the rangeselected
- true to enable range, false to disable rangeprotected abstract boolean finishUpdate()
startUpdate()
.