/** * {@inheritDoc} * * @see org.modeshape.graph.property.Path#isDecendantOf(org.modeshape.graph.property.Path) */ @Override public boolean isDecendantOf( Path ancestor ) { if (parent == ancestor) return true; // same instance return parent.isAtOrBelow(ancestor); }
public void invalidate( Path path ) { assert path != null; for (Iterator<Path> iter = entriesByKey.keySet().iterator(); iter.hasNext();) { Path key = iter.next(); if (key.isAtOrBelow(path)) { iter.remove(); } } }
public void invalidate( Path path ) { assert path != null; for (Iterator<Path> iter = nodesByPath.keySet().iterator(); iter.hasNext();) { Path key = iter.next(); if (key.isAtOrBelow(path)) { iter.remove(); } } }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.ChangeRequest#changes(java.lang.String, org.modeshape.graph.property.Path) */ @Override public boolean changes( String workspace, Path path ) { return this.workspaceName.equals(workspace) && on.hasPath() && on.getPath().isAtOrBelow(path); }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.ChangeRequest#changes(java.lang.String, org.modeshape.graph.property.Path) */ @Override public boolean changes( String workspace, Path path ) { return this.workspaceName.equals(workspace) && on.hasPath() && on.getPath().isAtOrBelow(path); }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.ChangeRequest#changes(java.lang.String, org.modeshape.graph.property.Path) */ @Override public boolean changes( String workspace, Path path ) { return this.intoWorkspace.equals(workspace) && into.hasPath() && into.getPath().isAtOrBelow(path); }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.ChangeRequest#changes(java.lang.String, org.modeshape.graph.property.Path) */ @Override public boolean changes( String workspace, Path path ) { return this.workspaceName.equals(workspace) && from.hasPath() && from.getPath().isAtOrBelow(path); }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.ChangeRequest#changes(java.lang.String, org.modeshape.graph.property.Path) */ @Override public boolean changes( String workspace, Path path ) { return this.workspaceName.equals(workspace) && at.hasPath() && at.getPath().isAtOrBelow(path); }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.ChangeRequest#changes(java.lang.String, org.modeshape.graph.property.Path) */ @Override public boolean changes( String workspace, Path path ) { return this.workspaceName.equals(workspace) && at.hasPath() && at.getPath().isAtOrBelow(path); }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.ChangeRequest#changes(java.lang.String, org.modeshape.graph.property.Path) */ @Override public boolean changes( String workspace, Path path ) { return this.workspaceName.equals(workspace) && under.hasPath() && under.getPath().isAtOrBelow(path); }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.ChangeRequest#changes(java.lang.String, org.modeshape.graph.property.Path) */ @Override public boolean changes( String workspace, Path path ) { return into.hasPath() && into.getPath().isAtOrBelow(path); }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.ChangeRequest#changes(java.lang.String, org.modeshape.graph.property.Path) */ @Override public boolean changes( String workspace, Path path ) { return this.workspaceName.equals(workspace) && at.hasPath() && at.getPath().getParent().isAtOrBelow(path); }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.ChangeRequest#changes(java.lang.String, org.modeshape.graph.property.Path) */ @Override public boolean changes( String workspace, Path path ) { return this.workspaceName.equals(workspace) && at.hasPath() && at.getPath().getParent().isAtOrBelow(path); }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.ChangeRequest#changes(java.lang.String, org.modeshape.graph.property.Path) */ @Override public boolean changes( String workspace, Path path ) { return this.workspaceName.equals(workspace) && at.hasPath() && at.getPath().getParent().isAtOrBelow(path); }
/** * {@inheritDoc} * * @see org.modeshape.graph.request.ChangeRequest#changes(java.lang.String, org.modeshape.graph.property.Path) */ @Override public boolean changes( String workspace, Path path ) { if (this.into() != null) { return this.workspaceName.equals(workspace) && (into.hasPath() && into.getPath().isAtOrBelow(path) || from.hasPath() && from.getPath().isAtOrBelow(path)); } // into or before must be non-null assert before() != null; return this.workspaceName.equals(workspace) && (before.hasPath() && before.getPath().getParent().isAtOrBelow(path) || from.hasPath() && from.getPath().isAtOrBelow(path)); }
@Test( expected = IllegalArgumentException.class ) public void shouldFailForAtOrBelowNullPath() { path.isAtOrBelow(null); }
@Test( expected = IllegalArgumentException.class ) public void shouldFailForAtOrBelowNullPath() { path.isAtOrBelow(null); }
@Test public void shouldConsiderPathDecendantOfOtherPathIfParentIsAtOrBelowOtherPath() { parent = mock(Path.class); path = new ChildPath(parent, segment("d")); Path other = mock(Path.class); when(parent.isAtOrBelow(other)).thenReturn(true); assertThat(path.isDecendantOf(other), is(true)); verify(parent).isAtOrBelow(other); when(parent.isAtOrBelow(other)).thenReturn(false); assertThat(path.isDecendantOf(other), is(false)); verify(parent, times(2)).isAtOrBelow(other); }
@Test public void shouldConsiderNodeToBeAtOrBelowItself() { assertThat(path.isAtOrBelow(path), is(true)); }
@Test public void shouldConsiderNodeToBeAtOrBelowItself() { assertThat(path.isAtOrBelow(path), is(true)); }