diff options
author | Arne H Juul <arnej@yahooinc.com> | 2022-05-31 16:50:18 +0000 |
---|---|---|
committer | Arne H Juul <arnej@yahooinc.com> | 2022-05-31 16:57:00 +0000 |
commit | e836c45f4b9900bdfa72987a96a13087b106b757 (patch) | |
tree | 0d151f4af256cd41ce71b2079578fc6a036d220d /config-model/src/main/java/com/yahoo/schema/fieldoperation/WeightedSetOperation.java | |
parent | 0b3b4099742306aeb2706e6be7251d66152f12ae (diff) |
remove some cruft
Diffstat (limited to 'config-model/src/main/java/com/yahoo/schema/fieldoperation/WeightedSetOperation.java')
-rw-r--r-- | config-model/src/main/java/com/yahoo/schema/fieldoperation/WeightedSetOperation.java | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/config-model/src/main/java/com/yahoo/schema/fieldoperation/WeightedSetOperation.java b/config-model/src/main/java/com/yahoo/schema/fieldoperation/WeightedSetOperation.java deleted file mode 100644 index 8fb0cc9fcdb..00000000000 --- a/config-model/src/main/java/com/yahoo/schema/fieldoperation/WeightedSetOperation.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.schema.fieldoperation; - -import com.yahoo.schema.document.Attribute; -import com.yahoo.document.DataType; -import com.yahoo.schema.document.SDField; -import com.yahoo.document.WeightedSetDataType; - -/** - * @author Einar M R Rosenvinge - */ -public class WeightedSetOperation implements FieldOperation { - - private Boolean createIfNonExistent; - private Boolean removeIfZero; - - public Boolean getCreateIfNonExistent() { - return createIfNonExistent; - } - - public void setCreateIfNonExistent(Boolean createIfNonExistent) { - this.createIfNonExistent = createIfNonExistent; - } - - public Boolean getRemoveIfZero() { - return removeIfZero; - } - - public void setRemoveIfZero(Boolean removeIfZero) { - this.removeIfZero = removeIfZero; - } - - public void apply(SDField field) { - WeightedSetDataType ctype = (WeightedSetDataType) field.getDataType(); - - if (createIfNonExistent != null) { - field.setDataType(DataType.getWeightedSet(ctype.getNestedType(), createIfNonExistent, - ctype.removeIfZero())); - } - - ctype = (WeightedSetDataType) field.getDataType(); - if (removeIfZero != null) { - field.setDataType(DataType.getWeightedSet(ctype.getNestedType(), - ctype.createIfNonExistent(), removeIfZero)); - } - - ctype = (WeightedSetDataType) field.getDataType(); - for (Object o : field.getAttributes().values()) { - Attribute attribute = (Attribute) o; - attribute.setRemoveIfZero(ctype.removeIfZero()); - attribute.setCreateIfNonExistent(ctype.createIfNonExistent()); - } - } - - @Override - public int compareTo(FieldOperation other) { - // this operation should be executed first because it modifies the type of weighted sets, and other - // operation depends on the type of the weighted set - return -1; - } - - @Override - public String toString() { - return "WeightedSetOperation{" + - "createIfNonExistent=" + createIfNonExistent + - ", removeIfZero=" + removeIfZero + - '}'; - } - -} |