dap4/d4cdm/src/main/java/dap4/cdm/dsp/CDMCursor.java
@Override
    public Object
    read(List<Slice> slices)
            throws DapException
    {
        switch (this.scheme) {
        case ATOMIC:
            return readAtomic(slices);
        case STRUCTURE:
            if(((DapVariable) this.getTemplate()).getRank() > 0
                    || DapUtil.isScalarSlices(slices))
                throw new DapException("Cannot slice a scalar variable");
            CDMCursor[] instances = new CDMCursor[1];
            instances[0] = this;
            return instances;
        case SEQUENCE:
            if(((DapVariable) this.getTemplate()).getRank() > 0
                    || DapUtil.isScalarSlices(slices))
                throw new DapException("Cannot slice a scalar variable");
            instances = new CDMCursor[1];
            instances[0] = this;
            return instances;
        case STRUCTARRAY:
            Odometer odom = Odometer.factory(slices);
            instances = new CDMCursor[(int) odom.totalSize()];
            for(int i = 0; odom.hasNext(); i++) {
                instances[i] = readStructure(odom.next());
            }
            return instances;
        case SEQARRAY:
            instances = readSequence(slices);
            return instances;
        default:
            throw new DapException("Attempt to slice a scalar object");
        }
    }
@Override
    public Object
    read(List<Slice> slices)
            throws DapException
    {
        switch (this.scheme) {
        case ATOMIC:
            return readAtomic(slices);
        case STRUCTURE:
            if(((DapVariable) this.getTemplate()).getRank() > 0
                    || DapUtil.isScalarSlices(slices))
                throw new DapException("Cannot slice a scalar variable");
            CDMCursor[] instances = new CDMCursor[1];
            instances[0] = this;
            return instances;
        case SEQUENCE:
            if(((DapVariable) this.getTemplate()).getRank() > 0
                    || DapUtil.isScalarSlices(slices))
                throw new DapException("Cannot slice a scalar variable");
            instances = new CDMCursor[1];
            instances[0] = this;
            return instances;
        case STRUCTARRAY:
            Odometer odom = Odometer.factory(slices);
            instances = new CDMCursor[(int) odom.totalSize()];
            for(int i = 0; odom.hasNext(); i++) {
                instances[i] = readStructure(odom.next());
            }
            return instances;
        case SEQARRAY:
            instances = readSequence(slices);
            return instances;
        default:
            throw new DapException("Attempt to slice a scalar object");
        }
    }
@ Override public Object read ( List < Slice > slices ) throws DapException { switch ( this . scheme ) { case ATOMIC : return readAtomic ( slices ) ; case STRUCTURE : if ( ( ( DapVariable ) this . getTemplate ( ) ) . getRank ( ) > 0 || DapUtil . isScalarSlices ( slices ) ) throw new DapException ( "Cannot slice a scalar variable" ) ; CDMCursor [ ] instances = new CDMCursor [ 1 ] ; instances [ 0 ] = this ; return instances ; case SEQUENCE : if ( ( ( DapVariable ) this . getTemplate ( ) ) . getRank ( ) > 0 || DapUtil . isScalarSlices ( slices ) ) throw new DapException ( "Cannot slice a scalar variable" ) ; instances = new CDMCursor [ 1 ] ; instances [ 0 ] = this ; return instances ; case STRUCTARRAY : Odometer odom = Odometer . factory ( slices ) ; instances = new CDMCursor [ ( int ) odom . totalSize ( ) ] ; for ( int i = 0 ; odom . hasNext ( ) ; i ++ ) { instances [ i ] = readStructure ( odom . next ( ) ) ; } return instances ; case SEQARRAY : instances = readSequence ( slices ) ; return instances ; default : throw new DapException ( "Attempt to slice a scalar object" ) ; } }
AbstractCursor Abstract Methods
AbstractCursor Abstract Methods