@Test public void testHas() { server.set(GraphName.of("/foo/bar/baz"), "bloop"); assertTrue(server.has(GraphName.of("/foo/bar/baz"))); assertTrue(server.has(GraphName.of("/foo/bar"))); assertTrue(server.has(GraphName.of("/foo"))); assertTrue(server.has(GraphName.of("/"))); }
@SuppressWarnings("unchecked") public boolean has(GraphName name) { Preconditions.checkArgument(name.isGlobal()); Stack<String> parts = getGraphNameParts(name); Map<String, Object> subtree = tree; while (!parts.empty() && subtree.containsKey(parts.peek())) { String part = parts.pop(); if (!parts.empty()) { subtree = (Map<String, Object>) subtree.get(part); } } return parts.empty(); }
ParameterServer { @SuppressWarnings("unchecked") public boolean has(GraphName name) { Preconditions.checkArgument(name.isGlobal()); Stack<String> parts = getGraphNameParts(name); Map<String, Object> subtree = tree; while (!parts.empty() && subtree.containsKey(parts.peek())) { String part = parts.pop(); if (!parts.empty()) { subtree = (Map<String, Object>) subtree.get(part); } } return parts.empty(); } }
ParameterServer { @SuppressWarnings("unchecked") public boolean has(GraphName name) { Preconditions.checkArgument(name.isGlobal()); Stack<String> parts = getGraphNameParts(name); Map<String, Object> subtree = tree; while (!parts.empty() && subtree.containsKey(parts.peek())) { String part = parts.pop(); if (!parts.empty()) { subtree = (Map<String, Object>) subtree.get(part); } } return parts.empty(); } ParameterServer(); }
ParameterServer { @SuppressWarnings("unchecked") public boolean has(GraphName name) { Preconditions.checkArgument(name.isGlobal()); Stack<String> parts = getGraphNameParts(name); Map<String, Object> subtree = tree; while (!parts.empty() && subtree.containsKey(parts.peek())) { String part = parts.pop(); if (!parts.empty()) { subtree = (Map<String, Object>) subtree.get(part); } } return parts.empty(); } ParameterServer(); void subscribe(GraphName name, NodeIdentifier nodeIdentifier); @SuppressWarnings("unchecked") Object get(GraphName name); void set(final GraphName name, final boolean value); void set(final GraphName name, final int value); void set(final GraphName name, final double value); void set(final GraphName name, final String value); void set(final GraphName name, final List<?> value); void set(final GraphName name, final Map<?, ?> value); @SuppressWarnings("unchecked") void delete(GraphName name); Object search(GraphName namespace, GraphName name); @SuppressWarnings("unchecked") boolean has(GraphName name); Collection<GraphName> getNames(); }
ParameterServer { @SuppressWarnings("unchecked") public boolean has(GraphName name) { Preconditions.checkArgument(name.isGlobal()); Stack<String> parts = getGraphNameParts(name); Map<String, Object> subtree = tree; while (!parts.empty() && subtree.containsKey(parts.peek())) { String part = parts.pop(); if (!parts.empty()) { subtree = (Map<String, Object>) subtree.get(part); } } return parts.empty(); } ParameterServer(); void subscribe(GraphName name, NodeIdentifier nodeIdentifier); @SuppressWarnings("unchecked") Object get(GraphName name); void set(final GraphName name, final boolean value); void set(final GraphName name, final int value); void set(final GraphName name, final double value); void set(final GraphName name, final String value); void set(final GraphName name, final List<?> value); void set(final GraphName name, final Map<?, ?> value); @SuppressWarnings("unchecked") void delete(GraphName name); Object search(GraphName namespace, GraphName name); @SuppressWarnings("unchecked") boolean has(GraphName name); Collection<GraphName> getNames();  }