Debugging in ImportAPI and ImportPlugin
Esse commit está contido em:
@@ -66,6 +66,9 @@ public class ElementFactoryImpl implements ElementDraftFactory {
|
||||
|
||||
@Override
|
||||
public NodeDraftImpl newNodeDraft(String id) {
|
||||
if (id == null) {
|
||||
throw new NullPointerException("Node id can't be null");
|
||||
}
|
||||
NodeDraftImpl node = new NodeDraftImpl(container, id);
|
||||
return node;
|
||||
}
|
||||
@@ -78,6 +81,9 @@ public class ElementFactoryImpl implements ElementDraftFactory {
|
||||
|
||||
@Override
|
||||
public EdgeDraftImpl newEdgeDraft(String id) {
|
||||
if (id == null) {
|
||||
throw new NullPointerException("Node id can't be null");
|
||||
}
|
||||
EdgeDraftImpl edge = new EdgeDraftImpl(container, id);
|
||||
return edge;
|
||||
}
|
||||
|
||||
+27
-2
@@ -278,6 +278,7 @@ public class ImportContainerImpl implements Container, ContainerLoader, Containe
|
||||
} else {
|
||||
int[] edges = edgeTypeSet.get(sourceTargetLong);
|
||||
int[] newEdges = new int[edges.length + 1];
|
||||
newEdges[edges.length] = index;
|
||||
System.arraycopy(edges, 0, newEdges, 0, edges.length);
|
||||
edgeTypeSet.put(sourceTargetLong, newEdges);
|
||||
|
||||
@@ -820,6 +821,23 @@ public class ImportContainerImpl implements Container, ContainerLoader, Containe
|
||||
|
||||
//Utility
|
||||
private int getEdgeType(Object type) {
|
||||
//Verify
|
||||
if (type != null) {
|
||||
Class cl = type.getClass();
|
||||
if (!(cl.equals(Integer.class)
|
||||
|| cl.equals(String.class)
|
||||
|| cl.equals(Float.class)
|
||||
|| cl.equals(Double.class)
|
||||
|| cl.equals(Short.class)
|
||||
|| cl.equals(Byte.class)
|
||||
|| cl.equals(Long.class)
|
||||
|| cl.equals(Character.class)
|
||||
|| cl.equals(Boolean.class))) {
|
||||
report.logIssue(new Issue(NbBundle.getMessage(ImportContainerImpl.class, "ImportContainerException_Unsupported_Edge_type", edgeDefault.toString()), Level.SEVERE));
|
||||
type = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (edgeTypeMap.containsKey(type)) {
|
||||
return edgeTypeMap.getInt(type);
|
||||
}
|
||||
@@ -901,6 +919,7 @@ public class ImportContainerImpl implements Container, ContainerLoader, Containe
|
||||
|
||||
private static class NullFilterIterator<T extends ElementDraft> implements Iterator<T> {
|
||||
|
||||
private T pointer;
|
||||
private final Iterator<T> itr;
|
||||
|
||||
public NullFilterIterator(Collection<T> elementCollection) {
|
||||
@@ -909,12 +928,18 @@ public class ImportContainerImpl implements Container, ContainerLoader, Containe
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return itr.hasNext();
|
||||
while (itr.hasNext()) {
|
||||
pointer = itr.next();
|
||||
if (pointer != null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T next() {
|
||||
return itr.next();
|
||||
return pointer;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,7 +13,9 @@ ImportContainerException_MissingNodeId = Missing Node Identifier
|
||||
ImportContainerException_edgeExist = Edge already exists id=''{0}''
|
||||
ImportContainerException_SelfLoop = Self loop are not allowed
|
||||
ImportContainerException_Bad_Edge_Type = Edge type doesn't fit with default set ({0}), edge id=''{1}'' is ignored
|
||||
ImportContainerException_Parallel_Edge = Parallel edges detected, their weight will be merged
|
||||
ImportContainerException_Parallel_Edge_Forbidden = Parallel edges are not allowed, edge id=''{0}'' is ignored
|
||||
ImportContainerException_Unsupported_Edge_type = Edge types can only have a primitive type value
|
||||
ImportContainerException_Set_EdgeDefault = Default edge type set as {0}
|
||||
ImportContainerException_Weight_Zero_Ignored = Edge weight is 0, the edge id=''{0}'' is ignored
|
||||
ImportContainerException_Negative_Weight = Edge id=''{0}'' has a negative weight
|
||||
|
||||
+4
-4
@@ -470,7 +470,7 @@ public class ImporterGDF implements FileImporter, LongTask {
|
||||
}
|
||||
} else if (column.getAttributeColumn() != null) {
|
||||
try {
|
||||
node.setValue(column.getAttributeColumn().getId(), data);
|
||||
node.parseAndSetValue(column.getAttributeColumn().getId(), data);
|
||||
} catch (Exception e) {
|
||||
String message = NbBundle.getMessage(ImporterGDF.class, "importerGDF_error_dataformat4", column.getAttributeColumn().getTypeClass().getSimpleName(), column.getAttributeColumn().getTitle(), node);
|
||||
report.logIssue(new Issue(message, Issue.Level.WARNING, e));
|
||||
@@ -493,9 +493,9 @@ public class ImporterGDF implements FileImporter, LongTask {
|
||||
break;
|
||||
case DIRECTED:
|
||||
if (Boolean.parseBoolean(data)) {
|
||||
edge.setType(EdgeDirection.DIRECTED);
|
||||
edge.setDirection(EdgeDirection.DIRECTED);
|
||||
} else {
|
||||
edge.setType(EdgeDirection.UNDIRECTED);
|
||||
edge.setDirection(EdgeDirection.UNDIRECTED);
|
||||
}
|
||||
break;
|
||||
case LABEL:
|
||||
@@ -511,7 +511,7 @@ public class ImporterGDF implements FileImporter, LongTask {
|
||||
}
|
||||
} else if (column.getAttributeColumn() != null) {
|
||||
try {
|
||||
edge.setValue(column.getAttributeColumn().getId(), data);
|
||||
edge.parseAndSetValue(column.getAttributeColumn().getId(), data);
|
||||
} catch (Exception e) {
|
||||
String message = NbBundle.getMessage(ImporterGDF.class, "importerGDF_error_dataformat4", column.getAttributeColumn().getTypeClass().getSimpleName(), column.getAttributeColumn().getTitle(), edge);
|
||||
report.logIssue(new Issue(message, Issue.Level.WARNING, e));
|
||||
|
||||
+2
-2
@@ -268,7 +268,7 @@ public class ImporterVNA implements FileImporter, LongTask {
|
||||
node = container.getNode(id);
|
||||
}
|
||||
for (int i = 1; i < nodeDataColumns.length; i++) {
|
||||
node.setValue(nodeDataColumns[i].getId(), nodeData[i]);
|
||||
node.parseAndSetValue(nodeDataColumns[i].getId(), nodeData[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,7 +340,7 @@ public class ImporterVNA implements FileImporter, LongTask {
|
||||
edge.setWeight(weight);
|
||||
break;
|
||||
case OTHER:
|
||||
edge.setValue(tieDataColumns[i].getId(), edgeData[i]);
|
||||
edge.parseAndSetValue(tieDataColumns[i].getId(), edgeData[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário