sk.uniba.euromath.document.schema.impl
Class ExpressionCloner

java.lang.Object
  extended by sk.uniba.euromath.document.schema.impl.ExpressionCloner
Direct Known Subclasses:
GrammarRulesModifier

public abstract class ExpressionCloner
extends Object

Clones an expression. Descending classes must implement the cloneElement and cloneAttribute methods to ensure correct cloning. All ReferenceExp s and OtherExp s are replaced by their contents and thus not cloned themselves.

Author:
Martin Vysny

Constructor Summary
ExpressionCloner(com.sun.msv.grammar.ExpressionPool oldPool, com.sun.msv.grammar.ExpressionPool newPool)
          Constructs new instance of cloner.
 
Method Summary
 com.sun.msv.grammar.Expression clone(com.sun.msv.grammar.Expression exp)
          Clones the expression.
protected abstract  com.sun.msv.grammar.Expression cloneAttribute(com.sun.msv.grammar.AttributeExp exp, com.sun.msv.grammar.Expression clonedContent)
          Returns clone of this attribute expression.
protected abstract  com.sun.msv.grammar.Expression cloneElement(com.sun.msv.grammar.ElementExp exp)
          Returns clone of this element expression.
protected  com.sun.msv.grammar.ExpressionPool getPool()
          Returns the pool, where new expressions are placed.
protected abstract  void setContentModel(com.sun.msv.grammar.ElementExp exp, com.sun.msv.grammar.Expression contentModel)
          Sets content model of given element expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExpressionCloner

public ExpressionCloner(com.sun.msv.grammar.ExpressionPool oldPool,
                        com.sun.msv.grammar.ExpressionPool newPool)
Constructs new instance of cloner.

Parameters:
newPool - the expression pool, where cloned expressions are to be placed.
oldPool - expression pool, to which the expressions to clone should belong.
Method Detail

getPool

protected final com.sun.msv.grammar.ExpressionPool getPool()
Returns the pool, where new expressions are placed.

Returns:
the expression pool.

clone

public final com.sun.msv.grammar.Expression clone(com.sun.msv.grammar.Expression exp)
Clones the expression. Given expression must be from given old pool.

Parameters:
exp - expression to be cloned.
Returns:
Cloned expression.

cloneElement

protected abstract com.sun.msv.grammar.Expression cloneElement(com.sun.msv.grammar.ElementExp exp)
Returns clone of this element expression. Content is replaced later, so for now, you may set it to getPool().createEpsilon().

Parameters:
exp - Element expression to clone.
Returns:
Cloned element expression.

cloneAttribute

protected abstract com.sun.msv.grammar.Expression cloneAttribute(com.sun.msv.grammar.AttributeExp exp,
                                                                 com.sun.msv.grammar.Expression clonedContent)
Returns clone of this attribute expression. Suggested cloned content model is given.

Parameters:
exp - attribute expression to clone.
clonedContent - cloned content model.
Returns:
cloned attribute expression.

setContentModel

protected abstract void setContentModel(com.sun.msv.grammar.ElementExp exp,
                                        com.sun.msv.grammar.Expression contentModel)
Sets content model of given element expression.

Parameters:
exp - element expression
contentModel - cloned content model, that must be set to given element exp.


Copyright © 2003-2006 null. All Rights Reserved.