net.sf.magicproject.event.context
Class MContextMtargetable

java.lang.Object
  extended by net.sf.magicproject.event.context.MContextMtargetable
All Implemented Interfaces:
ContextEventListener
Direct Known Subclasses:
MContextCardCardIntInt

public class MContextMtargetable
extends java.lang.Object
implements ContextEventListener

Since:
0.54, 0.82 timeStamp supported
Author:
Fabrice Daugan

Constructor Summary
MContextMtargetable(Targetable targetToSave)
          Creates a new instance of MContextMtargetable
MContextMtargetable(Targetable inTargetToSave, int maxTimeStamp)
          Creates a new instance of MContextMtargetable
 
Method Summary
 boolean checkTimeStamp(MCard card)
          Verify the timestamp of the specified card
 boolean equals(java.lang.Object context)
           
 MCard getCard()
          Return the MTargetable cast to MCard object of this context considering it's timstamp.
 MCard getEventSource()
          Return the card source of the event attached to this context.
 MCard getOriginalCard()
          Return the MTargetable cast to MCard object of this context without considering it's timstamp.
 Targetable getOriginalTargetable()
          Return the MTargetable object of this context without considering it's timstamp.
 Player getPlayer()
          Return the MTargetable object cast into MPlayer instance.
 Targetable getTargetable()
          Return the MTargetable object of this context considering it's timstamp.
 int getZoneContext()
          The zone attched to this context.
 int hashCode()
           
 void removeTimestamp()
          Decrement the reference counter for the current timestamp of this card.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MContextMtargetable

public MContextMtargetable(Targetable targetToSave)
Creates a new instance of MContextMtargetable

Parameters:
targetToSave - is the object to store

MContextMtargetable

public MContextMtargetable(Targetable inTargetToSave,
                           int maxTimeStamp)
Creates a new instance of MContextMtargetable

Parameters:
inTargetToSave - is the object to store
maxTimeStamp - is the maximum timestamp allowed for destination card during the resolution.
Method Detail

getTargetable

public final Targetable getTargetable()
Return the MTargetable object of this context considering it's timstamp. The returned object is the same as it was when this context has been created.

Returns:
the MTargetable object of this context as it was when this context has been created.

getCard

public final MCard getCard()
Return the MTargetable cast to MCard object of this context considering it's timstamp. The returned object is the same as it was when this context has been created.

Returns:
the MTargetable cast to MCard object of this context as it was when this context has been created.
See Also:
getTargetable()

removeTimestamp

public void removeTimestamp()
Description copied from interface: ContextEventListener
Decrement the reference counter for the current timestamp of this card.

Specified by:
removeTimestamp in interface ContextEventListener

checkTimeStamp

public boolean checkTimeStamp(MCard card)
Description copied from interface: ContextEventListener
Verify the timestamp of the specified card

Specified by:
checkTimeStamp in interface ContextEventListener
Parameters:
card - the concerned object.
Returns:
true if the timestamp is correct.

getPlayer

public final Player getPlayer()
Return the MTargetable object cast into MPlayer instance.

Returns:
the MTargetable object cast into MPlayer instance.

getOriginalTargetable

public final Targetable getOriginalTargetable()
Return the MTargetable object of this context without considering it's timstamp.

Returns:
the MTargetable object of this context.

getOriginalCard

public final MCard getOriginalCard()
Return the MTargetable cast to MCard object of this context without considering it's timstamp.

Returns:
the MTargetable cast to MCard object of this context without considering it's timstamp.

equals

public boolean equals(java.lang.Object context)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getEventSource

public final MCard getEventSource()
Description copied from interface: ContextEventListener
Return the card source of the event attached to this context.

Specified by:
getEventSource in interface ContextEventListener
Returns:
the card source of the event attached to this context.

toString

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

getZoneContext

public int getZoneContext()
Description copied from interface: ContextEventListener
The zone attched to this context.

Specified by:
getZoneContext in interface ContextEventListener
Returns:
zone attched to this context.


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