public abstract class Stream extends Object
Modifier and Type | Field and Description |
---|---|
protected static boolean |
DEBUG |
private int |
max
The maximum value for tiles
|
private int |
min
The minimum value for tiles
|
protected int |
presentation
the presentation style
|
protected ServerSpace |
serverSpace
The owning GCspy space
|
protected Address |
stream
The address of the C stream, gcspy_gc_stream_t *stream, used in all calls
to the C library
|
protected int |
streamId
The stream's ID
|
protected int |
summary0
The first summary value
|
protected int |
summary1
The second summary value (if any)
|
protected boolean |
summaryEnabled
use summaries?
|
protected int |
summaryLen
A summary has 1 or 2 values depending on presentation style
(PERCENT* styles require 2 values).
|
Modifier | Constructor and Description |
---|---|
protected |
Stream(AbstractDriver driver,
int dataType,
String name,
int minValue,
int maxValue,
int zeroValue,
int defaultValue,
String stringPre,
String stringPost,
int presentation,
int paintStyle,
int indexMaxStream,
Color colour,
boolean summary)
Construct a new GCspy stream.
|
Modifier and Type | Method and Description |
---|---|
int |
getMaxValue()
Return the maximum value expected for this stream.
|
int |
getMinValue()
Return the minimum value expected for this stream.
|
abstract void |
send(int event,
int numTiles)
Send the data for this stream.
|
void |
sendSummary()
Send the summary data for this stream.
|
void |
setStream(int id,
Address str)
Set the stream address and id (called by AbstractDriver.addStream).
|
void |
setSummary(int value0)
Set the summary value for presentation styles with just one value
|
void |
setSummary(int value0,
int value1)
Set the summary values for presentation styles with two values (i.e.
|
private void |
setupSummary(int presentation)
Setup the summary array.
|
protected Address stream
protected ServerSpace serverSpace
protected int streamId
protected int summaryLen
protected int summary0
protected int summary1
private final int min
private final int max
protected boolean summaryEnabled
protected int presentation
protected static final boolean DEBUG
protected Stream(AbstractDriver driver, int dataType, String name, int minValue, int maxValue, int zeroValue, int defaultValue, String stringPre, String stringPost, int presentation, int paintStyle, int indexMaxStream, Color colour, boolean summary)
driver
- The AbstractDriver that owns this StreamdataType
- The stream's data type, one of BYTE_TYPE, SHORT_TYPE or INT_TYPEname
- The name of the stream (e.g. "Used space")minValue
- The minimum value for any item in this stream. Values less than
this will be represented as "minValue-"maxValue
- The maximum value for any item in this stream. Values greater than
this will be represented as "maxValue+"zeroValue
- The zero value for this streamdefaultValue
- The default value for this streamstringPre
- A string to prefix values (e.g. "Used: ")stringPost
- A string to suffix values (e.g. " bytes.")presentation
- How a stream value is to be presented.paintStyle
- How the value is to be painted.indexMaxStream
- The index for the maximum stream if the presentation is *_VAR.colour
- The default colour for tiles of this streamsummary
- Is a summary enabled?public void setStream(int id, Address str)
id
- the idstr
- the address of the gcspy C gcspy_gc_stream_t *streampublic int getMinValue()
public int getMaxValue()
private void setupSummary(int presentation)
presentation
- the presentation stylepublic void setSummary(int value0)
value0
- the valuepublic void setSummary(int value0, int value1)
value0
- the numerator valuevalue1
- the denominator valuepublic abstract void send(int event, int numTiles)
event
- the event.numTiles
- the number of tiles to send (which may be less than maxTileNum)public void sendSummary()