public class Dispatcher
extends java.lang.Object
Constructor and Description |
---|
Dispatcher(float w,
float h)
Constructs a new Dispatcher with a box width and height that will be passed to Junctions.
|
Dispatcher(float w,
float h,
java.lang.String address,
int port)
Constructs a new Dispatcher with a box width and height and a target address and port that will be passed to Junctions.
|
Modifier and Type | Method and Description |
---|---|
void |
addContact(int id,
float x,
float y)
Adds a Contact to this Dispatcher for distributing to Junctions.
|
void |
addJunction(Junction j)
Adds a Junction to this Dispatcher.
|
void |
clearContacts()
Removes all Contacts from all Junctions.
|
void |
clearEvents()
Clears all events from the event queue.
|
void |
clearJunctions()
Removes all Junctions stored by this Dispatcher.
|
Junction |
createJunction(float x,
float y,
float w,
float h)
Creates a new Junction with the specified parameters.
|
int |
getEventCount()
Gets the total number of events in the event queue.
|
Junction[] |
getJunctions()
Returns an array of the Junctions currently stored in this Dispatcher.
|
long |
getPlayTime()
Returns the elapsed playback time in naonseconds.
|
long |
getRecordTime()
Returns the elapsed record time in nanoseconds.
|
java.lang.String |
getTargetAddress()
Returns the target IP address for this Dispatcher.
|
int |
getTargetPort()
Returns the target port number for this Dispatcher.
|
void |
handleMotionEvent(android.view.MotionEvent event)
Handles event data contained in the MotionEvent object.
|
boolean |
isLooping()
Returns true if the playback of this Dispatcher is looping.
|
boolean |
isPlaying()
Returns true if this Dispatcher is currently playing.
|
boolean |
isRecording()
Returns true if this Dispatcher is currently recording.
|
void |
loadXML(java.io.InputStream input)
Loads Junction, Relay, and Event data from XML.
|
void |
loopPlaying()
Loops the playback of events.
|
void |
orderJunction(int o,
Junction j)
Sets the order for a Junction in the list for this Dispatcher.
|
void |
removeContact(int id)
Removes a Contact from a Junction via this Dispatcher.
|
void |
removeJunction(Junction j)
Removes a Junction from this Dispatcher.
|
void |
removeRecording(int id)
Removes a set of recorded events based on the recording id.
|
void |
saveXML(java.io.OutputStream output)
Saves Junction, Relay, and Event data to XML.
|
void |
scaleEventTimes(double s)
Scale Event times in the queue by the specified factor.
|
void |
setTarget(java.lang.String address,
int port)
Sets the IP address and port of the target to the specified values.
|
void |
startLooping()
Starts the looping state.
|
void |
startPlaying()
Starts the playback of events.
|
void |
startRecording()
Starts recording events for selected Junctions.
|
void |
stopLooping()
Stops the looping state.
|
void |
stopPlaying()
Stops playback of events.
|
void |
stopRecording()
Stops recording events.
|
void |
updateContact(int id,
float x,
float y)
Updates a Contact associated with a Junction via this Dispatcher.
|
public Dispatcher(float w, float h)
w
- the box widthh
- the box heightpublic Dispatcher(float w, float h, java.lang.String address, int port)
w
- the box widthh
- the box heightaddress
- the IP address of the targetport
- the port number of the targetpublic void setTarget(java.lang.String address, int port)
address
- the IP addressport
- the port numberpublic java.lang.String getTargetAddress()
public int getTargetPort()
public Junction createJunction(float x, float y, float w, float h)
addJunction(Junction)
method.x
- the x coordinate of the center pointy
- the y coordinate of the center pointw
- the widthh
- the heightpublic void addJunction(Junction j)
createJunction(float, float, float, float)
method. A Junction can be added only once.j
- the new Junction to addpublic void removeJunction(Junction j)
j
- the Junction to removepublic void orderJunction(int o, Junction j)
o
- the value to set for the orderj
- the Junction to be orderedpublic Junction[] getJunctions()
public void clearJunctions()
public void addContact(int id, float x, float y)
id
- the identifier associated with the Contactx
- the x location of the Contacty
- the y location of the Contactpublic void updateContact(int id, float x, float y)
id
- the identifier associated with the Contactx
- the x location of the Contacty
- the y location of the Contactpublic void removeContact(int id)
id
- the identifier associated with the Contactpublic void clearContacts()
public void handleMotionEvent(android.view.MotionEvent event)
event
- public void startRecording()
public void stopRecording()
public boolean isRecording()
public long getRecordTime()
public void startPlaying()
public void stopPlaying()
public boolean isPlaying()
public void loopPlaying()
public void startLooping()
public void stopLooping()
public boolean isLooping()
public long getPlayTime()
public int getEventCount()
public void clearEvents()
public void scaleEventTimes(double s)
s
- the scaling factorpublic void removeRecording(int id)
id
- public void saveXML(java.io.OutputStream output)
output
- the file to save topublic void loadXML(java.io.InputStream input)
input
- the file to load from