Exemplo n.º 1
0
 /**
  * Gathers all declared variables.
  *
  * @param gs grouping specs
  * @param vs non-grouping variables
  * @return declared variables
  */
 private static Var[] vars(final Spec[] gs, final Var[] vs) {
   final int gl = gs.length, vl = vs.length;
   final Var[] res = new Var[gl + vl];
   for (int g = 0; g < gl; g++) res[g] = gs[g].var;
   System.arraycopy(vs, 0, res, gl, vl);
   return res;
 }
Exemplo n.º 2
0
 /**
  * Constructor.
  *
  * @param specs grouping specs
  * @param pre references to pre-grouping variables
  * @param post post-grouping variables
  * @param info input info
  */
 public GroupBy(final Spec[] specs, final VarRef[] pre, final Var[] post, final InputInfo info) {
   super(info, vars(specs, post));
   this.specs = specs;
   this.post = post;
   preExpr = new Expr[pre.length];
   System.arraycopy(pre, 0, preExpr, 0, pre.length);
   int n = 0;
   for (final Spec spec : specs) if (!spec.occluded) n++;
   nonOcc = n;
 }
Exemplo n.º 3
0
 /**
  * Returns the date in seconds.
  *
  * @return seconds
  */
 final BigDecimal seconds() {
   int z = tz;
   if (z == Short.MAX_VALUE) {
     // [CG] XQuery, DateTime: may be removed
     final long n = System.currentTimeMillis();
     z = Calendar.getInstance().getTimeZone().getOffset(n) / 60000;
   }
   return (sec == null ? BigDecimal.ZERO : sec)
       .add(BigDecimal.valueOf(Math.max(0, hou) * 3600 + Math.max(0, min) * 60 - z * 60));
 }
Exemplo n.º 4
0
 /**
  * Copies the children array. This is faster than {@code kids.clone()} according to <a
  * href="http://www.javaspecialists.eu/archive/Issue124.html">Heinz M. Kabutz</a>.
  *
  * @return copy of the child array
  */
 TrieNode[] copyKids() {
   final TrieNode[] copy = new TrieNode[KIDS];
   System.arraycopy(kids, 0, copy, 0, KIDS);
   return copy;
 }