/** * Returns the number of rows. * @return number of rows */ public int getRowCount() { return table.getRowCount(); }
/** * Get the number of rows in the table. * @return the number of rows */ public int getRowCount() { return this.schemaTable.getRowCount(); }
/** * Returns the number of rows in the model. * A JTable uses this method to determine how many rows it should display. * This method should be quick, as it is called frequently during rendering. * @return the number of rows in the model */ public int getRowCount() { int currentRowCount = this.table.getRowCount(); if (currentRowCount > rowCount) { rowCount = currentRowCount; } return rowCount; }
@Override public int getRowCount() { if (table == null) { return 0; } else { return table.getRowCount(); } }
@Override public int capacity() { return table.getRowCount(); }
@Override public int size() { return table.getRowCount(); }
@Override public int size() { return table.getRowCount(); }
@Override public int capacity() { return table.getRowCount(); }
@Override public void ensureCapacity(int minCapacity) { if (minCapacity <= table.getRowCount()) { return; } int newRows = minCapacity - table.getRowCount(); for (int i = 0; i < newRows; i++) { table.addRow(); } }
@Override public int getLastRow() { int validEncounteredRows = 0; int currentRow = 0; while (validEncounteredRows < table.getRowCount()) { if (table.isValidRow(currentRow)) { validEncounteredRows++; } currentRow++; } return currentRow - 1; }
public ObviousWekaInstances(Table table, String name) { this(table, name, new FastVector(), table.getRowCount()); }
/** * Returns a collection of all edges of the tree. * @return all edges of the tree */ public Collection<Edge> getEdges() { Collection<Edge> edges = new ArrayList<Edge>(); for (int i = 0; i < edgeTable.getRowCount(); i++) { if (edgeTable.isValidRow(i)) { edges.add(new EdgeImpl(edgeTable, i)); } } return edges; }
/** * Gets a collection of children of a node in the tree. * @param node a node of the tree * @return children of the node */ public Collection<Node> getChildNodes(Node node) { Collection<Node> children = new ArrayList<Node>(); for (int i = 0; i < edgeTable.getRowCount(); i++) { if (getNodeId(node) == edgeTable.getValue(i, "parent")) { for (Map.Entry<Node, Integer> e : nodeToId.entrySet()) { if (e.getValue() == edgeTable.getValue(i, "child")) { children.add(e.getKey()); } } } } return children; }
/** * Returns a collection of all nodes of the graph. * @return all nodes of the graph */ public Collection<Node> getNodes() { Collection<Node> nodes = new ArrayList<Node>(); DynamicTable baseTable = graph.getVertexTable(); Table nodeTable = new IvtkObviousTable(baseTable); for (int i = 0; i < nodeTable.getRowCount(); i++) { nodes.add(new NodeImpl(nodeTable, i)); } return nodes; }
/** * Returns a collection of all edges of the graph. * @return all edges of the graph */ public Collection<Edge> getEdges() { Collection<Edge> edges = new ArrayList<Edge>(); DynamicTable baseTable = graph.getEdgeTable(); Table edgeTable = new IvtkObviousTable(baseTable); for (int i = 0; i < edgeTable.getRowCount(); i++) { edges.add(new EdgeImpl(edgeTable, i)); } return edges; }
/** * Gets a collection of child Edges of a node in the tree. * @param node a node of the tree * @return child edges of the tree */ public Collection<Edge> getChildEdges(Node node) { Collection<Edge> children = new ArrayList<Edge>(); for (int i = 0; i < edgeTable.getRowCount(); i++) { if (getNodeId(node) == edgeTable.getValue(i, "parent")) { children.add(new EdgeImpl(edgeTable, i)); } } return children; }
/** * Gets the parent node. * @param node a node of the tree * @return parent node */ public Node getParentNode(Node node) { Node parent = null; for (int i = 0; i < edgeTable.getRowCount(); i++) { if (getNodeId(node) == edgeTable.getValue(i, "child")) { for (Map.Entry<Node, Integer> e : nodeToId.entrySet()) { if (e.getValue() == edgeTable.getValue(i, "parent")) { parent = e.getKey(); break; } } } } return parent; }
/** * Loads the weka Instances from the Obvious table indicated in the * constructor. * @return a weka Instance */ public Instances loadInstances() { instances = new Instances("obvious-dataset", createAttributes(), table.getRowCount()); loadData(); return instances; }
/** * Gets the parent edge. * @param node a node of the tree * @return parent edge */ public Edge getParentEdge(Node node) { Edge parent = null; for (int i = 0; i < edgeTable.getRowCount(); i++) { if (getNodeId(node) == edgeTable.getValue(i, "child")) { parent = new EdgeImpl(edgeTable, i); } } return parent; }
/** * Gets for two nodes the connecting edge. * @param v1 first node * @param v2 second node * @return connecting edge */ public Edge getConnectingEdge(Node v1, Node v2) { Edge connecting = null; int v1Id = getNodeId(v1); int v2Id = getNodeId(v2); for (int i = 0; i < edgeTable.getRowCount(); i++) { int parentId = (Integer) edgeTable.getValue(i, "parent"); int childId = (Integer) edgeTable.getValue(i, "child"); if ((v1Id == parentId && v2Id == childId) || (v2Id == parentId && v1Id == childId)) { connecting = new EdgeImpl(edgeTable, i); } } return connecting; }