All Packages Class Hierarchy This Package Previous Next Index
Class pinball.player.remote.RemoteStub
java.lang.Object
|
+----java.lang.Thread
|
+----pinball.player.Stub
|
+----pinball.player.remote.RemoteStub
- public class RemoteStub
- extends Stub
This allows a player to play over the network. A player's strategy that's used
as a client, changes the Stub to a RemoteStub. When the player sends commands
to flip the flippers, the RemoteStub sends the commands over the network. Likewise
when the player wants to read data, such as ball location, the RemoteStub gets the
data from the networks. RemoteStub has the same commands as Stub, so the player
can't tell it's playing on the network. As far as it can tell it's playing locally.
-
ballInPlay
- Ball in play status.
-
blipx
- X location of ball.
-
blipy
- Y location of ball.
-
buffer
- Buffer in use.
-
buffinfo
- Buffer info in use.
-
flipperZone
- Y location of begin flipper area.
-
height
- Image size.
-
id
- Buffer's id.
-
image
- The image from the camera.
-
left
- Locations of the flippers.
-
leftState
- Left flipper up state.
-
leftTime
- Time flipper was last up.
-
networkTime
- Time ping was sent.
-
number
- Frame number.
-
objects
- Objects found in the frame.
-
outZone
-
Location from bottom of screen to be considered out of play.
-
right
- Locations of the flippers.
-
rightState
- Right flipper up state.
-
rightTime
- Time flipper was last up.
-
sender
- Send data to the server.
-
strategy
- Strategy used.
-
width
- Image size.
-
xoffset
- X image offset.
-
yoffset
- Y image offset.
-
RemoteStub(Buffer, TextArea, Strategy)
- The stub for the strategy.
-
RemoteStub(Strategy)
- The stub for the strategy.
-
RemoteStub(Strategy, MyClient)
- The stub for the strategy.
-
blipLocation(StringTokenizer)
- Get the ball's location.
-
buffInfo(StringTokenizer)
- Get the buffer.
-
buildBufferInfo()
- Build the buffer.
-
flipperSpace()
- Send the flipper space.
-
flipperZone()
- Get the flipper's zone.
-
flipperZone(StringTokenizer)
- Get the flipper zone.
-
flipStatsRequest()
-
Request flipper statistics.
-
headerInfo(String)
- Write to the header of the log.
-
height()
- Get the height.
-
height(StringTokenizer)
- Get the height of the image.
-
isLeftDown()
- Is the left flipper down.
-
isLeftUp()
- Is the left flipper down.
-
isRightDown()
- Is the right flipper down.
-
isRightUp()
- Is the right flipper down.
-
leftFlipperLocation(StringTokenizer)
- Get the left flipper location.
-
leftFlipperReset(long)
- Should the left flipper be reset.
-
leftFlipperState(boolean)
- Set the left flipper state.
-
leftX()
-
X location of left flipper.
-
leftY()
-
Y location of left flipper.
-
logit(String, int)
- Write to the log.
-
number()
- Get the frame number.
-
offline()
- The client is going offline.
-
outZone()
- Get the flipper's outzone.
-
outZone(StringTokenizer)
- Get the out zone area.
-
ping()
-
Transmit ping command.
-
playStatus(StringTokenizer)
- Get the ball in play status.
-
pong(StringTokenizer)
- Get the pong command.
-
releaseAllBuffers()
- Release all buffers.
-
releaseLock(Buffer)
- Release the lock on the information buffer.
-
requestFrame()
- Get a frame from the camera.
-
resetTime(StringTokenizer)
- Get the in play time.
-
resize(int, int, int, int)
-
Set the resize flag and include resize information.
-
rightFlipperLocation(StringTokenizer)
- Get the right flipper location.
-
rightFlipperReset(long)
- Should the right flipper be reset.
-
rightFlipperState(boolean)
- Set the right flipper state.
-
rightX()
-
X location of right flipper.
-
rightY()
-
Y location of right flipper.
-
run()
- Do nothing in the main thread.
-
setImage(String)
- Sets the image from the camera.
-
statsBallInPlay()
-
Check if ball is in play.
-
timeRequest()
-
Request the time.
-
topBottom()
- Send the top and bottom area of game play.
ballInPlay
protected boolean ballInPlay
- Ball in play status.
left
protected Location left
- Locations of the flippers.
right
protected Location right
- Locations of the flippers.
blipx
protected int blipx
- X location of ball.
blipy
protected int blipy
- Y location of ball.
xoffset
protected int xoffset
- X image offset.
yoffset
protected int yoffset
- Y image offset.
outZone
protected int outZone
- Location from bottom of screen to be considered out of play.
Gets value from fromBottom.
flipperZone
protected int flipperZone
- Y location of begin flipper area.
strategy
protected Strategy strategy
- Strategy used.
buffer
protected Buffer buffer
- Buffer in use.
buffinfo
protected BufferInfo buffinfo
- Buffer info in use.
leftState
protected boolean leftState
- Left flipper up state.
rightState
protected boolean rightState
- Right flipper up state.
leftTime
protected long leftTime
- Time flipper was last up.
rightTime
protected long rightTime
- Time flipper was last up.
sender
protected MyClient sender
- Send data to the server.
width
protected int width
- Image size.
height
protected int height
- Image size.
number
protected int number
- Frame number.
id
protected int id
- Buffer's id.
objects
protected Vector objects
- Objects found in the frame.
networkTime
protected long networkTime
- Time ping was sent.
image
protected byte image[]
- The image from the camera.
RemoteStub
public RemoteStub(Strategy strategy)
- The stub for the strategy.
- Parameters:
- strategy - the strategy thread.
RemoteStub
public RemoteStub(Strategy strategy,
MyClient client)
- The stub for the strategy.
- Parameters:
- strategy - the strategy thread.
- client - the client who's connected to the server.
RemoteStub
public RemoteStub(Buffer buffer,
TextArea gameStats,
Strategy strategy)
- The stub for the strategy.
- Parameters:
- buffer - The first buffer for the information buffers.
- gameStats - the area on the screen to write stats info.
- the - strategy thread.
run
public void run()
- Do nothing in the main thread.
- Overrides:
- run in class Stub
playStatus
public void playStatus(StringTokenizer tokens)
- Get the ball in play status.
- Parameters:
- tokens - the data from the command.
resetTime
public void resetTime(StringTokenizer tokens)
- Get the in play time.
- Parameters:
- tokens - the data from the command.
leftFlipperLocation
public void leftFlipperLocation(StringTokenizer tokens)
- Get the left flipper location.
- Parameters:
- tokens - the data from the command.
rightFlipperLocation
public void rightFlipperLocation(StringTokenizer tokens)
- Get the right flipper location.
- Parameters:
- tokens - the data from the command.
outZone
public void outZone(StringTokenizer tokens)
- Get the out zone area.
- Parameters:
- tokens - the data from the command.
flipperZone
public void flipperZone(StringTokenizer tokens)
- Get the flipper zone.
- Parameters:
- tokens - the data from the command.
height
public void height(StringTokenizer tokens)
- Get the height of the image.
- Parameters:
- tokens - the data from the command.
blipLocation
public void blipLocation(StringTokenizer tokens)
- Get the ball's location.
- Parameters:
- tokens - the data from the command.
buffInfo
public void buffInfo(StringTokenizer tokens)
- Get the buffer.
- Parameters:
- tokens - the data from the command.
setImage
public void setImage(String data)
- Sets the image from the camera.
buildBufferInfo
public void buildBufferInfo()
- Build the buffer.
ping
public void ping()
- Transmit ping command.
flipStatsRequest
public void flipStatsRequest()
- Request flipper statistics.
timeRequest
public void timeRequest()
- Request the time.
pong
public void pong(StringTokenizer tokens)
- Get the pong command.
- Parameters:
- tokens - the data from the command.
flipperSpace
public void flipperSpace()
- Send the flipper space.
topBottom
public void topBottom()
- Send the top and bottom area of game play.
leftFlipperState
public void leftFlipperState(boolean b)
- Set the left flipper state.
- Parameters:
- b - the flipper state.
- Overrides:
- leftFlipperState in class Stub
rightFlipperState
public void rightFlipperState(boolean b)
- Set the right flipper state.
- Parameters:
- b - the flipper state.
- Overrides:
- rightFlipperState in class Stub
statsBallInPlay
public boolean statsBallInPlay()
- Check if ball is in play.
- Returns:
- ball's in play status.
- Overrides:
- statsBallInPlay in class Stub
leftX
public int leftX()
- X location of left flipper.
- Returns:
- left flipper's x location.
- Overrides:
- leftX in class Stub
leftY
public int leftY()
- Y location of left flipper.
- Returns:
- left flipper's y location.
- Overrides:
- leftY in class Stub
rightX
public int rightX()
- X location of right flipper.
- Returns:
- right flipper's x location.
- Overrides:
- rightX in class Stub
rightY
public int rightY()
- Y location of right flipper.
- Returns:
- right flipper's y location.
- Overrides:
- rightY in class Stub
flipperZone
public int flipperZone()
- Get the flipper's zone.
- Returns:
- flipper zone.
- Overrides:
- flipperZone in class Stub
outZone
public int outZone()
- Get the flipper's outzone.
- Returns:
- flipper outzone.
- Overrides:
- outZone in class Stub
number
public int number()
- Get the frame number.
- Returns:
- frame number.
- Overrides:
- number in class Stub
leftFlipperReset
public boolean leftFlipperReset(long time)
- Should the left flipper be reset. Has it been up long enough.
- Parameters:
- done - Has the flipper been up at least this long?
- Returns:
- should the flipper be reset or not.
- Overrides:
- leftFlipperReset in class Stub
rightFlipperReset
public boolean rightFlipperReset(long time)
- Should the right flipper be reset. Has it been up long enough.
- Parameters:
- done - Has the flipper been up at least this long?
- Returns:
- should the flipper be reset or not.
- Overrides:
- rightFlipperReset in class Stub
isLeftUp
public boolean isLeftUp()
- Is the left flipper down.
- Returns:
- flipper's down status.
- Overrides:
- isLeftUp in class Stub
isRightUp
public boolean isRightUp()
- Is the right flipper down.
- Returns:
- flipper's down status.
- Overrides:
- isRightUp in class Stub
isLeftDown
public boolean isLeftDown()
- Is the left flipper down.
- Returns:
- flipper's down status.
- Overrides:
- isLeftDown in class Stub
isRightDown
public boolean isRightDown()
- Is the right flipper down.
- Returns:
- flipper's down status.
- Overrides:
- isRightDown in class Stub
height
public int height()
- Get the height.
- Returns:
- height.
- Overrides:
- height in class Stub
releaseLock
public void releaseLock(Buffer b)
- Release the lock on the information buffer.
- Overrides:
- releaseLock in class Stub
resize
public void resize(int w,
int d,
int xo,
int yo)
- Set the resize flag and include resize information.
- Parameters:
- x - x size.
- y - y size.
- OX - x offset.
- OY - y offset.
- Overrides:
- resize in class Stub
logit
public void logit(String s,
int p)
- Write to the log.
- Parameters:
- s - String to write.
- p - priority level.
headerInfo
public void headerInfo(String s)
- Write to the header of the log.
- Parameters:
- s - String to write.
- Overrides:
- headerInfo in class Stub
requestFrame
public void requestFrame()
- Get a frame from the camera.
- Overrides:
- requestFrame in class Stub
releaseAllBuffers
public void releaseAllBuffers()
- Release all buffers.
- Overrides:
- releaseAllBuffers in class Stub
offline
public void offline()
- The client is going offline.
All Packages Class Hierarchy This Package Previous Next Index