Allow access to child NodeSelectors (fixes issue #MARMOTTA-611) Provide getter methodes for child nodes of different NodeSelector implementations
Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/10cec6ec Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/10cec6ec Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/10cec6ec Branch: refs/heads/MARMOTTA-556 Commit: 10cec6ec326c241bb238fa00a21690c98d9a9b79 Parents: 5a18f24 Author: Kai Schlegel <[email protected]> Authored: Thu May 7 09:44:43 2015 +0200 Committer: Kai Schlegel <[email protected]> Committed: Thu May 7 09:44:43 2015 +0200 ---------------------------------------------------------------------- .../ldpath/model/selectors/FunctionSelector.java | 8 +++++++- .../ldpath/model/selectors/GroupedSelector.java | 7 +++++++ .../model/selectors/IntersectionSelector.java | 15 +++++++++++++++ .../ldpath/model/selectors/PathSelector.java | 16 ++++++++++++++++ .../ldpath/model/selectors/UnionSelector.java | 16 ++++++++++++++++ 5 files changed, 61 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/marmotta/blob/10cec6ec/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/selectors/FunctionSelector.java ---------------------------------------------------------------------- diff --git a/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/selectors/FunctionSelector.java b/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/selectors/FunctionSelector.java index 429e23c..83b6dbc 100644 --- a/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/selectors/FunctionSelector.java +++ b/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/selectors/FunctionSelector.java @@ -92,7 +92,13 @@ public class FunctionSelector<Node> implements NodeSelector<Node> { return result; } - + /** + * Getter for child NodeSelectors + * @return child NodeSelectors + */ + public List<NodeSelector<Node>> getSelectors() { + return selectors; + } /** * Return the name of the NodeSelector for registration in the selector registry http://git-wip-us.apache.org/repos/asf/marmotta/blob/10cec6ec/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/selectors/GroupedSelector.java ---------------------------------------------------------------------- diff --git a/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/selectors/GroupedSelector.java b/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/selectors/GroupedSelector.java index 718a794..dc27225 100644 --- a/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/selectors/GroupedSelector.java +++ b/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/selectors/GroupedSelector.java @@ -78,6 +78,13 @@ public class GroupedSelector<Node> implements NodeSelector<Node> { throw new UnsupportedOperationException("cannot use a group in unnamed field definitions because the name is ambiguous"); } + /** + * Getter for the child content NodeSelector + * @return the child content NodeSelector + */ + public NodeSelector<Node> getContent() { + return content; + } @Override public boolean equals(Object o) { http://git-wip-us.apache.org/repos/asf/marmotta/blob/10cec6ec/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/selectors/IntersectionSelector.java ---------------------------------------------------------------------- diff --git a/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/selectors/IntersectionSelector.java b/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/selectors/IntersectionSelector.java index 95276d3..e4c6957 100644 --- a/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/selectors/IntersectionSelector.java +++ b/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/selectors/IntersectionSelector.java @@ -78,6 +78,21 @@ public class IntersectionSelector<Node> implements NodeSelector<Node> { throw new UnsupportedOperationException("cannot use intersections in unnamed field definitions because the name is ambiguous"); } + /** + * Getter for the left child node of the path selection. + * @return the left NodeSelector + */ + public NodeSelector<Node> getLeft() { + return left; + } + + /** + * Getter for the right child node of the path selection. + * @return the right NodeSelector + */ + public NodeSelector<Node> getRight() { + return right; + } @Override public boolean equals(Object o) { http://git-wip-us.apache.org/repos/asf/marmotta/blob/10cec6ec/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/selectors/PathSelector.java ---------------------------------------------------------------------- diff --git a/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/selectors/PathSelector.java b/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/selectors/PathSelector.java index 456991d..5b200ce 100644 --- a/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/selectors/PathSelector.java +++ b/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/selectors/PathSelector.java @@ -109,6 +109,22 @@ public class PathSelector<Node> implements NodeSelector<Node> { return true; } + /** + * Getter for the left child node of the path selection. + * @return the left NodeSelector + */ + public NodeSelector<Node> getLeft() { + return left; + } + + /** + * Getter for the right child node of the path selection. + * @return the right NodeSelector + */ + public NodeSelector<Node> getRight() { + return right; + } + @Override public int hashCode() { int result = left != null ? left.hashCode() : 0; http://git-wip-us.apache.org/repos/asf/marmotta/blob/10cec6ec/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/selectors/UnionSelector.java ---------------------------------------------------------------------- diff --git a/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/selectors/UnionSelector.java b/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/selectors/UnionSelector.java index 5e63262..a59d01e 100644 --- a/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/selectors/UnionSelector.java +++ b/libraries/ldpath/ldpath-core/src/main/java/org/apache/marmotta/ldpath/model/selectors/UnionSelector.java @@ -87,6 +87,22 @@ public class UnionSelector<Node> implements NodeSelector<Node> { throw new UnsupportedOperationException("cannot use unions in unnamed field definitions because the name is ambiguous"); } + /** + * Getter for the left child node of the path selection. + * @return the left NodeSelector + */ + public NodeSelector<Node> getLeft() { + return left; + } + + /** + * Getter for the right child node of the path selection. + * @return the right NodeSelector + */ + public NodeSelector<Node> getRight() { + return right; + } + @Override public boolean equals(Object o) {
