Dear users, Please note that, from Monday, August 16, 2019, RSA keys shorter than 2048bit will no longer be accepted for security reasons. Please update your keys as needed before this date. If you need assistance with regard to this process, please contact sia@list.lu

Thank you for your understanding.

Commit b558586d authored by Nico Mack's avatar Nico Mack

Fixed cloning issue with ModalMarker

Changes to API of ClusterManager
parent 92de8d13
...@@ -93,7 +93,7 @@ public class ClusterManager<P extends Positionable> { ...@@ -93,7 +93,7 @@ public class ClusterManager<P extends Positionable> {
List<P> coalescing = kdTree.findNearest(candidate, radius); List<P> coalescing = kdTree.findNearest(candidate, radius);
// If there were items within that zone, than we the candidate will be // If there were items within that zone, than the candidate will be
// a cluster, representing the matching items. // a cluster, representing the matching items.
boolean isClustered = (!coalescing.isEmpty()); boolean isClustered = (!coalescing.isEmpty());
...@@ -170,7 +170,7 @@ public class ClusterManager<P extends Positionable> { ...@@ -170,7 +170,7 @@ public class ClusterManager<P extends Positionable> {
*/ */
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
public void refresh() { public void clusterize() {
if (kdTree == null) if (kdTree == null)
return; return;
......
...@@ -89,12 +89,11 @@ public class ModalMarker extends TetherableMarker { ...@@ -89,12 +89,11 @@ public class ModalMarker extends TetherableMarker {
clusteredBundle = original.clusteredBundle; clusteredBundle = original.clusteredBundle;
coronaBundles = TreeMultimap.create(); coronaBundles = TreeMultimap.create();
coronaBundles.putAll(original.coronaBundles); coronaBundles.putAll(original.cloneBundles());
activeBundles = new ArrayList<>(); activeBundles = new ArrayList<>();
activeBundles.addAll(original.activeBundles); activeBundles.addAll(original.activeBundles);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// *************************************************************************** // ***************************************************************************
// * Primitive(s) * // * Primitive(s) *
...@@ -231,6 +230,18 @@ public class ModalMarker extends TetherableMarker { ...@@ -231,6 +230,18 @@ public class ModalMarker extends TetherableMarker {
} }
} }
// ---------------------------------------------------------------------------
protected Multimap<String, CoronaBundle> cloneBundles() {
Multimap<String, CoronaBundle> clonedBundles = TreeMultimap.create();
for (Entry<String, CoronaBundle> entry : coronaBundles.entries()) {
CoronaBundle cloned = entry.getValue().clone();
clonedBundles.put(entry.getKey(), cloned);
}
return clonedBundles;
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// *************************************************************************** // ***************************************************************************
// * Class Body * // * Class Body *
......
...@@ -28,12 +28,14 @@ import lu.list.itis.dkd.tui.widget.corona.Corona; ...@@ -28,12 +28,14 @@ import lu.list.itis.dkd.tui.widget.corona.Corona;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
import com.google.common.collect.TreeMultimap;
import org.jdom2.Element; import org.jdom2.Element;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map.Entry;
/** /**
* Provides a way to logically organize and label a set of coronas. Bundles can also be altered * Provides a way to logically organize and label a set of coronas. Bundles can also be altered
...@@ -47,7 +49,7 @@ import java.util.List; ...@@ -47,7 +49,7 @@ import java.util.List;
// * Class Definition and Members * // * Class Definition and Members *
// *************************************************************************** // ***************************************************************************
public class CoronaBundle implements Comparable<CoronaBundle> { public class CoronaBundle implements Comparable<CoronaBundle>, Cloneable {
private String name; private String name;
private boolean isExclusive; private boolean isExclusive;
private boolean isDefault; private boolean isDefault;
...@@ -70,6 +72,19 @@ public class CoronaBundle implements Comparable<CoronaBundle> { ...@@ -70,6 +72,19 @@ public class CoronaBundle implements Comparable<CoronaBundle> {
this.coronas = ArrayListMultimap.create(); this.coronas = ArrayListMultimap.create();
} }
// ---------------------------------------------------------------------------
/**
* @param original
*/
// ---------------------------------------------------------------------------
public CoronaBundle(CoronaBundle original) {
this.name = original.name;
this.isExclusive = original.isExclusive;
this.isDefault = original.isDefault;
this.coronas = original.cloneCoronas();
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** /**
* @param rootElement * @param rootElement
...@@ -119,6 +134,22 @@ public class CoronaBundle implements Comparable<CoronaBundle> { ...@@ -119,6 +134,22 @@ public class CoronaBundle implements Comparable<CoronaBundle> {
coronas = CoronaBootstrapper.getCoronas(rootElement.getChild(Externalization.CORONAS_NODE), context, callback); coronas = CoronaBootstrapper.getCoronas(rootElement.getChild(Externalization.CORONAS_NODE), context, callback);
} }
// ---------------------------------------------------------------------------
/**
* @return
*/
// ---------------------------------------------------------------------------
protected Multimap<Integer, Corona> cloneCoronas() {
Multimap<Integer, Corona> clonedCoronas = TreeMultimap.create();
for (Entry<Integer, Corona> entry : coronas.entries()) {
Corona cloned = entry.getValue().clone();
clonedCoronas.put(entry.getKey(), cloned);
}
return clonedCoronas;
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// *************************************************************************** // ***************************************************************************
// * Class Body // * Class Body
...@@ -281,6 +312,13 @@ public class CoronaBundle implements Comparable<CoronaBundle> { ...@@ -281,6 +312,13 @@ public class CoronaBundle implements Comparable<CoronaBundle> {
return name.compareTo(bundle.name); return name.compareTo(bundle.name);
} }
// ---------------------------------------------------------------------------
@Override
public CoronaBundle clone() {
return new CoronaBundle(this);
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// *************************************************************************** // ***************************************************************************
// * End of Class * // * End of Class *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment