Java 类org.eclipse.jdt.internal.compiler.ast.FalseLiteral 实例源码

项目:lombok-ianchiu    文件:HandleBuilder.java   
private MethodDeclaration generateCleanMethod(List<BuilderFieldData> builderFields, EclipseNode builderType, ASTNode source) {
    List<Statement> statements = new ArrayList<Statement>();

    for (BuilderFieldData bfd : builderFields) {
        if (bfd.singularData != null && bfd.singularData.getSingularizer() != null) {
            bfd.singularData.getSingularizer().appendCleaningCode(bfd.singularData, builderType, statements);
        }
    }

    FieldReference thisUnclean = new FieldReference(CLEAN_FIELD_NAME, 0);
    thisUnclean.receiver = new ThisReference(0, 0);
    statements.add(new Assignment(thisUnclean, new FalseLiteral(0, 0), 0));
    MethodDeclaration decl = new MethodDeclaration(((CompilationUnitDeclaration) builderType.top().get()).compilationResult);
    decl.selector = CLEAN_METHOD_NAME;
    decl.modifiers = ClassFileConstants.AccPrivate;
    decl.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
    decl.returnType = TypeReference.baseTypeReference(TypeIds.T_void, 0);
    decl.statements = statements.toArray(new Statement[0]);
    decl.traverse(new SetGeneratedByVisitor(source), (ClassScope) null);
    return decl;
}
项目:lombok-ianchiu    文件:HandleEqualsAndHashCode.java   
public IfStatement generateCompareFloatOrDouble(Expression thisRef, Expression otherRef, char[] floatOrDouble, ASTNode source) {
    int pS = source.sourceStart, pE = source.sourceEnd;
    /* if (Float.compare(fieldName, other.fieldName) != 0) return false */
    MessageSend floatCompare = new MessageSend();
    floatCompare.sourceStart = pS; floatCompare.sourceEnd = pE;
    setGeneratedBy(floatCompare, source);
    floatCompare.receiver = generateQualifiedNameRef(source, TypeConstants.JAVA, TypeConstants.LANG, floatOrDouble);
    floatCompare.selector = "compare".toCharArray();
    floatCompare.arguments = new Expression[] {thisRef, otherRef};
    IntLiteral int0 = makeIntLiteral("0".toCharArray(), source);
    EqualExpression ifFloatCompareIsNot0 = new EqualExpression(floatCompare, int0, OperatorIds.NOT_EQUAL);
    ifFloatCompareIsNot0.sourceStart = pS; ifFloatCompareIsNot0.sourceEnd = pE;
    setGeneratedBy(ifFloatCompareIsNot0, source);
    FalseLiteral falseLiteral = new FalseLiteral(pS, pE);
    setGeneratedBy(falseLiteral, source);
    ReturnStatement returnFalse = new ReturnStatement(falseLiteral, pS, pE);
    setGeneratedBy(returnFalse, source);
    IfStatement ifStatement = new IfStatement(ifFloatCompareIsNot0, returnFalse, pS, pE);
    setGeneratedBy(ifStatement, source);
    return ifStatement;
}
项目:EasyMPermission    文件:HandleBuilder.java   
private MethodDeclaration generateCleanMethod(List<BuilderFieldData> builderFields, EclipseNode builderType, ASTNode source) {
    List<Statement> statements = new ArrayList<Statement>();

    for (BuilderFieldData bfd : builderFields) {
        if (bfd.singularData != null && bfd.singularData.getSingularizer() != null) {
            bfd.singularData.getSingularizer().appendCleaningCode(bfd.singularData, builderType, statements);
        }
    }

    FieldReference thisUnclean = new FieldReference(CLEAN_FIELD_NAME, 0);
    thisUnclean.receiver = new ThisReference(0, 0);
    statements.add(new Assignment(thisUnclean, new FalseLiteral(0, 0), 0));
    MethodDeclaration decl = new MethodDeclaration(((CompilationUnitDeclaration) builderType.top().get()).compilationResult);
    decl.selector = CLEAN_METHOD_NAME;
    decl.modifiers = ClassFileConstants.AccPrivate;
    decl.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
    decl.returnType = TypeReference.baseTypeReference(TypeIds.T_void, 0);
    decl.statements = statements.toArray(new Statement[0]);
    decl.traverse(new SetGeneratedByVisitor(source), (ClassScope) null);
    return decl;
}
项目:EasyMPermission    文件:HandleEqualsAndHashCode.java   
public IfStatement generateCompareFloatOrDouble(Expression thisRef, Expression otherRef, char[] floatOrDouble, ASTNode source) {
    int pS = source.sourceStart, pE = source.sourceEnd;
    /* if (Float.compare(fieldName, other.fieldName) != 0) return false */
    MessageSend floatCompare = new MessageSend();
    floatCompare.sourceStart = pS; floatCompare.sourceEnd = pE;
    setGeneratedBy(floatCompare, source);
    floatCompare.receiver = generateQualifiedNameRef(source, TypeConstants.JAVA, TypeConstants.LANG, floatOrDouble);
    floatCompare.selector = "compare".toCharArray();
    floatCompare.arguments = new Expression[] {thisRef, otherRef};
    IntLiteral int0 = makeIntLiteral("0".toCharArray(), source);
    EqualExpression ifFloatCompareIsNot0 = new EqualExpression(floatCompare, int0, OperatorIds.NOT_EQUAL);
    ifFloatCompareIsNot0.sourceStart = pS; ifFloatCompareIsNot0.sourceEnd = pE;
    setGeneratedBy(ifFloatCompareIsNot0, source);
    FalseLiteral falseLiteral = new FalseLiteral(pS, pE);
    setGeneratedBy(falseLiteral, source);
    ReturnStatement returnFalse = new ReturnStatement(falseLiteral, pS, pE);
    setGeneratedBy(returnFalse, source);
    IfStatement ifStatement = new IfStatement(ifFloatCompareIsNot0, returnFalse, pS, pE);
    setGeneratedBy(ifStatement, source);
    return ifStatement;
}
项目:lombok    文件:HandleEqualsAndHashCode.java   
private IfStatement generateCompareFloatOrDouble(Expression thisRef, Expression otherRef, char[] floatOrDouble, ASTNode source) {
    int pS = source.sourceStart, pE = source.sourceEnd;
    /* if (Float.compare(fieldName, other.fieldName) != 0) return false */
    MessageSend floatCompare = new MessageSend();
    floatCompare.sourceStart = pS; floatCompare.sourceEnd = pE;
    setGeneratedBy(floatCompare, source);
    floatCompare.receiver = generateQualifiedNameRef(source, TypeConstants.JAVA, TypeConstants.LANG, floatOrDouble);
    floatCompare.selector = "compare".toCharArray();
    floatCompare.arguments = new Expression[] {thisRef, otherRef};
    IntLiteral int0 = makeIntLiteral("0".toCharArray(), source);
    EqualExpression ifFloatCompareIsNot0 = new EqualExpression(floatCompare, int0, OperatorIds.NOT_EQUAL);
    ifFloatCompareIsNot0.sourceStart = pS; ifFloatCompareIsNot0.sourceEnd = pE;
    setGeneratedBy(ifFloatCompareIsNot0, source);
    FalseLiteral falseLiteral = new FalseLiteral(pS, pE);
    setGeneratedBy(falseLiteral, source);
    ReturnStatement returnFalse = new ReturnStatement(falseLiteral, pS, pE);
    setGeneratedBy(returnFalse, source);
    IfStatement ifStatement = new IfStatement(ifFloatCompareIsNot0, returnFalse, pS, pE);
    setGeneratedBy(ifStatement, source);
    return ifStatement;
}
项目:lombok-ianchiu    文件:HandleConstructor.java   
private static Expression getDefaultExpr(TypeReference type, int s, int e) {
    char[] lastToken = type.getLastToken();
    if (Arrays.equals(TypeConstants.BOOLEAN, lastToken)) return new FalseLiteral(s, e);
    if (Arrays.equals(TypeConstants.CHAR, lastToken)) return new CharLiteral(new char[] {'\'', '\\', '0', '\''}, s, e);
    if (Arrays.equals(TypeConstants.BYTE, lastToken) || Arrays.equals(TypeConstants.SHORT, lastToken) ||
        Arrays.equals(TypeConstants.INT, lastToken)) return IntLiteral.buildIntLiteral(new char[] {'0'}, s, e);
    if (Arrays.equals(TypeConstants.LONG, lastToken)) return LongLiteral.buildLongLiteral(new char[] {'0',  'L'}, s, e);
    if (Arrays.equals(TypeConstants.FLOAT, lastToken)) return new FloatLiteral(new char[] {'0', 'F'}, s, e);
    if (Arrays.equals(TypeConstants.DOUBLE, lastToken)) return new DoubleLiteral(new char[] {'0', 'D'}, s, e);

    return new NullLiteral(s, e);
}
项目:Eclipse-Postfix-Code-Completion    文件:CodeFormatterVisitor.java   
/**
 * @see org.eclipse.jdt.internal.compiler.ASTVisitor#visit(org.eclipse.jdt.internal.compiler.ast.FalseLiteral, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
 */
public boolean visit(FalseLiteral falseLiteral, BlockScope scope) {

    final int numberOfParens = (falseLiteral.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
    if (numberOfParens > 0) {
        manageOpeningParenthesizedExpression(falseLiteral, numberOfParens);
    }
    this.scribe.printNextToken(TerminalTokens.TokenNamefalse);

    if (numberOfParens > 0) {
        manageClosingParenthesizedExpression(falseLiteral, numberOfParens);
    }
    return false;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:CodeFormatterVisitor.java   
/**
 * @see org.eclipse.jdt.internal.compiler.ASTVisitor#visit(org.eclipse.jdt.internal.compiler.ast.FalseLiteral, org.eclipse.jdt.internal.compiler.lookup.BlockScope)
 */
public boolean visit(FalseLiteral falseLiteral, BlockScope scope) {

    final int numberOfParens = (falseLiteral.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
    if (numberOfParens > 0) {
        manageOpeningParenthesizedExpression(falseLiteral, numberOfParens);
    }
    this.scribe.printNextToken(TerminalTokens.TokenNamefalse);

    if (numberOfParens > 0) {
        manageClosingParenthesizedExpression(falseLiteral, numberOfParens);
    }
    return false;
}
项目:lombok-ianchiu    文件:HandleBuilder.java   
private static final boolean toBoolean(Object expr, boolean defaultValue) {
    if (expr == null) return defaultValue;
    if (expr instanceof FalseLiteral) return false;
    if (expr instanceof TrueLiteral) return true;
    return ((Boolean) expr).booleanValue();
}
项目:lombok-ianchiu    文件:SetGeneratedByVisitor.java   
@Override public boolean visit(FalseLiteral node, BlockScope scope) {
    fixPositions(setGeneratedBy(node, source));
    return super.visit(node, scope);
}
项目:EasyMPermission    文件:HandleBuilder.java   
private static final boolean toBoolean(Object expr, boolean defaultValue) {
    if (expr == null) return defaultValue;
    if (expr instanceof FalseLiteral) return false;
    if (expr instanceof TrueLiteral) return true;
    return ((Boolean) expr).booleanValue();
}
项目:EasyMPermission    文件:SetGeneratedByVisitor.java   
@Override public boolean visit(FalseLiteral node, BlockScope scope) {
    fixPositions(setGeneratedBy(node, source));
    return super.visit(node, scope);
}
项目:Eclipse-Postfix-Code-Completion    文件:BinaryExpressionFragmentBuilder.java   
public boolean visit(FalseLiteral falseLiteral, BlockScope scope) {
    addSmallFragment(falseLiteral);
    return false;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:BinaryExpressionFragmentBuilder.java   
public boolean visit(FalseLiteral falseLiteral, BlockScope scope) {
    addSmallFragment(falseLiteral);
    return false;
}
项目:xapi    文件:GwtAstBuilder.java   
@Override
public void endVisit(FalseLiteral x, BlockScope scope) {
  push(JBooleanLiteral.FALSE);
}
项目:lombok    文件:SetGeneratedByVisitor.java   
@Override public boolean visit(FalseLiteral node, BlockScope scope) {
    setGeneratedBy(node, source);
    applyOffsetExpression(node);
    return super.visit(node, scope);
}