diff --git a/src/main/java/org/gcube/informationsystem/discovery/ClassElementInformation.java b/src/main/java/org/gcube/informationsystem/discovery/ClassInformation.java similarity index 82% rename from src/main/java/org/gcube/informationsystem/discovery/ClassElementInformation.java rename to src/main/java/org/gcube/informationsystem/discovery/ClassInformation.java index 36bd29f..311c3de 100644 --- a/src/main/java/org/gcube/informationsystem/discovery/ClassElementInformation.java +++ b/src/main/java/org/gcube/informationsystem/discovery/ClassInformation.java @@ -4,10 +4,13 @@ import java.util.LinkedHashSet; import java.util.Set; import org.gcube.informationsystem.base.reference.Element; -import org.gcube.informationsystem.tree.NodeElementInformation; +import org.gcube.informationsystem.tree.NodeInformation; import org.gcube.informationsystem.types.TypeMapper; -public class ClassElementInformation implements NodeElementInformation> { +/** + * @author Luca Frosini (ISTI - CNR) + */ +public class ClassInformation implements NodeInformation> { @Override public String getIdentifier(Class clz) { diff --git a/src/main/java/org/gcube/informationsystem/tree/Node.java b/src/main/java/org/gcube/informationsystem/tree/Node.java index e2c52b4..29da37c 100644 --- a/src/main/java/org/gcube/informationsystem/tree/Node.java +++ b/src/main/java/org/gcube/informationsystem/tree/Node.java @@ -71,7 +71,7 @@ public class Node implements Comparable> { for (int i = 0; i < level; ++i) { stringBuffer.append(Node.INDENTATION); } - stringBuffer.append(tree.getNodeElementInformation().getIdentifier(t)); + stringBuffer.append(tree.getNodeInformation().getIdentifier(t)); for (Node child : children) { stringBuffer.append("\n"); stringBuffer.append(child.createTree(level+1)); @@ -91,9 +91,9 @@ public class Node implements Comparable> { return -1; } - NodeElementInformation nei = tree.getNodeElementInformation(); + NodeInformation ni = tree.getNodeInformation(); - return nei.getIdentifier(t).compareTo(nei.getIdentifier(other.t)); + return ni.getIdentifier(t).compareTo(ni.getIdentifier(other.t)); } diff --git a/src/main/java/org/gcube/informationsystem/tree/NodeElementInformation.java b/src/main/java/org/gcube/informationsystem/tree/NodeInformation.java similarity index 92% rename from src/main/java/org/gcube/informationsystem/tree/NodeElementInformation.java rename to src/main/java/org/gcube/informationsystem/tree/NodeInformation.java index b50457b..0ddbe21 100644 --- a/src/main/java/org/gcube/informationsystem/tree/NodeElementInformation.java +++ b/src/main/java/org/gcube/informationsystem/tree/NodeInformation.java @@ -2,7 +2,7 @@ package org.gcube.informationsystem.tree; import java.util.Set; -public interface NodeElementInformation { +public interface NodeInformation { public abstract String getIdentifier(T t); diff --git a/src/main/java/org/gcube/informationsystem/tree/Tree.java b/src/main/java/org/gcube/informationsystem/tree/Tree.java index d0a20ee..f5d1db0 100644 --- a/src/main/java/org/gcube/informationsystem/tree/Tree.java +++ b/src/main/java/org/gcube/informationsystem/tree/Tree.java @@ -12,12 +12,12 @@ public class Tree { private boolean allowMultipleInheritance; private Node root; - private NodeElementInformation nei; + private NodeInformation ni; private Map> locate; - public Tree(T t, NodeElementInformation nei) throws Exception { - this.allowMultipleInheritance = false; - this.nei = nei; + public Tree(T t, NodeInformation ni) throws Exception { + this.allowMultipleInheritance = true; + this.ni = ni; this.locate = new HashMap<>(); this.root = addNode(t); @@ -27,20 +27,20 @@ public class Tree { this.allowMultipleInheritance = allowMultipleInheritance; } - public NodeElementInformation getNodeElementInformation() { - return nei; + public NodeInformation getNodeInformation() { + return ni; } public Node addNode(T t) { - String identifier = nei.getIdentifier(t); + String identifier = ni.getIdentifier(t); if(locate.containsKey(identifier)) { - // Has been already added + // has been already added return locate.get(identifier); } Node node = new Node<>(t); - Set parentIdentifiers = nei.getParentIdentifiers(root.getNodeElement(), t); + Set parentIdentifiers = ni.getParentIdentifiers(root.getNodeElement(), t); for(String parentIdentifier : parentIdentifiers) { Node parentNode = locate.get(parentIdentifier); if(parentNode==null) { @@ -55,7 +55,7 @@ public class Tree { } this.locate.put(identifier, node); - this.nei.extraElaboration(t); + this.ni.extraElaboration(t); return node; }