game
Class Action

java.lang.Object
  extended by game.Action

public class Action
extends java.lang.Object

Represents an action of a player.
blind posting: 'b'
folding: 'f'
checking: 'c' + amount of change == 0
calling: 'c' + amount of change != 0
raising: 'r'

Author:
Witthold/Korol

Field Summary
private  char action
          'b' for blind posting; 'f' for folding; 'c' for checking/calling; 'r' for raising;
private  boolean allIn
          If the action is an all-in
private  int change
          Amount of money change by this action
private  int player
          Index of player who applied this action
private  int potBefore
          Amount in the pot before the action takes effect
private  long timestamp
          Time stamp of creation of the action
 
Constructor Summary
Action(char action, int change)
          Generates a new action.
Action(int potBefore, int player, char action, int change)
          Generates a new action.
 
Method Summary
 char getAction()
           
 int getChange()
           
 int getPlayer()
           
 int getPotBefore()
           
 long getTimestamp()
           
 boolean isAllIn()
           
 boolean isBlind()
           
 boolean isCall()
           
 boolean isCheck()
           
 boolean isFold()
           
 boolean isRaise()
           
 void setAllIn()
          Marks the action as an all-in action
 int toInt()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

timestamp

private long timestamp
Time stamp of creation of the action


action

private char action
'b' for blind posting; 'f' for folding; 'c' for checking/calling; 'r' for raising;


change

private int change
Amount of money change by this action


player

private int player
Index of player who applied this action


potBefore

private int potBefore
Amount in the pot before the action takes effect


allIn

private boolean allIn
If the action is an all-in

Constructor Detail

Action

public Action(int potBefore,
              int player,
              char action,
              int change)
Generates a new action.

Parameters:
potBefore - Amount in the pot before the action takes effect
player - Index of player who applied this action
action - Type of action as char: 'b' for blind posting; 'f' for folding; 'c' for checking/calling; 'r' for raising;
change - Amount of money change by this action

Action

public Action(char action,
              int change)
Generates a new action.

Parameters:
action - Type of action as char: 'b' for blind posting; 'f' for folding; 'c' for checking/calling; 'r' for raising;
change - Amount of money change by this action
Method Detail

isBlind

public boolean isBlind()
Returns:
true if action is a blind post

isCheck

public boolean isCheck()
Returns:
true if action is a check

isCall

public boolean isCall()
Returns:
true if action is a call

isRaise

public boolean isRaise()
Returns:
true if action is a raise

isFold

public boolean isFold()
Returns:
true if action is a fold

getAction

public char getAction()
Returns:
The type of action as a char

getChange

public int getChange()
Returns:
The amount of the change by the action

getTimestamp

public long getTimestamp()
Returns:
The time stamp of the creation of the action

getPotBefore

public int getPotBefore()
Returns:
Amount in the pot before the action takes effect

getPlayer

public int getPlayer()
Returns:
Index of player who applied this action

setAllIn

public void setAllIn()
Marks the action as an all-in action


isAllIn

public boolean isAllIn()
Returns:
if it is an all-in action

toInt

public int toInt()
Returns:
Type of action as an int.
Fold: -1, Check: 0, Call: 1, Raise: 5, Allin: 9

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object