Skip to content
Snippets Groups Projects
Commit 3b254acf authored by Markus Alexander Kuppe's avatar Markus Alexander Kuppe
Browse files

Add method to print an unquoted StringValue.

[Refactor][TLC]
parent 103a1218
No related branches found
No related tags found
No related merge requests found
...@@ -119,6 +119,8 @@ public interface IValue extends Comparable<Object> { ...@@ -119,6 +119,8 @@ public interface IValue extends Comparable<Object> {
String toString(String delim); String toString(String delim);
String toUnquotedString();
default boolean isAtom() { default boolean isAtom() {
if (this instanceof ModelValue || this instanceof IntValue || this instanceof StringValue if (this instanceof ModelValue || this instanceof IntValue || this instanceof StringValue
|| this instanceof BoolValue) { || this instanceof BoolValue) {
...@@ -133,4 +135,5 @@ public interface IValue extends Comparable<Object> { ...@@ -133,4 +135,5 @@ public interface IValue extends Comparable<Object> {
default boolean mutates() { default boolean mutates() {
return true; return true;
} }
} }
\ No newline at end of file
...@@ -280,6 +280,12 @@ public class StringValue extends Value { ...@@ -280,6 +280,12 @@ public class StringValue extends Value {
} }
} }
/* Same as toString. */
@Override
public final String toUnquotedString() {
return PrintVersion(this.val.toString());
}
public static IValue createFrom(final IValueInputStream vos) throws IOException { public static IValue createFrom(final IValueInputStream vos) throws IOException {
final UniqueString str = UniqueString.read(vos.getInputStream()); final UniqueString str = UniqueString.read(vos.getInputStream());
final IValue res = new StringValue(str); final IValue res = new StringValue(str);
......
...@@ -316,6 +316,12 @@ public abstract class Value implements ValueConstants, Serializable, IValue { ...@@ -316,6 +316,12 @@ public abstract class Value implements ValueConstants, Serializable, IValue {
return toStringImpl("", false); return toStringImpl("", false);
} }
/* Same as toString. */
@Override
public String toUnquotedString() {
return toString();
}
@Override @Override
public final String toString(final String delim) { public final String toString(final String delim) {
return toStringImpl(delim, true); return toStringImpl(delim, true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment