Beispiel #1
0
 public void sequence(DapSequence seq) throws DapException {
   List<DapVariable> fields = seq.getFields();
   Odometer odom = null;
   if (seq.getRank() == 0) { // scalar
     odom = new ScalarOdometer();
   } else { // dimensioned
     List<Slice> slices = ce.getConstrainedSlices(seq);
     odom = Odometer.factory(slices, seq.getDimensions(), false);
   }
   try {
     while (odom.hasNext()) {
       // Decide how many rows for this sequence
       int nrows = (rowcount == 0 ? this.values.nextCount(MAXROWS) : rowcount);
       writer.writeObject(DapType.INT64, (long) nrows);
       for (int i = 0; i < nrows; i++) {
         for (int j = 0; j < fields.size(); j++) {
           DapVariable field = fields.get(j);
           variable(field);
         }
       }
       odom.next();
     }
   } catch (IOException ioe) {
     throw new DapException(ioe);
   }
 }
 protected static Object fieldValue(DapSequence seq, DataRecord record, String field)
     throws DapException {
   DapVariable dapv = seq.findByName(field);
   if (dapv == null) throw new DapException("Unknown variable in filter: " + field);
   if (dapv.getSort() != DapSort.ATOMICVARIABLE)
     throw new DapException("Non-atomic variable in filter: " + field);
   if (dapv.getRank() > 0) throw new DapException("Non-scalar variable in filter: " + field);
   DataAtomic da = (DataAtomic) (record.readfield(field));
   if (da == null) throw new DapException("No such field: " + field);
   return da.read(0);
 }