提交 09fe3862 编写于 作者: M Mathieu Bastian

Exclude default null type from partition if number of elements is zero

上级 65b3de06
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
*/ */
package org.gephi.appearance; package org.gephi.appearance;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import org.gephi.graph.api.Column; import org.gephi.graph.api.Column;
...@@ -66,7 +67,14 @@ public class EdgeTypePartitionImpl extends PartitionImpl { ...@@ -66,7 +67,14 @@ public class EdgeTypePartitionImpl extends PartitionImpl {
@Override @Override
public Collection getValues() { public Collection getValues() {
return Arrays.asList(model.getEdgeTypeLabels()); Object[] labels = model.getEdgeTypeLabels();
ArrayList<Object> col = new ArrayList<Object>(labels.length);
for (Object l : labels) {
if (!(l == null && graph.getEdgeCount(0) == 0)) {
col.add(l);
}
}
return col;
} }
@Override @Override
...@@ -92,7 +100,8 @@ public class EdgeTypePartitionImpl extends PartitionImpl { ...@@ -92,7 +100,8 @@ public class EdgeTypePartitionImpl extends PartitionImpl {
@Override @Override
public int size() { public int size() {
return model.getEdgeTypeCount(); int size = model.getEdgeTypeCount();
return graph.getEdgeCount(0) == 0 ? size - 1 : size;
} }
@Override @Override
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册