Mercurial > hg > graal-jvmci-8
diff graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/GuardExpression.java @ 16763:e6d15134ca86
Truffle-DSL: fixed formatting problems.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 11 Aug 2014 16:21:54 +0200 |
parents | 23415229349b |
children | 90984ae0eaa8 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/GuardExpression.java Mon Aug 11 15:57:47 2014 +0200 +++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/GuardExpression.java Mon Aug 11 16:21:54 2014 +0200 @@ -1,87 +1,87 @@ -package com.oracle.truffle.dsl.processor.model; - -import java.util.*; - -public final class GuardExpression { - - private GuardData resolvedGuard; - - private final String guardName; - private final boolean negated; - - public GuardExpression(String expression) { - if (expression.startsWith("!")) { - guardName = expression.substring(1, expression.length()); - negated = true; - } else { - guardName = expression; - negated = false; - } - } - - public boolean isResolved() { - return resolvedGuard != null; - } - - public String getGuardName() { - return guardName; - } - - public void setGuard(GuardData guard) { - this.resolvedGuard = guard; - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof GuardExpression) { - GuardExpression other = (GuardExpression) obj; - if (isResolved() && other.isResolved()) { - return resolvedGuard.equals(other.resolvedGuard) && negated == other.negated; - } else { - return guardName.equals(other.guardName) && negated == other.negated; - } - } - return false; - } - - @Override - public int hashCode() { - return Objects.hash(guardName, negated, resolvedGuard); - } - - public final boolean implies(GuardExpression other) { - if (other == this) { - return true; - } - if (getGuardName().equals(other.getGuardName())) { - if (isNegated() == other.isNegated()) { - return true; - } - } - - if (isResolved() && other.isResolved()) { - for (GuardExpression implies : getResolvedGuard().getImpliesExpressions()) { - if (implies.getGuardName().equals(other.getGuardName())) { - if (implies.isNegated() == other.isNegated()) { - return true; - } - } - } - } - return false; - } - - @Override - public String toString() { - return (negated ? "!" : "") + guardName; - } - - public boolean isNegated() { - return negated; - } - - public GuardData getResolvedGuard() { - return resolvedGuard; - } - -} +package com.oracle.truffle.dsl.processor.model; + +import java.util.*; + +public final class GuardExpression { + + private GuardData resolvedGuard; + + private final String guardName; + private final boolean negated; + + public GuardExpression(String expression) { + if (expression.startsWith("!")) { + guardName = expression.substring(1, expression.length()); + negated = true; + } else { + guardName = expression; + negated = false; + } + } + + public boolean isResolved() { + return resolvedGuard != null; + } + + public String getGuardName() { + return guardName; + } + + public void setGuard(GuardData guard) { + this.resolvedGuard = guard; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof GuardExpression) { + GuardExpression other = (GuardExpression) obj; + if (isResolved() && other.isResolved()) { + return resolvedGuard.equals(other.resolvedGuard) && negated == other.negated; + } else { + return guardName.equals(other.guardName) && negated == other.negated; + } + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(guardName, negated, resolvedGuard); + } + + public final boolean implies(GuardExpression other) { + if (other == this) { + return true; + } + if (getGuardName().equals(other.getGuardName())) { + if (isNegated() == other.isNegated()) { + return true; + } + } + + if (isResolved() && other.isResolved()) { + for (GuardExpression implies : getResolvedGuard().getImpliesExpressions()) { + if (implies.getGuardName().equals(other.getGuardName())) { + if (implies.isNegated() == other.isNegated()) { + return true; + } + } + } + } + return false; + } + + @Override + public String toString() { + return (negated ? "!" : "") + guardName; + } + + public boolean isNegated() { + return negated; + } + + public GuardData getResolvedGuard() { + return resolvedGuard; + } + +}