net.sf.magicproject.token
Class Register

java.lang.Object
  extended by net.sf.magicproject.token.Register

public class Register
extends java.lang.Object

Since:
0.93
Author:
Fabrice Daugan

Field Summary
static java.lang.String[] REGISTER_NAMES
          Accessible register names.
static int[] REGISTER_VALUES
          Accessible register values.
 
Constructor Summary
Register(int ordinal)
          Create a new instance of this class.
Register(TestOn on)
          Create a new instance of this class.
 
Method Summary
 boolean canBePreempted()
          Return true if the associated value can be evaluated without ability context.
static Register deserialize(java.io.InputStream input)
          Read and return the enum from the given inputstream.
static Register deserialize(int ordinal)
          Read and return the enum from the given inputstream.
 TestOn getTargetable()
          Return the component associated to this register.
 int getValue(Ability ability, Targetable tested, ContextEventListener context, int index)
          Returns the integer value of this expression
 boolean isGlobal()
          Is this register is plugged on a set of targetable component.
 boolean isTargetable()
          Is this register is plugged on a targetable component.
 int ordinal()
          Return the ID of this register.
 void serialize(java.io.OutputStream out)
          Write this enum to the given outputstream.
 java.lang.String toString()
           
static Register valueOfXsd(java.lang.String xsdName)
          Return null of enum value corresponding to the given Xsd name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REGISTER_NAMES

public static final java.lang.String[] REGISTER_NAMES
Accessible register names.
Preserve alphabetical order of this array.


REGISTER_VALUES

public static final int[] REGISTER_VALUES
Accessible register values.
Preserve order of this array to suit to the REGISTER_NAMES's order.

Constructor Detail

Register

public Register(TestOn on)
Create a new instance of this class.

Parameters:
on -

Register

public Register(int ordinal)
Create a new instance of this class.

Parameters:
ordinal -
Method Detail

getValue

public int getValue(Ability ability,
                    Targetable tested,
                    ContextEventListener context,
                    int index)
Returns the integer value of this expression

Parameters:
ability - is the ability owning this test. The card component of this ability should correspond to the card owning this test too.
tested - the tested card
context - is the context attached to this test.
index - the index value access.
Returns:
the integer value of this expression

isTargetable

public boolean isTargetable()
Is this register is plugged on a targetable component.

Returns:
true if this register is plugged on a targetable component.

isGlobal

public boolean isGlobal()
Is this register is plugged on a set of targetable component.

Returns:
true if this register is plugged on a set of targetable component.

serialize

public void serialize(java.io.OutputStream out)
Write this enum to the given outputstream.

Parameters:
out - the stream ths enum would be written.

deserialize

public static Register deserialize(java.io.InputStream input)
                            throws java.io.IOException
Read and return the enum from the given inputstream.

Parameters:
input - the stream containing the enum to read.
Returns:
the enum from the given inputstream.
Throws:
java.io.IOException - If some other I/O error occurs

deserialize

public static Register deserialize(int ordinal)
Read and return the enum from the given inputstream.

Parameters:
ordinal - the key.
Returns:
the enum from the given key.

valueOfXsd

public static Register valueOfXsd(java.lang.String xsdName)
Return null of enum value corresponding to the given Xsd name.

Parameters:
xsdName - the Xsd name of this Register.
Returns:
null of enum value corresponding to the given Xsd name.

ordinal

public int ordinal()
Return the ID of this register.

Returns:
the ID of this register.

getTargetable

public TestOn getTargetable()
Return the component associated to this register. May be null.

Returns:
the component associated to this register. May be null.

canBePreempted

public boolean canBePreempted()
Return true if the associated value can be evaluated without ability context.

Returns:
true if the associated value can be evaluated without ability context.

toString

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


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