From c6f148b33422f0d1660a4289f413193011736475 Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Mon, 30 Dec 2019 11:46:07 +0100 Subject: Test multiple queries in Qurnik --- .../edu/mimuw/cloudatlas/model/AttributesUtil.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/main/java/pl/edu/mimuw/cloudatlas/model/AttributesUtil.java (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/model/AttributesUtil.java') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/model/AttributesUtil.java b/src/main/java/pl/edu/mimuw/cloudatlas/model/AttributesUtil.java new file mode 100644 index 0000000..cd2ae91 --- /dev/null +++ b/src/main/java/pl/edu/mimuw/cloudatlas/model/AttributesUtil.java @@ -0,0 +1,21 @@ +package pl.edu.mimuw.cloudatlas.model; + +import java.util.Iterator; +import java.util.Map.Entry; + +public class AttributesUtil { + public static void transferAttributes(AttributesMap fromAttributes, AttributesMap toAttributes) { + Iterator> iterator = toAttributes.iterator(); + while (iterator.hasNext()) { + Entry entry = iterator.next(); + Attribute attribute = entry.getKey(); + Value newValue = fromAttributes.getOrNull(attribute); + if (newValue == null) { + iterator.remove(); + } + } + for (Entry entry : fromAttributes) { + toAttributes.addOrChange(entry.getKey(), entry.getValue()); + } + } +} -- cgit v1.2.3