m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/pl/edu/mimuw/cloudatlas/model/ValueBoolean.java
diff options
context:
space:
mode:
authorMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2019-10-21 21:45:57 +0200
committerMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2019-10-21 21:45:57 +0200
commita0c4b252e5867219871b5c6df10219d916e29bff (patch)
tree08cc82ec20db1c68ec6002d965209c5168fad7a9 /src/pl/edu/mimuw/cloudatlas/model/ValueBoolean.java
parent38847dbb8809a8214a911b120b6b11ee4d7f1399 (diff)
Tabs to spaces
Diffstat (limited to 'src/pl/edu/mimuw/cloudatlas/model/ValueBoolean.java')
-rw-r--r--src/pl/edu/mimuw/cloudatlas/model/ValueBoolean.java118
1 files changed, 59 insertions, 59 deletions
diff --git a/src/pl/edu/mimuw/cloudatlas/model/ValueBoolean.java b/src/pl/edu/mimuw/cloudatlas/model/ValueBoolean.java
index 1ca20fc..ba2b4f6 100644
--- a/src/pl/edu/mimuw/cloudatlas/model/ValueBoolean.java
+++ b/src/pl/edu/mimuw/cloudatlas/model/ValueBoolean.java
@@ -31,63 +31,63 @@ import pl.edu.mimuw.cloudatlas.model.ValueBoolean;
* A class that wraps a Java <code>Boolean</code> object.
*/
public class ValueBoolean extends ValueSimple<Boolean> {
- /**
- * Constructs a new <code>ValueBoolean</code> object wrapping the specified <code>value</code>.
- *
- * @param value the value to wrap
- */
- public ValueBoolean(Boolean value) {
- super(value);
- }
-
- @Override
- public Type getType() {
- return TypePrimitive.BOOLEAN;
- }
-
- @Override
- public Value getDefaultValue() {
- return new ValueBoolean(false);
- }
-
- @Override
- public ValueBoolean isLowerThan(Value value) {
- sameTypesOrThrow(value, Operation.COMPARE);
- if(isNull() || value.isNull())
- return new ValueBoolean(null);
- return new ValueBoolean(!getValue() && ((ValueBoolean)value).getValue());
- }
-
- @Override
- public ValueBoolean and(Value value) {
- sameTypesOrThrow(value, Operation.AND);
- if(isNull() || value.isNull())
- return new ValueBoolean(null);
- return new ValueBoolean(getValue() && ((ValueBoolean)value).getValue());
- }
-
- @Override
- public ValueBoolean or(Value value) { // -
- sameTypesOrThrow(value, Operation.OR);
- if(isNull() || value.isNull())
- return new ValueBoolean(null);
- return new ValueBoolean(getValue() || ((ValueBoolean)value).getValue());
- }
-
- @Override
- public ValueBoolean negate() { // !
- return new ValueBoolean(isNull()? null : !getValue());
- }
-
- @Override
- public Value convertTo(Type type) {
- switch(type.getPrimaryType()) {
- case BOOLEAN:
- return this;
- case STRING:
- return getValue() == null? ValueString.NULL_STRING : new ValueString(getValue().toString());
- default:
- throw new UnsupportedConversionException(getType(), type);
- }
- }
+ /**
+ * Constructs a new <code>ValueBoolean</code> object wrapping the specified <code>value</code>.
+ *
+ * @param value the value to wrap
+ */
+ public ValueBoolean(Boolean value) {
+ super(value);
+ }
+
+ @Override
+ public Type getType() {
+ return TypePrimitive.BOOLEAN;
+ }
+
+ @Override
+ public Value getDefaultValue() {
+ return new ValueBoolean(false);
+ }
+
+ @Override
+ public ValueBoolean isLowerThan(Value value) {
+ sameTypesOrThrow(value, Operation.COMPARE);
+ if(isNull() || value.isNull())
+ return new ValueBoolean(null);
+ return new ValueBoolean(!getValue() && ((ValueBoolean)value).getValue());
+ }
+
+ @Override
+ public ValueBoolean and(Value value) {
+ sameTypesOrThrow(value, Operation.AND);
+ if(isNull() || value.isNull())
+ return new ValueBoolean(null);
+ return new ValueBoolean(getValue() && ((ValueBoolean)value).getValue());
+ }
+
+ @Override
+ public ValueBoolean or(Value value) { // -
+ sameTypesOrThrow(value, Operation.OR);
+ if(isNull() || value.isNull())
+ return new ValueBoolean(null);
+ return new ValueBoolean(getValue() || ((ValueBoolean)value).getValue());
+ }
+
+ @Override
+ public ValueBoolean negate() { // !
+ return new ValueBoolean(isNull()? null : !getValue());
+ }
+
+ @Override
+ public Value convertTo(Type type) {
+ switch(type.getPrimaryType()) {
+ case BOOLEAN:
+ return this;
+ case STRING:
+ return getValue() == null? ValueString.NULL_STRING : new ValueString(getValue().toString());
+ default:
+ throw new UnsupportedConversionException(getType(), type);
+ }
+ }
}