Esempio n. 1
0
 /** This method returns new AttributeList by replacing all source names with a new source name. */
 public AttributeList renameAllSourceNames(String to) {
   AttributeList rval = copy();
   for (int i = 0; i < rval.attr.size(); i++) {
     if (rval.isAttribute(i)) {
       Attribute a = rval.getAttribute(i);
       rval.attr.set(i, new Attribute(to, a.getColumnName()));
     } else if (rval.isFunction(i)) {
       FunctionParameter f = rval.getFunction(i);
       AttributeList args = f.getArguments().renameAllSourceNames(to);
       rval.attr.set(i, new FunctionParameter(f.getFunctionName(), args));
     }
   }
   return rval;
 }
Esempio n. 2
0
 /** This method returns new AttributeList by replaceing given column name with new column name. */
 public AttributeList renameColumnName(String from, String to) {
   AttributeList rval = copy();
   if (from == null || to == null || from.equals(to)) return rval;
   for (int i = 0; i < rval.attr.size(); i++) {
     if (rval.isAttribute(i)) {
       Attribute a = rval.getAttribute(i);
       if (a.getColumnName().equals(from)) rval.attr.set(i, new Attribute(a.getSourceName(), to));
     } else if (rval.isFunction(i)) {
       FunctionParameter f = rval.getFunction(i);
       AttributeList args = f.getArguments().renameColumnName(from, to);
       rval.attr.set(i, new FunctionParameter(f.getFunctionName(), args));
     }
   }
   return rval;
 }