org.moock.unity.core.upc
Class UPCMessage

java.lang.Object
  |
  +--org.moock.unity.core.upc.UPCMessage

public class UPCMessage
extends java.lang.Object

UPCMessage is an Object form of a String representing UPC. Use this class for conveniently working with messages sent in UPC format.

Author:
Derek Clayton
See Also:
UPCParser, UPCBuilder

Constructor Summary
UPCMessage()
          Default constructor.
UPCMessage(java.lang.String method)
          Constructs a new UPCMessage with the given method.
 
Method Summary
 void addArg(double arg)
          Add an argument to the args list without specifying as CDATA.
 void addArg(double arg, boolean cdata)
          Add an argument to the args list.
 void addArg(float arg)
          Add an argument to the args list without specifying as CDATA.
 void addArg(float arg, boolean cdata)
          Add an argument to the args list.
 void addArg(int arg)
          Add an argument to the args list without specifying as CDATA.
 void addArg(int arg, boolean cdata)
          Add an argument to the args list.
 void addArg(long arg)
          Add an argument to the args list without specifying as CDATA.
 void addArg(long arg, boolean cdata)
          Add an argument to the args list.
 void addArg(java.lang.String arg)
          Add an argument to the args list without specifying as CDATA.
 void addArg(java.lang.String arg, boolean cdata)
          Add an argument to the args list.
 java.util.ArrayList getArgs(boolean keepCDATA)
          Return an ArrayList containing the Args.
 java.lang.String getArgSource(int i)
          Get the argument source text at index including any CDATA section if applicable.
 java.lang.String getArgText(int i)
          Get the argument text at index.
 java.lang.String getMethod()
          Get the method for the UPC.
 java.lang.String getRoomID()
          Get the method for the UPC.
 void setArgs(java.util.ArrayList args)
          Set the arguments list.
 void setMethod(java.lang.String method)
          Set the method for the UPC.
 void setRoomID(java.lang.String roomID)
          Set the method for the UPC.
 java.lang.String toString()
          Converts this UPCMessage to a String via UPCBuilder
 boolean validate()
          Validates whether the UPCMessage object is valid UPC.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UPCMessage

public UPCMessage()
Default constructor.

UPCMessage

public UPCMessage(java.lang.String method)
Constructs a new UPCMessage with the given method.
Method Detail

setMethod

public void setMethod(java.lang.String method)
Set the method for the UPC.

getMethod

public java.lang.String getMethod()
Get the method for the UPC.

setRoomID

public void setRoomID(java.lang.String roomID)
Set the method for the UPC.

getRoomID

public java.lang.String getRoomID()
Get the method for the UPC.

setArgs

public void setArgs(java.util.ArrayList args)
Set the arguments list.

addArg

public void addArg(int arg)
Add an argument to the args list without specifying as CDATA. Equivalent to addArg(arg, false)

addArg

public void addArg(int arg,
                   boolean cdata)
Add an argument to the args list. If cdata is true then the arg is sent as CDATA when converted to a String. Set to true for any data which may contain &><"'

addArg

public void addArg(float arg)
Add an argument to the args list without specifying as CDATA. Equivalent to addArg(arg, false)

addArg

public void addArg(float arg,
                   boolean cdata)
Add an argument to the args list. If cdata is true then the arg is sent as CDATA when converted to a String. Set to true for any data which may contain &><"'

addArg

public void addArg(long arg)
Add an argument to the args list without specifying as CDATA. Equivalent to addArg(arg, false)

addArg

public void addArg(long arg,
                   boolean cdata)
Add an argument to the args list. If cdata is true then the arg is sent as CDATA when converted to a String. Set to true for any data which may contain &><"'

addArg

public void addArg(double arg)
Add an argument to the args list without specifying as CDATA. Equivalent to addArg(arg, false)

addArg

public void addArg(double arg,
                   boolean cdata)
Add an argument to the args list. If cdata is true then the arg is sent as CDATA when converted to a String. Set to true for any data which may contain &><"'

addArg

public void addArg(java.lang.String arg)
Add an argument to the args list without specifying as CDATA. Equivalent to addArg(arg, false)

addArg

public void addArg(java.lang.String arg,
                   boolean cdata)
Add an argument to the args list. If cdata is true then the arg is sent as CDATA when converted to a String. Set to true for any data which may contain &><"'

getArgText

public java.lang.String getArgText(int i)
Get the argument text at index. Returns null if the argument doesn't exist or is equal to "null".

getArgSource

public java.lang.String getArgSource(int i)
Get the argument source text at index including any CDATA section if applicable. Returns null if the argument doesn't exist or is equal to "null".

getArgs

public java.util.ArrayList getArgs(boolean keepCDATA)
Return an ArrayList containing the Args.
Parameters:
keepCDATA - true if the arg should retain the CDATA text if originally set as CDATA, false if only the text portion should be returned

validate

public boolean validate()
Validates whether the UPCMessage object is valid UPC.
Returns:
true if valid, false otherwise

toString

public java.lang.String toString()
Converts this UPCMessage to a String via UPCBuilder
Overrides:
toString in class java.lang.Object