Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public StateConflictError(SourcePosition position, Expression state, Translation
super("State Conflict Error",
"Found multiple disjoint states in state transition: state transition can only go to one state of each state set",
position, translationTable);
this.state = state.toSimplifiedString();
this.state = state.toString();
}

public String getState() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ public class StateRefinementError extends LJError {

public StateRefinementError(SourcePosition position, Expression expected, Expression found,
TranslationTable translationTable, String customMessage) {
super("State Refinement Error", String.format("Expected state %s but found %s", expected.toSimplifiedString(),
found.toSimplifiedString()), position, translationTable, customMessage);
this.expected = expected.toSimplifiedString();
this.found = found.toSimplifiedString();
super("State Refinement Error",
String.format("Expected state %s but found %s", expected.toString(), found.toString()), position,
translationTable, customMessage);
this.expected = expected.toString();
this.found = found.toString();
}

public String getExpected() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ private Map<String, String> checkInvocationRefinements(CtElement invocation, Lis
Predicate methodRef = f.getRefReturn();

if (methodRef != null) {
boolean equalsThis = methodRef.toString().equals("(_ == this)"); // TODO change for better
boolean equalsThis = methodRef.toString().equals("_ == this"); // TODO change for better
List<String> vars = methodRef.getVariableNames();
for (String s : vars)
if (map.containsKey(s))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ public String toString() {
return name + "(" + getArgs().stream().map(Expression::toString).collect(Collectors.joining(", ")) + ")";
}

@Override
public String toSimplifiedString() {
return name + "(" + getArgs().stream().map(Expression::toSimplifiedString).collect(Collectors.joining(", "))
+ ")";
}

@Override
public void getVariableNames(List<String> toAdd) {
for (Expression e : getArgs())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ public String toString() {
return getFirstOperand().toString() + " " + op + " " + getSecondOperand().toString();
}

@Override
public String toSimplifiedString() {
return getFirstOperand().toSimplifiedString() + " " + op + " " + getSecondOperand().toSimplifiedString();
}

@Override
public void getVariableNames(List<String> toAdd) {
getFirstOperand().getVariableNames(toAdd);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,6 @@ public abstract class Expression {

public abstract String toString();

/**
* Returns a simplified string representation of this expression with unqualified names (e.g.,
* com.example.State.open => open Default implementation delegates to toString() Subclasses that contain qualified
* names should override this method
*
* @return simplified string representation
*/
public String toSimplifiedString() {
return toString();
}

List<Expression> children = new ArrayList<>();

public void addChild(Expression e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,8 @@ public <T> T accept(ExpressionVisitor<T> visitor) throws LJError {

@Override
public String toString() {
return name + "(" + getArgs().stream().map(Expression::toString).collect(Collectors.joining(",")) + ")";
}

@Override
public String toSimplifiedString() {
String simpleName = Utils.getSimpleName(name);
return simpleName + "("
+ getArgs().stream().map(Expression::toSimplifiedString).collect(Collectors.joining(",")) + ")";
return Utils.getSimpleName(name) + "("
+ getArgs().stream().map(Expression::toString).collect(Collectors.joining(",")) + ")";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@ public <T> T accept(ExpressionVisitor<T> visitor) throws LJError {
}

public String toString() {
return "(" + getExpression().toString() + ")";
}

@Override
public String toSimplifiedString() {
return getExpression().toSimplifiedString();
return getExpression().toString();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,7 @@ public <T> T accept(ExpressionVisitor<T> visitor) throws LJError {

@Override
public String toString() {
return getCondition().toString() + "?" + getThen().toString() + ":" + getElse().toString();
}

@Override
public String toSimplifiedString() {
return getCondition().toSimplifiedString() + "?" + getThen().toSimplifiedString() + ":"
+ getElse().toSimplifiedString();
return getCondition().toString() + " ? " + getThen().toString() + " : " + getElse().toString();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ public String toString() {
return op + getExpression().toString();
}

@Override
public String toSimplifiedString() {
return op + getExpression().toSimplifiedString();
}

@Override
public void getVariableNames(List<String> toAdd) {
getExpression().getVariableNames(toAdd);
Expand Down