/** Checks if an arrowpoint is allowed by background knowledge. */ public static boolean isArrowpointAllowed1(Node from, Node to, Knowledge knowledge) { if (knowledge == null) { return true; } return !knowledge.edgeRequired(to.toString(), from.toString()) && !knowledge.edgeForbidden(from.toString(), to.toString()); }
public void removeNode(Node n) { for (Node v : nodes) { if (v.toString().equals(n.toString())) { nodes.remove(v); return; } } // System.out.println("Node not found!!"); }
/*@ ensures \result != "";*/ public String toString() { return leftNode.toString(Node.Placement.RIGHT) + "(" + key.toString() + "," + obj.toString() + ")" + rightNode.toString(Node.Placement.LEFT); }
public String toString() { return n1.toString() + "\n" + n2.toString() + "\n" + insert.toString() + "\n" + " cost: " + this.cost; }
public String toString() { if (left == null && right == null) { return data + " " + "_" + " " + "_"; } else if (left == null) { return data + " " + "_" + " " + right.toString(); } else if (right == null) { return data + " " + left.toString() + " " + "_"; } else { return data + " " + left.toString() + " " + right.toString(); } }
/** Recursively prints a node and its children as a string. */ @Override public String toString() { return "[v:" + value + ",b:" + balance + ",l:" + (left == null ? "#" : left.toString()) + ",r:" + (right == null ? "#" : right.toString()) + "]"; }
public static boolean isArrowpointAllowed2(Node from, Node to, Knowledge knowledge, Graph graph) { if (knowledge == null) { return true; } if (!graph.getNodesInTo(to, Endpoint.ARROW).isEmpty()) { return false; } return !knowledge.edgeRequired(to.toString(), from.toString()) && !knowledge.edgeForbidden(from.toString(), to.toString()); }
public static void main(String[] args) throws Exception { Node node = new Node(); node.getInfo("smallville"); System.out.println(node.toString()); node.getAdjacentNodes(); System.out.println("========================="); System.out.println(node.toString()); System.out.println("=========== nodeX =============="); Node nodeX = node.AdjacentNodes.get(0); nodeX.getAdjacentNodes(); System.out.println(nodeX.toString()); }
public String toString() { String s = " " + data; if (left == null) { s += " _"; } else { s += left.toString(); } if (right == null) { s += " _"; } else { s += right.toString(); } return s; }
/** toString method */ public String toString() { if (next == null) { return value + ""; } else { return value + ", " + next.toString(); } }
public String toString() { String tree = ""; tree += startingNode.toString(); return tree; }
/** Returns a String representation of the list. */ public void display() { Node currentNode = head; while (currentNode != null) { System.out.println(currentNode.toString()); currentNode = currentNode.next; } }
private String toString(Node n, int depth, String pre) { if (n == null) return ""; String retString = ""; for (int d = 0; d < depth; d++) retString += " "; retString += pre + n.toString() + "\n"; return retString + toString(n.left, depth + 1, "L: ") + toString(n.right, depth + 1, "R: "); }
/** * Returns a URI that represents the Node. * * @param node the node representing the URI. * @throws GraphException * @return URI */ protected String getURI(Node node) throws GraphException { // value to be returned String uri = null; // determine type of subject node and create uri from it if (node != null) { try { if (node instanceof URIReference) { uri = ((URIReference) node).getURI().toString(); } else if (node instanceof BlankNode) { uri = new URI("#" + ((BlankNode) node).toString()).toString(); } else { uri = node.toString(); } } catch (URISyntaxException uriException) { throw new GraphException("Could not get URI for Node: " + node + ".", uriException); } } else { throw new GraphException("Could not get URI for Node: " + node + ". Node is null."); } // return the URI with any namespaces replaced with prefixes return this.replaceNamespace(uri); }
/** * Returns a String representation of an ObjectNode. Object values do not have to be escaped. * * @param node Node * @throws GraphException * @return String */ protected String getNodeString(Node node) throws GraphException { // value to be returned String object = null; // determine type of subject node and create uri from it if (node != null) { try { if (node instanceof URIReference) { object = ((URIReference) node).getURI().toString(); } else if (node instanceof BlankNode) { object = new URI("#" + ((BlankNode) node).toString()).toString(); } else if (node instanceof Literal) { object = ((Literal) node).getLexicalForm(); } else { object = node.toString(); } } catch (URISyntaxException uriException) { throw new GraphException( "Could not get String for ObjectNode: " + node + ".", uriException); } } else { throw new GraphException( "Could not get String for ObjectNode: " + node + ". ObjectNode is null."); } return object; }
@Override public EnhNode wrap(Node n, EnhGraph eg) { if (canWrap(n, eg)) { return new IndividualImpl(n, eg); } else { throw new ConversionException("Cannot convert node " + n.toString() + " to Individual"); } }
public String toString() { String s = ""; if (root == null) { return ""; } else { return root.toString(); } }
/** * A string representation of the node. * * @return A string representation */ @Override public String toString() { if (mNext != null) { return mNext.toString() + ", " + Integer.toString(mValue); } return Integer.toString(mValue); }
@Override public String toString() { String result = ""; for (Node child : children) { result += "(" + child.toString() + ")+"; } return result.substring(0, result.length() - 1); // remove trailing + }
public String getName() { // TODO does this make sense? Node child = jjtGetChild(0); if (child instanceof ASTVar) { return ((ASTVar) child).getName(); } else { return child.toString(); } }
@Override public String toString() { StringBuilder res = new StringBuilder(); for (Node n : versions) { if (n == null) res.append(String.format("[]")); else res.append(String.format("[%s]\n", n.toString())); } return res.toString(); }
public void visit(Node node) { System.out.println(indentString() + node.toString()); indent += 1; int count = node.jjtGetNumChildren(); for (int i = 0; i < count; i++) { Node child = node.jjtGetChild(i); visit(child); } indent -= 1; }
@Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("Model [dimensions="); builder.append(dimensions); builder.append(", root\n"); builder.append(StringUtil.indent(root.toString(), " ")); builder.append("\n]"); return builder.toString(); }
@Override public Node getChild(String name) { Node child = null; for (Node n : this.children) { if (n.toString().equals(name)) { child = n; break; } } return child; }
/** * Executes the "Printout" command * * @param commandList the command along with the necessary parameters specified by the user */ public void executePrintout(ArrayList<String> commandList) throws Exception { if (commandList.size() != 2 && commandList.size() != 3) { throw new Exception( "\nInvalid arguments, code not executed" + "\nCorrect Syntax: \nprintout node_name" + "\nprintout node1_name node2_name\n"); } if (commandList.size() == 2) { Node node = getNode(commandList.get(1)); System.out.println(node.toString()); // Also printout all the arcs the node is connected to // I kept it because it helped in debugging for (UndirectedArc undirArc : node.getArcs()) { System.out.println(undirArc.toString()); } for (DirectedArc dirArc : node.getInArcs()) { System.out.println(dirArc.toString()); } for (DirectedArc dirArc : node.getOutArcs()) { System.out.println(dirArc.toString()); } } else { Node node1 = getNode(commandList.get(1)); Node node2 = getNode(commandList.get(2)); Boolean arcExists = false; try { System.out.println(getDirArc(node1, node2).toString()); arcExists = true; } catch (Exception e) { } try { System.out.println(getDirArc(node2, node1).toString()); arcExists = true; } catch (Exception e) { } try { System.out.println(getUndirArc(node1, node2).toString()); arcExists = true; } catch (Exception e) { } if (!arcExists) { System.out.println("No arcs exist between node"); } } }
@Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("Node [splitter="); builder.append(splitter); builder.append(", count="); builder.append(count); builder.append(", bounds="); builder.append(bounds); if (null != left) { builder.append(", \nleft=\n"); builder.append(StringUtil.indent(left.toString(), " ")); } if (null != left) { builder.append(", \nright=\n"); builder.append(StringUtil.indent(right.toString(), " ")); } builder.append("\n]"); return builder.toString(); }
/** * Executes the "Nodes" command * * @param commandList the command along with the necessary parameters specified by the user */ public void executeNodes(ArrayList<String> commandList) throws Exception { if (commandList.size() != 1) { throw new Exception("\nInvalid arguments, code not executed" + "\nCorrect Syntax: \nnodes\n"); } HashSet<Node> nodeList = getNodes(); for (Node aNode : nodeList) { System.out.println(aNode.toString()); } }
@FixFor("MODE-1254") @Test public void shouldNotIncludeBinaryContentsInToString() throws Exception { altima = cache.findJcrNode(null, path("/Cars/Hybrid/Nissan Altima")); Node node = rootNode.addNode("nodeWithBinaryProperty", "nt:unstructured"); String value = "This is the string value"; Binary binaryValue = cache.session().getValueFactory().createBinary(new ByteArrayInputStream(value.getBytes())); node.setProperty("binProp", binaryValue); String toString = node.toString(); assertThat(toString.indexOf("**binary-value") > 0, is(true)); }
public String toString() { StringBuffer buffer = new StringBuffer(); if (head != null) { Node temp = head; while (temp != null) { buffer.append(temp.toString() + " "); temp = temp.next(); } } return buffer.toString(); }
@Override public String toString() { if (problemNode == null && getMessage() == null) return "ResolutionException (unknown cause)"; if (problemNode == null) return "AstException: " + getMessage(); String nodeDescription = problemNode == null ? "(null)" : (problemNode.getClass().getName() + "(toString failed)"); try { nodeDescription = problemNode.toString(); } catch (Throwable ignore) { // throwing exceptions in toString() is bad. } if (getMessage() == null) return "ResolutionException at " + nodeDescription; return String.format("ResolutionException: %s (at %s)", getMessage(), nodeDescription); }