org.objectweb.medor.optim.lib
Class QueryNodeReplacer
java.lang.Object
org.objectweb.medor.optim.lib.QueryNodeReplacer
- public class QueryNodeReplacer
- extends java.lang.Object
This class is an helper class for managing the replacement of a QueryTree in
a medor query represented by another QueryTree.
- Author:
- S.Chassande-Barrioz
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
QueryNodeReplacer
public QueryNodeReplacer()
replaceNode
public QueryTree replaceNode(QueryTree old,
QueryTree neo,
QueryTree root)
- Replace a QueryTree by another. this is doing by replacing the usage of
its field in all tree.
- Parameters:
old
- is the node to replaceneo
- is the new node replacing the oldroot
- is the QueryTree from the search must start.
- Returns:
- if the root queryTree is the one searched, then the newer is
returned, otherwise the root QueryTree is returned.
replaceFields
public void replaceFields(Field[] oldFields,
Field[] neoFields,
Expression exp)
- Replace the references to old field by references to new fields in an
expression (Recusrive method).
- Parameters:
oldFields
- the list of old field to replaceneoFields
- the list of new field replacing the oldexp
- is the current medor expression to treat.