From a0c4b252e5867219871b5c6df10219d916e29bff Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Mon, 21 Oct 2019 21:45:57 +0200 Subject: Tabs to spaces --- src/pl/edu/mimuw/cloudatlas/model/ValueString.java | 168 ++++++++++----------- 1 file changed, 84 insertions(+), 84 deletions(-) (limited to 'src/pl/edu/mimuw/cloudatlas/model/ValueString.java') diff --git a/src/pl/edu/mimuw/cloudatlas/model/ValueString.java b/src/pl/edu/mimuw/cloudatlas/model/ValueString.java index 34af8d1..e6fe9dd 100644 --- a/src/pl/edu/mimuw/cloudatlas/model/ValueString.java +++ b/src/pl/edu/mimuw/cloudatlas/model/ValueString.java @@ -33,88 +33,88 @@ import pl.edu.mimuw.cloudatlas.model.ValueString; * A class that wraps a Java String object. */ public class ValueString extends ValueSimple { - /** - * A result of conversion values representing null to ValueString. - */ - protected static final ValueString NULL_STRING = new ValueString("NULL"); - - /** - * Constructs a new ValueString object wrapping the specified value. - * - * @param value the value to wrap - */ - public ValueString(String value) { - super(value); - } - - @Override - public Type getType() { - return TypePrimitive.STRING; - } - - @Override - public Value getDefaultValue() { - return new ValueString(""); - } - - @Override - public ValueBoolean isLowerThan(Value value) { - sameTypesOrThrow(value, Operation.COMPARE); - if(isNull() || value.isNull()) - return new ValueBoolean(null); - return new ValueBoolean(getValue().compareTo(((ValueString)value).getValue()) < 0); - } - - @Override - public ValueString addValue(Value value) { - sameTypesOrThrow(value, Operation.ADD); - if(isNull() || value.isNull()) - return new ValueString(null); - return new ValueString(getValue().concat(((ValueString)value).getValue())); - } - - @Override - public ValueBoolean regExpr(Value value) { - sameTypesOrThrow(value, Operation.REG_EXPR); - if(isNull() || value.isNull()) - return new ValueBoolean(null); - return new ValueBoolean(getValue().matches(((ValueString)value).getValue())); - } - - @Override - public Value convertTo(Type type) { - switch(type.getPrimaryType()) { - case BOOLEAN: - return new ValueBoolean(Boolean.parseBoolean(getValue())); - case DOUBLE: - try { - return new ValueDouble(Double.parseDouble(getValue())); - } catch(NumberFormatException exception) { - return new ValueDouble(null); - } - case DURATION: - return new ValueDuration(getValue()); - case INT: - try { - return new ValueInt(Long.parseLong(getValue())); - } catch(NumberFormatException exception) { - return new ValueInt(null); - } - case STRING: - return getValue() == null? ValueString.NULL_STRING : this; - case TIME: - try { - return new ValueTime(getValue()); - } catch(ParseException exception) { - return new ValueTime((Long)null); - } - default: - throw new UnsupportedConversionException(getType(), type); - } - } - - @Override - public ValueInt valueSize() { - return new ValueInt(getValue() == null? null : (long)getValue().length()); - } + /** + * A result of conversion values representing null to ValueString. + */ + protected static final ValueString NULL_STRING = new ValueString("NULL"); + + /** + * Constructs a new ValueString object wrapping the specified value. + * + * @param value the value to wrap + */ + public ValueString(String value) { + super(value); + } + + @Override + public Type getType() { + return TypePrimitive.STRING; + } + + @Override + public Value getDefaultValue() { + return new ValueString(""); + } + + @Override + public ValueBoolean isLowerThan(Value value) { + sameTypesOrThrow(value, Operation.COMPARE); + if(isNull() || value.isNull()) + return new ValueBoolean(null); + return new ValueBoolean(getValue().compareTo(((ValueString)value).getValue()) < 0); + } + + @Override + public ValueString addValue(Value value) { + sameTypesOrThrow(value, Operation.ADD); + if(isNull() || value.isNull()) + return new ValueString(null); + return new ValueString(getValue().concat(((ValueString)value).getValue())); + } + + @Override + public ValueBoolean regExpr(Value value) { + sameTypesOrThrow(value, Operation.REG_EXPR); + if(isNull() || value.isNull()) + return new ValueBoolean(null); + return new ValueBoolean(getValue().matches(((ValueString)value).getValue())); + } + + @Override + public Value convertTo(Type type) { + switch(type.getPrimaryType()) { + case BOOLEAN: + return new ValueBoolean(Boolean.parseBoolean(getValue())); + case DOUBLE: + try { + return new ValueDouble(Double.parseDouble(getValue())); + } catch(NumberFormatException exception) { + return new ValueDouble(null); + } + case DURATION: + return new ValueDuration(getValue()); + case INT: + try { + return new ValueInt(Long.parseLong(getValue())); + } catch(NumberFormatException exception) { + return new ValueInt(null); + } + case STRING: + return getValue() == null? ValueString.NULL_STRING : this; + case TIME: + try { + return new ValueTime(getValue()); + } catch(ParseException exception) { + return new ValueTime((Long)null); + } + default: + throw new UnsupportedConversionException(getType(), type); + } + } + + @Override + public ValueInt valueSize() { + return new ValueInt(getValue() == null? null : (long)getValue().length()); + } } -- cgit v1.2.3