/** * Returns true if the node can be coerced to the specified type. */ public boolean canMean( int type ) { return Types.canMean( getMeaning(), type ); }
/** * Returns a description of the node. */ public String getDescription() { return Types.getDescription( getMeaning() ); }
/** * Returns true if the node's meaning matches the specified type. */ public boolean isA( int type ) { return Types.ofType( getMeaning(), type ); }
/** * Returns true if the node's meaning matches any of the specified types. */ public boolean isOneOf( int[] types ) { int meaning = getMeaning(); for( int i = 0; i < types.length; i++ ) { if( Types.ofType(meaning, types[i]) ) { return true; } } return false; }
/** * Returns true if the node's meaning matches all of the specified types. */ public boolean isAllOf( int[] types ) { int meaning = getMeaning(); for( int i = 0; i < types.length; i++ ) { if( !Types.ofType(meaning, types[i]) ) { return false; } } return true; }
/** * Converts a node from a generic type to a specific postfix type. * Throws a <code>GroovyBugError</code> if the type can't be converted. */ public static void makePostfix( CSTNode node, boolean throwIfInvalid ) { switch( node.getMeaning() ) { case PLUS_PLUS: node.setMeaning( POSTFIX_PLUS_PLUS ); break; case MINUS_MINUS: node.setMeaning( POSTFIX_MINUS_MINUS ); break; default: if( throwIfInvalid ) { throw new GroovyBugError( "cannot convert to postfix for type [" + node.getMeaning() + "]" ); } } }
/** * Converts a node from a generic type to a specific prefix type. * Throws a <code>GroovyBugError</code> if the type can't be converted * and requested. */ public static void makePrefix( CSTNode node, boolean throwIfInvalid ) { switch( node.getMeaning() ) { case PLUS: node.setMeaning( PREFIX_PLUS ); break; case MINUS: node.setMeaning( PREFIX_MINUS ); break; case PLUS_PLUS: node.setMeaning( PREFIX_PLUS_PLUS ); break; case MINUS_MINUS: node.setMeaning( PREFIX_MINUS_MINUS ); break; default: if( throwIfInvalid ) { throw new GroovyBugError( "cannot convert to prefix for type [" + node.getMeaning() + "]" ); } } }
/** * Returns a description of the node. */ public String getDescription() { return Types.getDescription( getMeaning() ); }
/** * Returns a description of the node. */ public String getDescription() { return Types.getDescription( getMeaning() ); }
/** * Returns true if the node can be coerced to the specified type. */ public boolean canMean( int type ) { return Types.canMean( getMeaning(), type ); }
/** * Returns true if the node's meaning matches the specified type. */ public boolean isA( int type ) { return Types.ofType( getMeaning(), type ); }
/** * Returns a description of the node. */ public String getDescription() { return Types.getDescription( getMeaning() ); }
/** * Returns true if the node can be coerced to the specified type. */ public boolean canMean( int type ) { return Types.canMean( getMeaning(), type ); }
/** * Returns true if the node's meaning matches the specified type. */ public boolean isA( int type ) { return Types.ofType( getMeaning(), type ); }
/** * Returns true if the node can be coerced to the specified type. */ public boolean canMean( int type ) { return Types.canMean( getMeaning(), type ); }
/** * Returns true if the node's meaning matches the specified type. */ public boolean isA( int type ) { return Types.ofType( getMeaning(), type ); }
/** * Returns a description of the node. */ public String getDescription() { return Types.getDescription( getMeaning() ); }
/** * Returns true if the node's meaning matches the specified type. */ public boolean isA( int type ) { return Types.ofType( getMeaning(), type ); }
/** * Returns true if the node can be coerced to the specified type. */ public boolean canMean( int type ) { return Types.canMean( getMeaning(), type ); }
/** * Returns true if the node's meaning matches any of the specified types. */ public boolean isOneOf( int[] types ) { int meaning = getMeaning(); for( int i = 0; i < types.length; i++ ) { if( Types.ofType(meaning, types[i]) ) { return true; } } return false; }