Cisco Systems, Inc.

com.pcube.apps.engage.policy
Class RuleArray

java.lang.Object
  extended by com.pcube.apps.engage.policy.RuleArray
All Implemented Interfaces:
Formattable, java.io.Serializable, java.lang.Cloneable

public class RuleArray
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable, Formattable

An array of Rules, as kept in the ServiceRule.

See Also:
ServiceRule, Rule, Serialized Form

Method Summary
 boolean add(Rule item)
          Adds a Rule to this RuleArray.
 java.lang.Object clone()
          Produces an identical object to this object.
 boolean contains(Rule item)
          Checks if the Rule is in this RuleArray.
 boolean contains(java.lang.String item)
          Checks if a Rule bearing the specific name is in this RuleArray.
 void fromStream(java.io.BufferedReader in, Formatter f)
          Method fromStream
 Rule getAt(int index)
          Gets the Rule in this RuleArray in the specific index.
 int getIndexOfItem(java.lang.String item)
          Gets the index of the Rule bearing the specific name in this RuleArray.
 Rule getRule(java.lang.String ruleName)
          Gets the Rule from this RuleArray by the Rule's name.
 int getSize()
          Gets the size of the RuleArray
 void remove(int index)
          Removes the Rule from a certain index in this RuleArray.
 boolean remove(java.lang.String ruleName)
          Removes the Rule bearing a specific name from this RuleArray.
 void setValueFrom(RuleArray other)
          Sets this RuleArray parameters to resemble the other RuleArray
 void toStream(java.io.PrintStream out, Formatter f)
          Method toStream
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

add

public boolean add(Rule item)
Adds a Rule to this RuleArray.

Parameters:
item - the Rule to add
Returns:
true if succeeded, false otherwise

clone

public java.lang.Object clone()
Produces an identical object to this object.

Overrides:
clone in class java.lang.Object
Returns:
a newly alocated object similar to this object.

contains

public boolean contains(Rule item)
Checks if the Rule is in this RuleArray.

Parameters:
item - the queried Rule
Returns:
true if found, false otherwise

contains

public boolean contains(java.lang.String item)
Checks if a Rule bearing the specific name is in this RuleArray.

Parameters:
item - the desired Rule name
Returns:
true if found, false otherwise

fromStream

public void fromStream(java.io.BufferedReader in,
                       Formatter f)
                throws ImportExportException
Description copied from interface: Formattable
Method fromStream

Specified by:
fromStream in interface Formattable
Throws:
ImportExportException
See Also:
Formattable.fromStream(java.io.BufferedReader, com.pcube.apps.engage.common.Formatter)

getAt

public Rule getAt(int index)
Gets the Rule in this RuleArray in the specific index.

Parameters:
index - the index of the Rule in the RuleArray
Returns:
the Rule
Throws:
ItemNotFoundException - if the index is out of bound

getIndexOfItem

public int getIndexOfItem(java.lang.String item)
Gets the index of the Rule bearing the specific name in this RuleArray.

Parameters:
item - the desired Rule name
Returns:
the Rule's index if in RuleArray, -1 otherwise

getRule

public Rule getRule(java.lang.String ruleName)
             throws ItemNotFoundException
Gets the Rule from this RuleArray by the Rule's name.

Parameters:
ruleName - the desired Rule's name
Returns:
the Rule
Throws:
ItemNotFoundException - if the Rule is not found in this RuleArray

getSize

public int getSize()
Gets the size of the RuleArray

Returns:
the array's size

remove

public void remove(int index)
            throws ItemNotFoundException
Removes the Rule from a certain index in this RuleArray.

Parameters:
index - the index of the removed Rule
Throws:
ItemNotFoundException - if there is no Rule in that index (IndexOutOfBound)

remove

public boolean remove(java.lang.String ruleName)
               throws ItemNotFoundException
Removes the Rule bearing a specific name from this RuleArray.

Parameters:
ruleName - the removed Rule's name
Returns:
true if removal succeeded, false otherwise
Throws:
ItemNotFoundException - if a Rule bearing such a name does not exist in this RuleArray

setValueFrom

public void setValueFrom(RuleArray other)
                  throws java.lang.CloneNotSupportedException
Sets this RuleArray parameters to resemble the other RuleArray

Parameters:
other - the RuleArray this RuleArray gets the paremeters
Throws:
java.lang.CloneNotSupportedException

toStream

public void toStream(java.io.PrintStream out,
                     Formatter f)
Description copied from interface: Formattable
Method toStream

Specified by:
toStream in interface Formattable
See Also:
Formattable.toStream(java.io.PrintStream, com.pcube.apps.engage.common.Formatter)

Cisco Systems, Inc.

Copyright © 2013 Cisco Systems, Inc. Confidential.