Class Rename


  • public class Rename
    extends java.lang.Object
    Support for renaming all the variables in an algebra expression. This is primarily in support of renaming variables based on sub-query scope where renaming ?x -> ?/x happens to stop global clashes of scoped usages.

    For syntax-base renaming, see QueryTransformOps and UpdateTransformOps.

    • Constructor Summary

      Constructors 
      Constructor Description
      Rename()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Var chooseVarName​(Var var, java.util.Collection<Var> inUse, java.lang.String prefix)
      Given an old name, and some names already in use, pick a fresh, new name
      static Op renameNode​(Op op, Node oldName, Node newName)
      Rename one node to another
      static Op renameVar​(Op op, Var oldName, Var newName)
      Rename one variable to another
      static Op renameVars​(Op op, java.util.Collection<Var> constants)
      Rename all variables in a pattern, EXCEPT for those named as constant
      static ExprList renameVars​(ExprList exprList, java.util.Set<Var> constants)
      Rename all variables in an expression, EXCEPT for those named as constant
      static Expr renameVars​(Expr expr, java.util.Set<Var> constants)  
      static Op reverseVarRename​(Op op, boolean repeatedly)
      Undo the effect of the rename operation, once or repeatedly.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Rename

        public Rename()
    • Method Detail

      • chooseVarName

        public static Var chooseVarName​(Var var,
                                        java.util.Collection<Var> inUse,
                                        java.lang.String prefix)
        Given an old name, and some names already in use, pick a fresh, new name
      • renameNode

        public static Op renameNode​(Op op,
                                    Node oldName,
                                    Node newName)
        Rename one node to another
      • renameVar

        public static Op renameVar​(Op op,
                                   Var oldName,
                                   Var newName)
        Rename one variable to another
      • renameVars

        public static Op renameVars​(Op op,
                                    java.util.Collection<Var> constants)
        Rename all variables in a pattern, EXCEPT for those named as constant
      • renameVars

        public static ExprList renameVars​(ExprList exprList,
                                          java.util.Set<Var> constants)
        Rename all variables in an expression, EXCEPT for those named as constant
      • renameVars

        public static Expr renameVars​(Expr expr,
                                      java.util.Set<Var> constants)
      • reverseVarRename

        public static Op reverseVarRename​(Op op,
                                          boolean repeatedly)
        Undo the effect of the rename operation, once or repeatedly. This assumes the op was renamed by VarRename.rename