org.apache.directory.api.util
Class MandatoryAndOptionalComponentsMonitor

java.lang.Object
  extended by org.apache.directory.api.util.MandatoryAndOptionalComponentsMonitor
All Implemented Interfaces:
ComponentsMonitor

public class MandatoryAndOptionalComponentsMonitor
extends Object
implements ComponentsMonitor

A monitor that tracks both, mandatory and optional components.

Author:
Apache Directory Project

Constructor Summary
MandatoryAndOptionalComponentsMonitor(String[] mandatoryComponents, String[] optionalComponents)
          Instantiates a new mandatory and optional components monitor.
 
Method Summary
 boolean allComponentsUsed()
          Check if all components are used.
 boolean finalStateValid()
          Checks if the final state is valid.
 List<String> getRemainingComponents()
          Gets the remaining components.
 ComponentsMonitor useComponent(String component)
          Use a component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MandatoryAndOptionalComponentsMonitor

public MandatoryAndOptionalComponentsMonitor(String[] mandatoryComponents,
                                             String[] optionalComponents)
                                      throws IllegalArgumentException
Instantiates a new mandatory and optional components monitor. The mandatory and optional components must be disjunct.

Parameters:
mandatoryComponents - the mandatory components
optionalComponents - the optional components
Throws:
IllegalArgumentException - if the same component is defined as mandatory and optional
Method Detail

useComponent

public ComponentsMonitor useComponent(String component)
Use a component.

Specified by:
useComponent in interface ComponentsMonitor
Parameters:
component - the component
Returns:
this components monitor

allComponentsUsed

public boolean allComponentsUsed()
Check if all components are used.

Specified by:
allComponentsUsed in interface ComponentsMonitor
Returns:
true if all components are used

finalStateValid

public boolean finalStateValid()
Checks if the final state is valid. That depends whether the components are mandatory or optional.

Specified by:
finalStateValid in interface ComponentsMonitor
Returns:
true if the final state is valid

getRemainingComponents

public List<String> getRemainingComponents()
Gets the remaining components.

Specified by:
getRemainingComponents in interface ComponentsMonitor
Returns:
the remaining components


Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.