org.eclipse.jdt.core.dom.BooleanLiteral Java Examples
The following examples show how to use
org.eclipse.jdt.core.dom.BooleanLiteral.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JavaASTFlattener.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
public boolean isBooleanType(final Expression expression) { if ((expression instanceof BooleanLiteral)) { return true; } if ((expression instanceof SimpleName)) { final Type declType = this._aSTFlattenerUtils.findDeclaredType(((SimpleName)expression)); if ((declType != null)) { boolean _matched = false; boolean _isPrimitiveType = declType.isPrimitiveType(); if (_isPrimitiveType) { _matched=true; PrimitiveType.Code _primitiveTypeCode = ((PrimitiveType) declType).getPrimitiveTypeCode(); return Objects.equal(_primitiveTypeCode, PrimitiveType.BOOLEAN); } } } return false; }
Example #2
Source File: ASTNodeMatcher.java From JDeodorant with MIT License | 6 votes |
protected boolean isTypeHolder(Object o) { if(o.getClass().equals(MethodInvocation.class) || o.getClass().equals(SuperMethodInvocation.class) || o.getClass().equals(NumberLiteral.class) || o.getClass().equals(StringLiteral.class) || o.getClass().equals(CharacterLiteral.class) || o.getClass().equals(BooleanLiteral.class) || o.getClass().equals(TypeLiteral.class) || o.getClass().equals(NullLiteral.class) || o.getClass().equals(ArrayCreation.class) || o.getClass().equals(ClassInstanceCreation.class) || o.getClass().equals(ArrayAccess.class) || o.getClass().equals(FieldAccess.class) || o.getClass().equals(SuperFieldAccess.class) || o.getClass().equals(ParenthesizedExpression.class) || o.getClass().equals(SimpleName.class) || o.getClass().equals(QualifiedName.class) || o.getClass().equals(CastExpression.class) || o.getClass().equals(InfixExpression.class) || o.getClass().equals(PrefixExpression.class) || o.getClass().equals(InstanceofExpression.class) || o.getClass().equals(ThisExpression.class) || o.getClass().equals(ConditionalExpression.class)) return true; return false; }
Example #3
Source File: CodeBlock.java From SimFix with GNU General Public License v2.0 | 5 votes |
private BoolLiteral visit(BooleanLiteral node) { int startLine = _cunit.getLineNumber(node.getStartPosition()); int endLine = _cunit.getLineNumber(node.getStartPosition() + node.getLength()); BoolLiteral literal = new BoolLiteral(startLine, endLine, node); literal.setValue(node.booleanValue()); AST ast = AST.newAST(AST.JLS8); Type type = ast.newPrimitiveType(PrimitiveType.BOOLEAN); literal.setType(type); return literal; }
Example #4
Source File: StyledStringVisitor.java From JDeodorant with MIT License | 5 votes |
public boolean visit(BooleanLiteral expr) { /* * BooleanLiteral: true false */ StyledStringStyler styler = determineDiffStyle(expr, new StyledStringStyler(keywordStyle)); styledString.append(String.valueOf(expr.booleanValue()), styler); return false; }
Example #5
Source File: Visitor.java From RefactoringMiner with MIT License | 5 votes |
public boolean visit(BooleanLiteral node) { booleanLiterals.add(node.toString()); if(current.getUserObject() != null) { AnonymousClassDeclarationObject anonymous = (AnonymousClassDeclarationObject)current.getUserObject(); anonymous.getBooleanLiterals().add(node.toString()); } return super.visit(node); }
Example #6
Source File: Visitor.java From RefactoringMiner with MIT License | 5 votes |
private void processArgument(Expression argument) { if(argument instanceof SuperMethodInvocation || argument instanceof Name || argument instanceof StringLiteral || argument instanceof BooleanLiteral || (argument instanceof FieldAccess && ((FieldAccess)argument).getExpression() instanceof ThisExpression) || (argument instanceof ArrayAccess && invalidArrayAccess((ArrayAccess)argument)) || (argument instanceof InfixExpression && invalidInfix((InfixExpression)argument))) return; this.arguments.add(argument.toString()); if(current.getUserObject() != null) { AnonymousClassDeclarationObject anonymous = (AnonymousClassDeclarationObject)current.getUserObject(); anonymous.getArguments().add(argument.toString()); } }
Example #7
Source File: InstanceOfLiteral.java From JDeodorant with MIT License | 5 votes |
public boolean instanceOf(Expression expression) { if(expression instanceof BooleanLiteral || expression instanceof CharacterLiteral || expression instanceof StringLiteral || expression instanceof NullLiteral || expression instanceof NumberLiteral || expression instanceof TypeLiteral) return true; else return false; }
Example #8
Source File: StyledStringVisitor.java From JDeodorant with MIT License | 4 votes |
private void handleExpression(Expression expression) { if (expression instanceof ArrayAccess) { visit((ArrayAccess) expression); } else if (expression instanceof ArrayCreation) { visit((ArrayCreation) expression); } else if (expression instanceof ArrayInitializer) { visit((ArrayInitializer) expression); } else if (expression instanceof Assignment) { visit((Assignment) expression); } else if (expression instanceof BooleanLiteral) { visit((BooleanLiteral) expression); } else if (expression instanceof CastExpression) { visit((CastExpression) expression); } else if (expression instanceof CharacterLiteral) { visit((CharacterLiteral) expression); } else if (expression instanceof ClassInstanceCreation) { visit((ClassInstanceCreation) expression); } else if (expression instanceof ConditionalExpression) { visit((ConditionalExpression) expression); } else if (expression instanceof FieldAccess) { visit((FieldAccess) expression); } else if (expression instanceof InfixExpression) { visit((InfixExpression) expression); } else if (expression instanceof InstanceofExpression) { visit((InstanceofExpression) expression); } else if (expression instanceof MethodInvocation) { visit((MethodInvocation) expression); } else if (expression instanceof NullLiteral) { visit((NullLiteral) expression); } else if (expression instanceof NumberLiteral) { visit((NumberLiteral) expression); } else if (expression instanceof ParenthesizedExpression) { visit((ParenthesizedExpression) expression); } else if (expression instanceof PostfixExpression) { visit((PostfixExpression) expression); } else if (expression instanceof PrefixExpression) { visit((PrefixExpression) expression); } else if ((expression instanceof QualifiedName)) { visit((QualifiedName) expression); } else if (expression instanceof SimpleName) { visit((SimpleName) expression); } else if (expression instanceof StringLiteral) { visit((StringLiteral) expression); } else if (expression instanceof SuperFieldAccess) { visit((SuperFieldAccess) expression); } else if (expression instanceof SuperMethodInvocation) { visit((SuperMethodInvocation) expression); } else if (expression instanceof ThisExpression) { visit((ThisExpression) expression); } else if (expression instanceof TypeLiteral) { visit((TypeLiteral) expression); } else if (expression instanceof VariableDeclarationExpression) { visit((VariableDeclarationExpression) expression); } }
Example #9
Source File: BaseTranslator.java From junion with BSD 3-Clause "New" or "Revised" License | 4 votes |
public Expression returnBool(boolean val) { BooleanLiteral num = ast.newBooleanLiteral(val); num.setProperty(TYPEBIND_PROP, StructCache.FieldType.BOOLEAN); return num; }
Example #10
Source File: BindingSignatureVisitor.java From JDeodorant with MIT License | 4 votes |
private void handleExpression(Expression expression) { if (expression instanceof ArrayAccess) { visit((ArrayAccess) expression); } else if (expression instanceof ArrayCreation) { visit((ArrayCreation) expression); } else if (expression instanceof ArrayInitializer) { visit((ArrayInitializer) expression); } else if (expression instanceof Assignment) { visit((Assignment) expression); } else if (expression instanceof BooleanLiteral) { visit((BooleanLiteral) expression); } else if (expression instanceof CastExpression) { visit((CastExpression) expression); } else if (expression instanceof CharacterLiteral) { visit((CharacterLiteral) expression); } else if (expression instanceof ClassInstanceCreation) { visit((ClassInstanceCreation) expression); } else if (expression instanceof ConditionalExpression) { visit((ConditionalExpression) expression); } else if (expression instanceof FieldAccess) { visit((FieldAccess) expression); } else if (expression instanceof InfixExpression) { visit((InfixExpression) expression); } else if (expression instanceof InstanceofExpression) { visit((InstanceofExpression) expression); } else if (expression instanceof MethodInvocation) { visit((MethodInvocation) expression); } else if (expression instanceof NullLiteral) { visit((NullLiteral) expression); } else if (expression instanceof NumberLiteral) { visit((NumberLiteral) expression); } else if (expression instanceof ParenthesizedExpression) { visit((ParenthesizedExpression) expression); } else if (expression instanceof PostfixExpression) { visit((PostfixExpression) expression); } else if (expression instanceof PrefixExpression) { visit((PrefixExpression) expression); } else if ((expression instanceof QualifiedName)) { visit((QualifiedName) expression); } else if (expression instanceof SimpleName) { visit((SimpleName) expression); } else if (expression instanceof StringLiteral) { visit((StringLiteral) expression); } else if (expression instanceof SuperFieldAccess) { visit((SuperFieldAccess) expression); } else if (expression instanceof SuperMethodInvocation) { visit((SuperMethodInvocation) expression); } else if (expression instanceof ThisExpression) { visit((ThisExpression) expression); } else if (expression instanceof TypeLiteral) { visit((TypeLiteral) expression); } else if (expression instanceof VariableDeclarationExpression) { visit((VariableDeclarationExpression) expression); } }
Example #11
Source File: BindingSignatureVisitor.java From JDeodorant with MIT License | 4 votes |
public boolean visit(BooleanLiteral expr) { bindingKeys.add(String.valueOf(expr.booleanValue())); return false; }
Example #12
Source File: LiteralObject.java From JDeodorant with MIT License | 4 votes |
public LiteralObject(Expression expression) { if(expression instanceof StringLiteral) { StringLiteral stringLiteral = (StringLiteral)expression; literalType = LiteralType.STRING; value = stringLiteral.getLiteralValue(); type = TypeObject.extractTypeObject(stringLiteral.resolveTypeBinding().getQualifiedName()); } else if(expression instanceof NullLiteral) { NullLiteral nullLiteral = (NullLiteral)expression; literalType = LiteralType.NULL; value = "null"; if(nullLiteral.resolveTypeBinding() != null) { type = TypeObject.extractTypeObject(nullLiteral.resolveTypeBinding().getQualifiedName()); } } else if(expression instanceof NumberLiteral) { NumberLiteral numberLiteral = (NumberLiteral)expression; literalType = LiteralType.NUMBER; value = numberLiteral.getToken(); type = TypeObject.extractTypeObject(numberLiteral.resolveTypeBinding().getQualifiedName()); } else if(expression instanceof BooleanLiteral) { BooleanLiteral booleanLiteral = (BooleanLiteral)expression; literalType = LiteralType.BOOLEAN; value = Boolean.toString(booleanLiteral.booleanValue()); type = TypeObject.extractTypeObject(booleanLiteral.resolveTypeBinding().getQualifiedName()); } else if(expression instanceof CharacterLiteral) { CharacterLiteral characterLiteral = (CharacterLiteral)expression; literalType = LiteralType.CHARACTER; value = Character.toString(characterLiteral.charValue()); type = TypeObject.extractTypeObject(characterLiteral.resolveTypeBinding().getQualifiedName()); } else if(expression instanceof TypeLiteral) { TypeLiteral typeLiteral = (TypeLiteral)expression; literalType = LiteralType.TYPE; value = typeLiteral.getType().toString(); type = TypeObject.extractTypeObject(typeLiteral.resolveTypeBinding().getQualifiedName()); } this.literal = ASTInformationGenerator.generateASTInformation(expression); }
Example #13
Source File: SemanticHighlightingReconciler.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override public boolean visit(BooleanLiteral node) { return visitLiteral(node); }
Example #14
Source File: GenericVisitor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override public boolean visit(BooleanLiteral node) { return visitNode(node); }
Example #15
Source File: GenericVisitor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override public void endVisit(BooleanLiteral node) { endVisitNode(node); }
Example #16
Source File: ConstraintCollector.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override public boolean visit(BooleanLiteral node) { add(fCreator.create(node)); return true; }
Example #17
Source File: AstMatchingNodeFinder.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override public boolean visit(BooleanLiteral node) { if (node.subtreeMatch(fMatcher, fNodeToMatch)) return matches(node); return super.visit(node); }
Example #18
Source File: FlowAnalyzer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override public void endVisit(BooleanLiteral node) { // Leaf node. }
Example #19
Source File: InferTypeArgumentsConstraintCreator.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override public void endVisit(BooleanLiteral node) { ITypeBinding typeBinding= node.resolveTypeBinding(); ImmutableTypeVariable2 cv= fTCModel.makeImmutableTypeVariable(typeBinding, node); setConstraintVariable(node, cv); }
Example #20
Source File: JavaASTFlattener.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
@Override public boolean visit(final BooleanLiteral it) { this.appendToBuffer(String.valueOf(it.booleanValue())); return false; }
Example #21
Source File: FlowAnalyzer.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
@Override public void endVisit(BooleanLiteral node) { // Leaf node. }
Example #22
Source File: ConstraintCreator.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 2 votes |
/** * @param node the AST node * @return array of type constraints, may be empty * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.BooleanLiteral) */ public ITypeConstraint[] create(BooleanLiteral node) { return EMPTY_ARRAY; }