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.
- S.Chassande-Barrioz
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).
oldFields
- the list of old field to replaceneoFields
- the list of new field replacing the oldexp
- is the current medor expression to treat.
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.
old
- is the node to replaceneo
- is the new node replacing the oldroot
- is the QueryTree from the search must start.
- if the root queryTree is the one searched, then the newer is
returned, otherwise the root QueryTree is returned.