ch.aplu.jcardgame
Class TargetArea

java.lang.Object
  extended by ch.aplu.jcardgame.TargetArea

public class TargetArea
extends java.lang.Object

Class to represent the target area and moving options for card transfers.


Constructor Summary
TargetArea(Location targetLocation)
          Sets the attributes for transferring cards.
TargetArea(Location targetLocation, CardOrientation cardOrientation, int slideStep, boolean onTop)
          Sets the attributes for transferring cards.
 
Method Summary
 TargetArea clone()
          Performs a deep copy of the given TargetArea.
 CardOrientation getCardOrientation()
          Returns the current card orientation.
 int getSlideStep()
          Returns the curren slide step (steps per simulation cycle to move the card in an animated transfer).
 Location getTargetLocation()
          Returns a clone of the current target location.
 boolean isOnTop()
          Returns the current state of set onTop flag.
 void setCardOrientation(CardOrientation cardOrientation)
          Sets the card orientation to the given orientation.
 void setOnTop(boolean enable)
          Sets/resets the onTop flag.
 void setSlideStep(int slideStep)
          Sets the slide step to the given step
 void setTargetLocation(Location targetLocation)
          Sets the target location to the given location.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TargetArea

public TargetArea(Location targetLocation)
Sets the attributes for transferring cards. The cards are moved to the given target location (may be anywhere, not necessarily at the target hand location). During the transfer, the given card orientation is used. Defaults:
cardOrientation = CardOrientation.NORTH
slideStep = 10 (animated transfer)
onTop = true (move on top of other actors)

Parameters:
targetLocation - the location where the cards are transferred

TargetArea

public TargetArea(Location targetLocation,
                  CardOrientation cardOrientation,
                  int slideStep,
                  boolean onTop)
Sets the attributes for transferring cards. The cards are moved to the given target location (may be anywhere, not necessarily at the target hand location). During the transfer, the given card orientation is used.

Parameters:
targetLocation - the location where the cards are transferred
cardOrientation - the card orientation used for the transfer
slideStep - the distance the card moves at every game grid simulation cycle (>= 1)
onTop - if true, the card moves over all other actors; otherwise it moves under other actors
Method Detail

clone

public TargetArea clone()
Performs a deep copy of the given TargetArea.

Overrides:
clone in class java.lang.Object
Returns:
a new TargetArea reference with the same attributes

getTargetLocation

public Location getTargetLocation()
Returns a clone of the current target location.

Returns:
the target location

getCardOrientation

public CardOrientation getCardOrientation()
Returns the current card orientation.

Returns:
the card orientation

getSlideStep

public int getSlideStep()
Returns the curren slide step (steps per simulation cycle to move the card in an animated transfer).

Returns:
the slide step

isOnTop

public boolean isOnTop()
Returns the current state of set onTop flag.

Returns:
the onTop flag

setTargetLocation

public void setTargetLocation(Location targetLocation)
Sets the target location to the given location.

Parameters:
targetLocation - the new target location

setCardOrientation

public void setCardOrientation(CardOrientation cardOrientation)
Sets the card orientation to the given orientation.

Parameters:
cardOrientation - the new card orientation

setSlideStep

public void setSlideStep(int slideStep)
Sets the slide step to the given step

Parameters:
slideStep - the new slide step (steps per simulation cycle to move the card in an animated transfer).

setOnTop

public void setOnTop(boolean enable)
Sets/resets the onTop flag.

Parameters:
enable - if true, the card moves over all other actors in an animated transfer; otherwise it moves below other actors