net.sf.magicproject.clickable.targetable.card
Class LastKnownCard

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by net.sf.magicproject.clickable.Clickable
                  extended by net.sf.magicproject.clickable.targetable.Targetable
                      extended by net.sf.magicproject.clickable.targetable.card.AbstractCard
                          extended by net.sf.magicproject.clickable.targetable.card.MCard
                              extended by net.sf.magicproject.clickable.targetable.card.LastKnownCard
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.event.MouseWheelListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, LastKnownCardInfo, MonitorListener, Tappable

public class LastKnownCard
extends MCard
implements LastKnownCardInfo

Since:
0.83
Author:
Fabrice Daugan
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
 
Fields inherited from class net.sf.magicproject.clickable.targetable.card.MCard
abilityModifier, cachedIdCard, cachedIdColor, cachedProperties, cachedRegisters, colorModifier, idCardModifier, originalController, playableZoneModifier, propertyModifier, tapped
 
Fields inherited from class net.sf.magicproject.clickable.targetable.card.AbstractCard
controller, reversed, visibility
 
Fields inherited from class net.sf.magicproject.clickable.targetable.Targetable
cachedAbilities, controllerModifier, indirections, registerModifiers, registers
 
Fields inherited from class net.sf.magicproject.clickable.Clickable
highLightColor, isHighLighted
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
LastKnownCard(MCard originalCard, int destinationZone, int idColor, int idCard, boolean tapped, int[] registers, Player controller, Player owner, java.util.Set<java.lang.Integer> properties, int timestamp, int timestampReferences)
           
 
Method Summary
 void addModifier(ColorModifier modifier)
          Add a modifier to this object
 void addModifier(ControllerModifier modifier)
          Add a modifier to this object
 void addModifier(IdCardModifier modifier)
          Add a modifier to this object
 void addModifier(PlayableZoneModifier modifier)
          Add a modifier to this object
 void addModifier(PropertyModifier modifier)
          Add a modifier to this object
 void addModifier(RegisterIndirection modifier, int index)
          Add a modifier to this object
 void addModifier(RegisterModifier modifier, int index)
          Add a modifier to this object
 void addTimestampReference()
          Add a reference to this targetable.
 LastKnownCard createLastKnownCard()
          Create and return a LastKnownCard object build with the last known informations.
 int getIdZone()
          Return the zone identifant of this card.
 Targetable getOriginalTargetable()
          Return the original targetable without looking for the timestamp number.
 int getValue(int index)
          Return the value corresponding to the true register index.
 boolean isSameIdZone(int idZone)
          Compare a zone with the current card'szone
 boolean isSamePosition(int position)
          Indicates wether this card suits to the specified position code.
 boolean isSameState(int zoneConstaint)
           Indicates if this card match with the specified place and constraint.
 void moveCard(int newIdPlace, Player newController, boolean newIsTapped, int idPosition)
          Move this card to a new place tapped or not under the control of a player
 boolean playableZone(int supposedZone, int idZone)
          Indicates this card can be played from a specified zone.
 void removeModifier(ColorModifier modifier)
          Remove the specified color-modifier.
 void removeModifier(ControllerModifier modifier)
          Remove the specified controller-modifier
 void removeModifier(IdCardModifier modifier)
          Remove the specified idcard-modifier
 void removeModifier(PlayableZoneModifier modifier)
          Remove the specified playable zone-modifier
 void removeModifier(PropertyModifier modifier)
          Remove the specified property-modifier
 void removeModifier(RegisterIndirection indirection, int index)
          Remove a register-indirection modifier from this component.
 void removeModifier(RegisterModifier modifier, int index)
          Remove a register modifier from this component.
 boolean removeTimestamp(int timestamp)
          Remove a reference to the given timestamp of card.
 void reverse(boolean reversed)
          Reverse this card if the specified parameter is true
 void setValue(int index, Operation operation, int rightValue)
          Set to the register of this card a value to a specified index.
 void tap(boolean tapped)
          Tap/untap this component
 
Methods inherited from class net.sf.magicproject.clickable.targetable.card.MCard
addModifier, checkAllCardsOf, clearDamages, clickOn, countAllCardsOf, decrementTimestampReference, equals, getAttachedCards, getBytes, getCard, getCardModel, getContainer, getDummyAbility, getIdCard, getIdColor, getIdZone, getIdZone, getLastKnownTargetable, getModifierModels, getNbObjects, getOriginalDatabase, getOwner, getProperties, getTimestamp, getTooltipString, getValueIndirection, hasDirtyDataBase, hashCode, hasIdCard, hasIdCard, hasIdColor, hasIdColor, hasIdType, hasPropertyNotFromCreator, highLight, intersectionIdCard, isAbility, isACopy, isAttached, isSameIdZone, isSpell, isTapped, mouseClicked, mouseWheelMoved, needReverse, refreshAbilities, refreshController, refreshIdCard, refreshIdColor, refreshProperties, refreshRegisters, registerAbilities, registerReplacementAbilities, removeModifier, returnCard, sendClickToOpponent, setDataBase, setIdZone, setOwner, targetize, unregisterAbilities, updateAbilities
 
Methods inherited from class net.sf.magicproject.clickable.targetable.card.AbstractCard
getCardName, getController, getDatabase, getMUI, getPreviewImage, image, isCard, mouseEntered, mouseExited, notifyChange, reverseAsNeeded, scaledImage, toString
 
Methods inherited from class net.sf.magicproject.clickable.targetable.Targetable
actionPerformed, addPrivateNamedObject, clearPrivateNamedObject, getCreator, getId, getPrivateNamedObject, getPrivateNamedObjects, isPlayer, removePrivateNamedObject, setCreator, targetize, tokenize
 
Methods inherited from class net.sf.magicproject.clickable.Clickable
disHighLight, disHighlight, mousePressed, mouseReleased
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LastKnownCard

public LastKnownCard(MCard originalCard,
                     int destinationZone,
                     int idColor,
                     int idCard,
                     boolean tapped,
                     int[] registers,
                     Player controller,
                     Player owner,
                     java.util.Set<java.lang.Integer> properties,
                     int timestamp,
                     int timestampReferences)
Parameters:
originalCard - the original card reference.
destinationZone - destination id zone.
idColor - the original color id.
idCard - the original card type.
tapped - the original tapped position.
registers - the original registers.
controller - the original controller.
owner - the original owner.
properties - the original properties.
timestamp - the snapshot timestamp.
timestampReferences - the references to the cards.
Method Detail

addTimestampReference

public void addTimestampReference()
Description copied from class: Targetable
Add a reference to this targetable.

Overrides:
addTimestampReference in class MCard

reverse

public void reverse(boolean reversed)
Description copied from class: AbstractCard
Reverse this card if the specified parameter is true

Overrides:
reverse in class MCard
Parameters:
reversed - if true the card will be tured as if your controled controls it

createLastKnownCard

public LastKnownCard createLastKnownCard()
Description copied from interface: LastKnownCardInfo
Create and return a LastKnownCard object build with the last known informations.

Specified by:
createLastKnownCard in interface LastKnownCardInfo
Returns:
a LastKnownCard object build with the last known informations.

getOriginalTargetable

public Targetable getOriginalTargetable()
Description copied from class: Targetable
Return the original targetable without looking for the timestamp number.

Overrides:
getOriginalTargetable in class Targetable
Returns:
the original targetable without looking for the timestamp number.

removeTimestamp

public boolean removeTimestamp(int timestamp)
Remove a reference to the given timestamp of card.

Specified by:
removeTimestamp in interface LastKnownCardInfo
Parameters:
timestamp - the timestamp reference
Returns:
true if the given timestamp is no more referenced.

isSameState

public boolean isSameState(int zoneConstaint)
Description copied from class: MCard
The zones are compared, then the constraint tapped/untapped is checked.
If zoneConstaint is ID__ANYWHERE, return true.
If zoneConstaint is same as current zone of this card and the constraint is validated, return true

Overrides:
isSameState in class MCard
Parameters:
zoneConstaint - the zone id and optional tapped information.
Returns:
true if zoneConstaint is ID__ANYWHERE or zoneConstaint is same as current place of this card and the constraint is verified.
See Also:
IdZones.PLAY_TAPPED, IdZones.PLAY_UNTAPPED, IdZones

isSameIdZone

public boolean isSameIdZone(int idZone)
Description copied from class: MCard
Compare a zone with the current card'szone

Overrides:
isSameIdZone in class MCard
Parameters:
idZone - the other zone
Returns:
true the specified zone, and the current card's zone are the same.

getIdZone

public int getIdZone()
Description copied from class: MCard
Return the zone identifant of this card.

Overrides:
getIdZone in class MCard
Returns:
the zone identifant of this card. IdZones#PLAY, IdZones#HAND,...
See Also:
IdZones, IdZones

tap

public void tap(boolean tapped)
Description copied from interface: Tappable
Tap/untap this component

Specified by:
tap in interface Tappable
Overrides:
tap in class MCard
Parameters:
tapped - if true the component will be tapped

moveCard

public void moveCard(int newIdPlace,
                     Player newController,
                     boolean newIsTapped,
                     int idPosition)
Description copied from class: AbstractCard
Move this card to a new place tapped or not under the control of a player

Overrides:
moveCard in class MCard
Parameters:
newIdPlace - the new place for this card
newController - new controler of this card. If null, the controler is the owner.
newIsTapped - dertermines if this card will come tapped or not
idPosition - from IdPositions

getValue

public int getValue(int index)
Description copied from class: Targetable
Return the value corresponding to the true register index.

Overrides:
getValue in class MCard
Parameters:
index - the register index
Returns:
the value corresponding to the true register index.

addModifier

public void addModifier(ColorModifier modifier)
Description copied from class: MCard
Add a modifier to this object

Overrides:
addModifier in class MCard
Parameters:
modifier - the color-modifier to add to this object

addModifier

public void addModifier(IdCardModifier modifier)
Description copied from class: MCard
Add a modifier to this object

Overrides:
addModifier in class MCard
Parameters:
modifier - the idcard-modifier to add to this object

addModifier

public void addModifier(PropertyModifier modifier)
Description copied from class: MCard
Add a modifier to this object

Overrides:
addModifier in class MCard
Parameters:
modifier - the property-modifier to add to this object

addModifier

public void addModifier(ControllerModifier modifier)
Description copied from class: MCard
Add a modifier to this object

Overrides:
addModifier in class MCard
Parameters:
modifier - the controller-modifier to add to this object

addModifier

public void addModifier(PlayableZoneModifier modifier)
Description copied from class: MCard
Add a modifier to this object

Overrides:
addModifier in class MCard
Parameters:
modifier - the playable zone-modifier to add to this object

addModifier

public void addModifier(RegisterModifier modifier,
                        int index)
Description copied from class: Targetable
Add a modifier to this object

Overrides:
addModifier in class Targetable
Parameters:
modifier - the modifier to add to this object
index - is the modifier register index

addModifier

public void addModifier(RegisterIndirection modifier,
                        int index)
Description copied from class: Targetable
Add a modifier to this object

Overrides:
addModifier in class Targetable
Parameters:
modifier - the indirection modifier to add to this object
index - is the modifier register index

removeModifier

public void removeModifier(RegisterModifier modifier,
                           int index)
Description copied from class: Targetable
Remove a register modifier from this component.

Overrides:
removeModifier in class MCard
Parameters:
modifier - the register modifier to remove.
index - index of register to remove.

removeModifier

public void removeModifier(RegisterIndirection indirection,
                           int index)
Description copied from class: Targetable
Remove a register-indirection modifier from this component.

Overrides:
removeModifier in class MCard
Parameters:
indirection - the register-indirection modifier to remove.
index - index of register indirection to remove.

removeModifier

public void removeModifier(IdCardModifier modifier)
Description copied from class: MCard
Remove the specified idcard-modifier

Overrides:
removeModifier in class MCard
Parameters:
modifier - the idcard-modifier to be removed from this object

removeModifier

public void removeModifier(ControllerModifier modifier)
Description copied from class: MCard
Remove the specified controller-modifier

Overrides:
removeModifier in class MCard
Parameters:
modifier - the controller-modifier to be removed from this object

removeModifier

public void removeModifier(PropertyModifier modifier)
Description copied from class: MCard
Remove the specified property-modifier

Overrides:
removeModifier in class MCard
Parameters:
modifier - the property-modifier to be removed from this object

removeModifier

public void removeModifier(PlayableZoneModifier modifier)
Description copied from class: MCard
Remove the specified playable zone-modifier

Overrides:
removeModifier in class MCard
Parameters:
modifier - the playable zone-modifier to be removed from this object

removeModifier

public void removeModifier(ColorModifier modifier)
Description copied from class: MCard
Remove the specified color-modifier.

Overrides:
removeModifier in class MCard
Parameters:
modifier - the color-modifier to be removed from this object

playableZone

public boolean playableZone(int supposedZone,
                            int idZone)
Description copied from class: MCard
Indicates this card can be played from a specified zone.

Overrides:
playableZone in class MCard
Parameters:
supposedZone - the zone where the this card would be played from.
idZone - the zone where this card can be played from.
Returns:
true if this card is playable from the supposed zone

setValue

public void setValue(int index,
                     Operation operation,
                     int rightValue)
Description copied from class: MCard
Set to the register of this card a value to a specified index. The given operation is uesed to apply operation on old and the given value. To set the given value as the new one, use the "set" operation.

Overrides:
setValue in class MCard
Parameters:
index - is the index of register to modify
operation - the operation to use
rightValue - is the value to use as right operande for the operation

isSamePosition

public boolean isSamePosition(int position)
Description copied from class: MCard
Indicates wether this card suits to the specified position code.

Overrides:
isSamePosition in class MCard
Parameters:
position - the matching position code
Returns:
true if this card suits to the specified position code.
See Also:
IdPositions.ON_THE_BOTTOM, IdPositions.ON_THE_TOP


Copyright © 2003-2007 Magic-Project. All Rights Reserved.