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.


Variable Index

 o ballInPlay
Ball in play status.
 o blipx
X location of ball.
 o blipy
Y location of ball.
 o buffer
Buffer in use.
 o buffinfo
Buffer info in use.
 o flipperZone
Y location of begin flipper area.
 o height
Image size.
 o id
Buffer's id.
 o image
The image from the camera.
 o left
Locations of the flippers.
 o leftState
Left flipper up state.
 o leftTime
Time flipper was last up.
 o networkTime
Time ping was sent.
 o number
Frame number.
 o objects
Objects found in the frame.
 o outZone
Location from bottom of screen to be considered out of play.
 o right
Locations of the flippers.
 o rightState
Right flipper up state.
 o rightTime
Time flipper was last up.
 o sender
Send data to the server.
 o strategy
Strategy used.
 o width
Image size.
 o xoffset
X image offset.
 o yoffset
Y image offset.

Constructor Index

 o RemoteStub(Buffer, TextArea, Strategy)
The stub for the strategy.
 o RemoteStub(Strategy)
The stub for the strategy.
 o RemoteStub(Strategy, MyClient)
The stub for the strategy.

Method Index

 o blipLocation(StringTokenizer)
Get the ball's location.
 o buffInfo(StringTokenizer)
Get the buffer.
 o buildBufferInfo()
Build the buffer.
 o flipperSpace()
Send the flipper space.
 o flipperZone()
Get the flipper's zone.
 o flipperZone(StringTokenizer)
Get the flipper zone.
 o flipStatsRequest()
Request flipper statistics.
 o headerInfo(String)
Write to the header of the log.
 o height()
Get the height.
 o height(StringTokenizer)
Get the height of the image.
 o isLeftDown()
Is the left flipper down.
 o isLeftUp()
Is the left flipper down.
 o isRightDown()
Is the right flipper down.
 o isRightUp()
Is the right flipper down.
 o leftFlipperLocation(StringTokenizer)
Get the left flipper location.
 o leftFlipperReset(long)
Should the left flipper be reset.
 o leftFlipperState(boolean)
Set the left flipper state.
 o leftX()
X location of left flipper.
 o leftY()
Y location of left flipper.
 o logit(String, int)
Write to the log.
 o number()
Get the frame number.
 o offline()
The client is going offline.
 o outZone()
Get the flipper's outzone.
 o outZone(StringTokenizer)
Get the out zone area.
 o ping()
Transmit ping command.
 o playStatus(StringTokenizer)
Get the ball in play status.
 o pong(StringTokenizer)
Get the pong command.
 o releaseAllBuffers()
Release all buffers.
 o releaseLock(Buffer)
Release the lock on the information buffer.
 o requestFrame()
Get a frame from the camera.
 o resetTime(StringTokenizer)
Get the in play time.
 o resize(int, int, int, int)
Set the resize flag and include resize information.
 o rightFlipperLocation(StringTokenizer)
Get the right flipper location.
 o rightFlipperReset(long)
Should the right flipper be reset.
 o rightFlipperState(boolean)
Set the right flipper state.
 o rightX()
X location of right flipper.
 o rightY()
Y location of right flipper.
 o run()
Do nothing in the main thread.
 o setImage(String)
Sets the image from the camera.
 o statsBallInPlay()
Check if ball is in play.
 o timeRequest()
Request the time.
 o topBottom()
Send the top and bottom area of game play.

Variables

 o ballInPlay
 protected boolean ballInPlay
Ball in play status.

 o left
 protected Location left
Locations of the flippers.

 o right
 protected Location right
Locations of the flippers.

 o blipx
 protected int blipx
X location of ball.

 o blipy
 protected int blipy
Y location of ball.

 o xoffset
 protected int xoffset
X image offset.

 o yoffset
 protected int yoffset
Y image offset.

 o outZone
 protected int outZone
Location from bottom of screen to be considered out of play. Gets value from fromBottom.

 o flipperZone
 protected int flipperZone
Y location of begin flipper area.

 o strategy
 protected Strategy strategy
Strategy used.

 o buffer
 protected Buffer buffer
Buffer in use.

 o buffinfo
 protected BufferInfo buffinfo
Buffer info in use.

 o leftState
 protected boolean leftState
Left flipper up state.

 o rightState
 protected boolean rightState
Right flipper up state.

 o leftTime
 protected long leftTime
Time flipper was last up.

 o rightTime
 protected long rightTime
Time flipper was last up.

 o sender
 protected MyClient sender
Send data to the server.

 o width
 protected int width
Image size.

 o height
 protected int height
Image size.

 o number
 protected int number
Frame number.

 o id
 protected int id
Buffer's id.

 o objects
 protected Vector objects
Objects found in the frame.

 o networkTime
 protected long networkTime
Time ping was sent.

 o image
 protected byte image[]
The image from the camera.

Constructors

 o RemoteStub
 public RemoteStub(Strategy strategy)
The stub for the strategy.

Parameters:
strategy - the strategy thread.
 o 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.
 o 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.

Methods

 o run
 public void run()
Do nothing in the main thread.

Overrides:
run in class Stub
 o playStatus
 public void playStatus(StringTokenizer tokens)
Get the ball in play status.

Parameters:
tokens - the data from the command.
 o resetTime
 public void resetTime(StringTokenizer tokens)
Get the in play time.

Parameters:
tokens - the data from the command.
 o leftFlipperLocation
 public void leftFlipperLocation(StringTokenizer tokens)
Get the left flipper location.

Parameters:
tokens - the data from the command.
 o rightFlipperLocation
 public void rightFlipperLocation(StringTokenizer tokens)
Get the right flipper location.

Parameters:
tokens - the data from the command.
 o outZone
 public void outZone(StringTokenizer tokens)
Get the out zone area.

Parameters:
tokens - the data from the command.
 o flipperZone
 public void flipperZone(StringTokenizer tokens)
Get the flipper zone.

Parameters:
tokens - the data from the command.
 o height
 public void height(StringTokenizer tokens)
Get the height of the image.

Parameters:
tokens - the data from the command.
 o blipLocation
 public void blipLocation(StringTokenizer tokens)
Get the ball's location.

Parameters:
tokens - the data from the command.
 o buffInfo
 public void buffInfo(StringTokenizer tokens)
Get the buffer.

Parameters:
tokens - the data from the command.
 o setImage
 public void setImage(String data)
Sets the image from the camera.

 o buildBufferInfo
 public void buildBufferInfo()
Build the buffer.

 o ping
 public void ping()
Transmit ping command.

 o flipStatsRequest
 public void flipStatsRequest()
Request flipper statistics.

 o timeRequest
 public void timeRequest()
Request the time.

 o pong
 public void pong(StringTokenizer tokens)
Get the pong command.

Parameters:
tokens - the data from the command.
 o flipperSpace
 public void flipperSpace()
Send the flipper space.

 o topBottom
 public void topBottom()
Send the top and bottom area of game play.

 o leftFlipperState
 public void leftFlipperState(boolean b)
Set the left flipper state.

Parameters:
b - the flipper state.
Overrides:
leftFlipperState in class Stub
 o rightFlipperState
 public void rightFlipperState(boolean b)
Set the right flipper state.

Parameters:
b - the flipper state.
Overrides:
rightFlipperState in class Stub
 o statsBallInPlay
 public boolean statsBallInPlay()
Check if ball is in play.

Returns:
ball's in play status.
Overrides:
statsBallInPlay in class Stub
 o leftX
 public int leftX()
X location of left flipper.

Returns:
left flipper's x location.
Overrides:
leftX in class Stub
 o leftY
 public int leftY()
Y location of left flipper.

Returns:
left flipper's y location.
Overrides:
leftY in class Stub
 o rightX
 public int rightX()
X location of right flipper.

Returns:
right flipper's x location.
Overrides:
rightX in class Stub
 o rightY
 public int rightY()
Y location of right flipper.

Returns:
right flipper's y location.
Overrides:
rightY in class Stub
 o flipperZone
 public int flipperZone()
Get the flipper's zone.

Returns:
flipper zone.
Overrides:
flipperZone in class Stub
 o outZone
 public int outZone()
Get the flipper's outzone.

Returns:
flipper outzone.
Overrides:
outZone in class Stub
 o number
 public int number()
Get the frame number.

Returns:
frame number.
Overrides:
number in class Stub
 o 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
 o 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
 o isLeftUp
 public boolean isLeftUp()
Is the left flipper down.

Returns:
flipper's down status.
Overrides:
isLeftUp in class Stub
 o isRightUp
 public boolean isRightUp()
Is the right flipper down.

Returns:
flipper's down status.
Overrides:
isRightUp in class Stub
 o isLeftDown
 public boolean isLeftDown()
Is the left flipper down.

Returns:
flipper's down status.
Overrides:
isLeftDown in class Stub
 o isRightDown
 public boolean isRightDown()
Is the right flipper down.

Returns:
flipper's down status.
Overrides:
isRightDown in class Stub
 o height
 public int height()
Get the height.

Returns:
height.
Overrides:
height in class Stub
 o releaseLock
 public void releaseLock(Buffer b)
Release the lock on the information buffer.

Overrides:
releaseLock in class Stub
 o 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
 o logit
 public void logit(String s,
                   int p)
Write to the log.

Parameters:
s - String to write.
p - priority level.
 o headerInfo
 public void headerInfo(String s)
Write to the header of the log.

Parameters:
s - String to write.
Overrides:
headerInfo in class Stub
 o requestFrame
 public void requestFrame()
Get a frame from the camera.

Overrides:
requestFrame in class Stub
 o releaseAllBuffers
 public void releaseAllBuffers()
Release all buffers.

Overrides:
releaseAllBuffers in class Stub
 o offline
 public void offline()
The client is going offline.


All Packages  Class Hierarchy  This Package  Previous  Next  Index