Cisco Systems, Inc.

com.pcube.apps.engage.policy
Class ServiceRuleArray

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

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

An array of ServiceRules held by the Package. This array combines the time based regulations for the Package .
The ServiceRuleArray and its elements belong to a Policy, which admits validation limitations on them, such as the existance of the Servcies the Rules apply to.

See Also:
Serialized Form

Constructor Summary
ServiceRuleArray(com.pcube.apps.engage.policy.Rule.RuleResourceProvider resourceProvider)
          ServiceRuleArray Constructor.
 
Method Summary
 boolean add(ServiceRule item)
          Adds a new ServiceRule to this list.
 java.lang.Object clone()
          Producing an identical object to this object.
 boolean contains(ServiceRule item)
          Checks if a certain ServiceRule exists in this list.
 boolean contains(java.lang.String item)
          Checks if a certain ServiceRule exists in this list.
 void fromStream(java.io.BufferedReader in, Formatter f)
          Method fromStream
 ServiceRule getAt(int index)
          Gets the ServiceRule this list has in a specific index.
 int getIndexOfItem(java.lang.String item)
          Gets the index of the ServiceRule in this list which has a specific name.
 ServiceRule getServiceRule(java.lang.String serviceRuleName)
          Gets the ServiceRule that has a specific name from this list.
 int getSize()
          Gets the size of this list.
 java.util.Iterator iterator()
           
 java.util.ListIterator listIterator()
           
 void remove(int index)
          Removes the ServiceRule, which is in a specific index in this list.
 void remove(int index, Package pkg)
           
 boolean remove(java.lang.String item)
          Removes the ServiceRule, which has a specific name, from this list.
 boolean remove(java.lang.String item, Package pack)
           
 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
 

Constructor Detail

ServiceRuleArray

public ServiceRuleArray(com.pcube.apps.engage.policy.Rule.RuleResourceProvider resourceProvider)
ServiceRuleArray Constructor.

Parameters:
policy - the Policy this ServiceRuleArray belongs to
Method Detail

add

public boolean add(ServiceRule item)
            throws DuplicateItemException,
                   ItemNotFoundException
Adds a new ServiceRule to this list.

Parameters:
item - the added ServiceRule
Returns:
true if added, false otherwise
Throws:
DuplicateItemException - if such an ServiceRule already exists in this list
ItemNotFoundException

clone

public java.lang.Object clone()
Producing 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(ServiceRule item)
Checks if a certain ServiceRule exists in this list.

Parameters:
item - the queried ServiceRule
Returns:
true if exists, false otherwise

contains

public boolean contains(java.lang.String item)
Checks if a certain ServiceRule exists in this list.

Parameters:
item - the ServiceRule's name
Returns:
true if exists, 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 ServiceRule getAt(int index)
Gets the ServiceRule this list has in a specific index.

Parameters:
index - the index of the desired ServiceRule
Returns:
the HostLIstItem
Throws:
ItemNotFoundException - if no ServiceRule exists in the desired index

getIndexOfItem

public int getIndexOfItem(java.lang.String item)
Gets the index of the ServiceRule in this list which has a specific name.

Parameters:
item - the desired ServiceRule's name
Returns:
the ServiceRule's index if exists, -1 otherwise

getServiceRule

public ServiceRule getServiceRule(java.lang.String serviceRuleName)
                           throws ItemNotFoundException
Gets the ServiceRule that has a specific name from this list.

Parameters:
serviceRuleName - the name of the desired ServiceRule
Returns:
the HostLIstItem
Throws:
ItemNotFoundException - if no ServiceRule exists in the desired index

getSize

public int getSize()
Gets the size of this list.

Returns:
this list's size

iterator

public java.util.Iterator iterator()
Returns:

listIterator

public java.util.ListIterator listIterator()
Returns:

remove

public void remove(int index)
            throws ItemNotFoundException
Removes the ServiceRule, which is in a specific index in this list.

Parameters:
index - the index of the removed ServiceRule in this list
Throws:
ItemNotFoundException - if this list has no ServiceRule in the desired index

remove

public boolean remove(java.lang.String item)
               throws ItemNotFoundException
Removes the ServiceRule, which has a specific name, from this list.

Parameters:
item - the host of the removed ServiceRule
Returns:
true if removal succeeded, false otherwise
Throws:
ItemNotFoundException - if this list has no ServiceRule with the desired values

remove

public void remove(int index,
                   Package pkg)
            throws ItemNotFoundException
Throws:
ItemNotFoundException

remove

public boolean remove(java.lang.String item,
                      Package pack)
               throws ItemNotFoundException
Throws:
ItemNotFoundException

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.