opendap/src/main/java/opendap/servers/parsers/AST.java
SubClause translate()
        throws DAP2ServerSideException, DAP2Exception,
        NoSuchFunctionException, NoSuchVariableException
    {
        SubClause subclause = null;
        switch (tag) {
        case ExprParserConstants.INTCONST: {
            String s = String.format("%d", intvalue);
            DInt32 i = getFactory().newDInt32(s);
            i.setValue((int) intvalue);
            ((ServerMethods) i).setRead(true);
            ((ServerMethods) i).setProject(true);
            subclause = getClauseFactory().newValueClause(i, false);
        }
        break;
        case ExprParserConstants.FLOATCONST: {
            String s = String.format("%.1f", floatvalue);
            DFloat64 f = getFactory().newDFloat64(s);
            f.setValue(floatvalue);
            subclause = getClauseFactory().newValueClause(f, false);
        }
        break;
        case ExprParserConstants.STRINGCONST: {
            DString s = getFactory().newDString(text);
            s.setValue(text);
            ((ServerMethods) s).setRead(true);
            ((ServerMethods) s).setProject(true);
            subclause = getClauseFactory().newValueClause(s, false);
        }
        break;
        default:
            assert (false);
        }
        return subclause;
    }
SubClause translate()
        throws DAP2ServerSideException, DAP2Exception,
        NoSuchFunctionException, NoSuchVariableException
    {
        SubClause subclause = null;
        switch (tag) {
        case ExprParserConstants.INTCONST: {
            String s = String.format("%d", intvalue);
            DInt32 i = getFactory().newDInt32(s);
            i.setValue((int) intvalue);
            ((ServerMethods) i).setRead(true);
            ((ServerMethods) i).setProject(true);
            subclause = getClauseFactory().newValueClause(i, false);
        }
        break;
        case ExprParserConstants.FLOATCONST: {
            String s = String.format("%.1f", floatvalue);
            DFloat64 f = getFactory().newDFloat64(s);
            f.setValue(floatvalue);
            subclause = getClauseFactory().newValueClause(f, false);
        }
        break;
        case ExprParserConstants.STRINGCONST: {
            DString s = getFactory().newDString(text);
            s.setValue(text);
            ((ServerMethods) s).setRead(true);
            ((ServerMethods) s).setProject(true);
            subclause = getClauseFactory().newValueClause(s, false);
        }
        break;
        default:
            assert (false);
        }
        return subclause;
    }
SubClause translate ( ) throws DAP2ServerSideException , DAP2Exception , NoSuchFunctionException , NoSuchVariableException { SubClause subclause = null ; switch ( tag ) { case ExprParserConstants . INTCONST : { String s = String . format ( "%d" , intvalue ) ; DInt32 i = getFactory ( ) . newDInt32 ( s ) ; i . setValue ( ( int ) intvalue ) ; ( ( ServerMethods ) i ) . setRead ( true ) ; ( ( ServerMethods ) i ) . setProject ( true ) ; subclause = getClauseFactory ( ) . newValueClause ( i , false ) ; } break ; case ExprParserConstants . FLOATCONST : { String s = String . format ( "%.1f" , floatvalue ) ; DFloat64 f = getFactory ( ) . newDFloat64 ( s ) ; f . setValue ( floatvalue ) ; subclause = getClauseFactory ( ) . newValueClause ( f , false ) ; } break ; case ExprParserConstants . STRINGCONST : { DString s = getFactory ( ) . newDString ( text ) ; s . setValue ( text ) ; ( ( ServerMethods ) s ) . setRead ( true ) ; ( ( ServerMethods ) s ) . setProject ( true ) ; subclause = getClauseFactory ( ) . newValueClause ( s , false ) ; } break ; default : assert ( false ) ; } return subclause ; }
/*
public String toString()
{
StringBuilder buf = new StringBuilder();
switch (tag) {
case STRINGCONST:
buf.append(String.format("\"%s\"", text));
break;
case INTCONST:
buf.append(String.format("%d", intvalue));
break;
case FLOATCONST:
buf.append(String.format("%.1f", floatvalue));
break;
default:
assert(false);
}
return buf.toString();
}
/ * public String toString () { StringBuilder buf = new StringBuilder () ; switch ( tag ) { case STRINGCONST : buf . append ( String . format ( \ %s \ text )) ; break ; case INTCONST : buf . append ( String . format ( %d intvalue )) ; break ; case FLOATCONST : buf . append ( String . format ( % . 1f floatvalue )) ; break ; default : assert ( false ) ; } return buf . toString () ; }