com.oxygenxml.validate.nvdl
Class ModeUsage

java.lang.Object
  extended by com.oxygenxml.validate.nvdl.ModeUsage

 class ModeUsage
extends Object

Stores mode usage information.


Field Summary
private  int attributeProcessing
           
(package private)  Mode currentMode
          The current mode used until now.
private  Mode mode
          The use mode.
private  ContextMap modeMap
          Modes depending on context.
 
Constructor Summary
(package private) ModeUsage(Mode mode, Mode currentMode)
          Creates a use mode.
private ModeUsage(Mode mode, Mode currentMode, ContextMap modeMap)
          Creates a use mode.
 
Method Summary
(package private)  boolean addContext(boolean isRoot, Vector names, Mode mode)
          Adds a new context (isRoot, path --> mode).
(package private)  ModeUsage changeCurrentMode(Mode currentMode)
          Gets a new mode usage with a different current mode but with the same mode and modeMap as this one.
 boolean equals(Object obj)
          Check to see if this mode usage is equals with another mode usage.
(package private)  int getAttributeProcessing()
          Get the maximum attribute processing value from the default mode and from all the modes specified in the contexts.
(package private)  Mode getMode(Vector context)
          Get the mode to be used for a specific context.
 int hashCode()
          Gets a hash code for this mode usage.
(package private)  boolean isContextDependent()
          Check if we have context dependent modes.
private  Mode resolve(Mode mode)
          Resolves the Mode.CURRENT to the currentMode for this mode usage.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mode

private Mode mode
The use mode.


currentMode

final Mode currentMode
The current mode used until now.


modeMap

private ContextMap modeMap
Modes depending on context.


attributeProcessing

private int attributeProcessing
Constructor Detail

ModeUsage

ModeUsage(Mode mode,
          Mode currentMode)
Creates a use mode.

Parameters:
mode - The mode to be used.
currentMode - The mode used until the new mode.

ModeUsage

private ModeUsage(Mode mode,
                  Mode currentMode,
                  ContextMap modeMap)
Creates a use mode.

Parameters:
mode - The mode to be used.
currentMode - The mode used until now.
modeMap - Modes to be used depending on context.
Method Detail

changeCurrentMode

ModeUsage changeCurrentMode(Mode currentMode)
Gets a new mode usage with a different current mode but with the same mode and modeMap as this one.

Parameters:
currentMode - The new current mode.
Returns:
A new mode usage with the changed current mode.

equals

public boolean equals(Object obj)
Check to see if this mode usage is equals with another mode usage.

Overrides:
equals in class Object

hashCode

public int hashCode()
Gets a hash code for this mode usage.

Overrides:
hashCode in class Object

resolve

private Mode resolve(Mode mode)
Resolves the Mode.CURRENT to the currentMode for this mode usage. If not Mode.CURRENT passed as argument then the same mode is returned.

Parameters:
mode - The mode to be resolved.
Returns:
Either the current mode mode usage or the same mode passed as argument.

getAttributeProcessing

int getAttributeProcessing()
Get the maximum attribute processing value from the default mode and from all the modes specified in the contexts.

Returns:
The attribute processing value.

isContextDependent

boolean isContextDependent()
Check if we have context dependent modes.

Returns:
true if the modeMap exists.

getMode

Mode getMode(Vector context)
Get the mode to be used for a specific context.

Parameters:
context - The current context.
Returns:
A mode.

addContext

boolean addContext(boolean isRoot,
                   Vector names,
                   Mode mode)
Adds a new context (isRoot, path --> mode).

Parameters:
isRoot - Flag indicating that the path starts or not with /
names - The local names that form the path.
mode - The mode for this path.
Returns:
true if we do not have a duplicate path.