diff --git a/src/main/java/li/strolch/runtime/query/AndSelection.java b/src/main/java/li/strolch/runtime/query/AndSelection.java
new file mode 100644
index 000000000..bd2ddfe91
--- /dev/null
+++ b/src/main/java/li/strolch/runtime/query/AndSelection.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012, Robert von Burg
+ *
+ * All rights reserved.
+ *
+ * This file is part of the XXX.
+ *
+ * XXX is free software: you can redistribute
+ * it and/or modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * XXX is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XXX. If not, see
+ * .
+ */
+package li.strolch.runtime.query;
+
+import java.util.List;
+
+/**
+ * @author Robert von Burg
+ *
+ */
+public class AndSelection extends BooleanSelection {
+
+ /**
+ * @param selections
+ */
+ public AndSelection(List> selections) {
+ super(selections);
+ }
+
+ public AndSelection(Selection leftHandSide, Selection rightHandSide) {
+ super(leftHandSide, rightHandSide);
+ }
+
+ @Override
+ public void accept(QueryVisitor visitor) {
+ visitor.visitAnd(this);
+ }
+}
diff --git a/src/main/java/li/strolch/runtime/query/BooleanSelection.java b/src/main/java/li/strolch/runtime/query/BooleanSelection.java
new file mode 100644
index 000000000..7abb8f1f7
--- /dev/null
+++ b/src/main/java/li/strolch/runtime/query/BooleanSelection.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2012, Robert von Burg
+ *
+ * All rights reserved.
+ *
+ * This file is part of the XXX.
+ *
+ * XXX is free software: you can redistribute
+ * it and/or modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * XXX is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XXX. If not, see
+ * .
+ */
+package li.strolch.runtime.query;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Robert von Burg
+ *
+ */
+public abstract class BooleanSelection implements Selection {
+
+ protected List> selections;
+
+ public BooleanSelection(Selection leftHandSide, Selection rightHandSide) {
+ this.selections = new ArrayList<>();
+ this.selections.add(leftHandSide);
+ this.selections.add(rightHandSide);
+ }
+
+ public BooleanSelection(List> selections) {
+ this.selections = selections;
+ }
+
+ public List> getSelections() {
+ return this.selections;
+ }
+}
diff --git a/src/main/java/li/strolch/runtime/query/inmemory/InMemoryResourceQueryVisitor.java b/src/main/java/li/strolch/runtime/query/ElementQuery.java
similarity index 59%
rename from src/main/java/li/strolch/runtime/query/inmemory/InMemoryResourceQueryVisitor.java
rename to src/main/java/li/strolch/runtime/query/ElementQuery.java
index 7cc02ac8c..0b509b1d9 100644
--- a/src/main/java/li/strolch/runtime/query/inmemory/InMemoryResourceQueryVisitor.java
+++ b/src/main/java/li/strolch/runtime/query/ElementQuery.java
@@ -19,37 +19,33 @@
* along with XXX. If not, see
* .
*/
-package li.strolch.runtime.query.inmemory;
+package li.strolch.runtime.query;
import java.util.ArrayList;
import java.util.List;
-import li.strolch.model.Resource;
-import li.strolch.runtime.component.ComponentContainer;
-import li.strolch.runtime.query.ResourceQuery;
-import li.strolch.runtime.query.ResourceQueryVisitor;
+import li.strolch.runtime.query.visitor.StrolchElementVisitor;
/**
* @author Robert von Burg
*
*/
-public class InMemoryResourceQueryVisitor implements ResourceQueryVisitor {
+public class ElementQuery implements Query {
- private ArrayList result;
-
- public List performQuery(ComponentContainer container, ResourceQuery query) {
- this.result = new ArrayList<>();
+ private Navigation navigation;
+ private List> selections;
- query.accept(this);
-
- return this.result;
+ public ElementQuery(Navigation navigation) {
+ this.selections = new ArrayList<>();
}
@Override
- public void visit(ResourceQuery resourceQuery) {
- // TODO Auto-generated method stub
+ public void visit(StrolchElementVisitor queryVisitor) {
+ this.navigation.accept(queryVisitor);
+
+ for (Selection selection : this.selections) {
+ selection.accept(queryVisitor);
+ }
}
-
-
}
diff --git a/src/main/java/li/strolch/runtime/query/IdSelection.java b/src/main/java/li/strolch/runtime/query/IdSelection.java
new file mode 100644
index 000000000..1a8f5a431
--- /dev/null
+++ b/src/main/java/li/strolch/runtime/query/IdSelection.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2012, Robert von Burg
+ *
+ * All rights reserved.
+ *
+ * This file is part of the XXX.
+ *
+ * XXX is free software: you can redistribute
+ * it and/or modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * XXX is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XXX. If not, see
+ * .
+ */
+package li.strolch.runtime.query;
+
+import li.strolch.runtime.query.visitor.StrolchElementVisitor;
+
+/**
+ * @author Robert von Burg
+ *
+ */
+public class IdSelection implements Selection {
+
+ private String id;
+
+ /**
+ * @param id
+ */
+ public IdSelection(String id) {
+ this.id = id;
+ }
+
+ /**
+ * @return the id
+ */
+ public String getId() {
+ return this.id;
+ }
+
+ @Override
+ public void accept(StrolchElementVisitor visitor) {
+ visitor.visit(this);
+ }
+}
diff --git a/src/main/java/li/strolch/runtime/query/NameSelection.java b/src/main/java/li/strolch/runtime/query/NameSelection.java
new file mode 100644
index 000000000..8c49dcc1d
--- /dev/null
+++ b/src/main/java/li/strolch/runtime/query/NameSelection.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2012, Robert von Burg
+ *
+ * All rights reserved.
+ *
+ * This file is part of the XXX.
+ *
+ * XXX is free software: you can redistribute
+ * it and/or modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * XXX is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XXX. If not, see
+ * .
+ */
+package li.strolch.runtime.query;
+
+import li.strolch.runtime.query.visitor.StrolchElementVisitor;
+
+/**
+ * @author Robert von Burg
+ *
+ */
+public class NameSelection implements Selection {
+
+ private String name;
+
+ /**
+ * @param name
+ */
+ public NameSelection(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ @Override
+ public void accept(StrolchElementVisitor visitor) {
+ visitor.visit(this);
+ }
+}
diff --git a/src/main/java/li/strolch/runtime/query/ByElementSelection.java b/src/main/java/li/strolch/runtime/query/Navigation.java
similarity index 89%
rename from src/main/java/li/strolch/runtime/query/ByElementSelection.java
rename to src/main/java/li/strolch/runtime/query/Navigation.java
index 18dabf240..279d1f0a5 100644
--- a/src/main/java/li/strolch/runtime/query/ByElementSelection.java
+++ b/src/main/java/li/strolch/runtime/query/Navigation.java
@@ -23,11 +23,9 @@ package li.strolch.runtime.query;
/**
* @author Robert von Burg
- *
+ *
*/
-public class ByElementSelection {
+public interface Navigation {
- private String id;
- private String name;
- private String type;
+ public void accept(T visitor);
}
diff --git a/src/main/java/li/strolch/runtime/query/OrSelection.java b/src/main/java/li/strolch/runtime/query/OrSelection.java
new file mode 100644
index 000000000..0b5d9741c
--- /dev/null
+++ b/src/main/java/li/strolch/runtime/query/OrSelection.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2012, Robert von Burg
+ *
+ * All rights reserved.
+ *
+ * This file is part of the XXX.
+ *
+ * XXX is free software: you can redistribute
+ * it and/or modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * XXX is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XXX. If not, see
+ * .
+ */
+package li.strolch.runtime.query;
+
+import java.util.List;
+
+/**
+ * @author Robert von Burg
+ *
+ */
+public class OrSelection extends BooleanSelection {
+
+ public OrSelection(List> selections) {
+ super(selections);
+ }
+
+ public OrSelection(Selection leftHandSide, Selection rightHandSide) {
+ super(leftHandSide, rightHandSide);
+ }
+
+ @Override
+ public void accept(QueryVisitor visitor) {
+ visitor.visitOr(this);
+ }
+}
diff --git a/src/main/java/li/strolch/runtime/query/OrderTypeNavigation.java b/src/main/java/li/strolch/runtime/query/OrderTypeNavigation.java
new file mode 100644
index 000000000..4ea5650f8
--- /dev/null
+++ b/src/main/java/li/strolch/runtime/query/OrderTypeNavigation.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2012, Robert von Burg
+ *
+ * All rights reserved.
+ *
+ * This file is part of the XXX.
+ *
+ * XXX is free software: you can redistribute
+ * it and/or modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * XXX is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XXX. If not, see
+ * .
+ */
+package li.strolch.runtime.query;
+
+import li.strolch.runtime.query.visitor.StrolchElementVisitor;
+
+/**
+ * @author Robert von Burg
+ *
+ */
+public class OrderTypeNavigation extends StrolchTypeNavigation {
+
+ /**
+ * @param type
+ */
+ OrderTypeNavigation(String type) {
+ super(type);
+ }
+
+ @Override
+ public void accept(StrolchElementVisitor visitor) {
+ visitor.visit(this);
+ }
+}
diff --git a/src/main/java/li/strolch/runtime/query/Query.java b/src/main/java/li/strolch/runtime/query/Query.java
new file mode 100644
index 000000000..0dcd0044d
--- /dev/null
+++ b/src/main/java/li/strolch/runtime/query/Query.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2012, Robert von Burg
+ *
+ * All rights reserved.
+ *
+ * This file is part of the XXX.
+ *
+ * XXX is free software: you can redistribute
+ * it and/or modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * XXX is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XXX. If not, see
+ * .
+ */
+package li.strolch.runtime.query;
+
+/**
+ * @author Robert von Burg
+ *
+ */
+public interface Query {
+
+ public void visit(T queryVisitor);
+}
diff --git a/src/main/java/li/strolch/runtime/query/ResourceQuery.java b/src/main/java/li/strolch/runtime/query/QueryVisitor.java
similarity index 81%
rename from src/main/java/li/strolch/runtime/query/ResourceQuery.java
rename to src/main/java/li/strolch/runtime/query/QueryVisitor.java
index d3cec2274..bb9234911 100644
--- a/src/main/java/li/strolch/runtime/query/ResourceQuery.java
+++ b/src/main/java/li/strolch/runtime/query/QueryVisitor.java
@@ -21,22 +21,14 @@
*/
package li.strolch.runtime.query;
-import java.util.List;
-
-import li.strolch.model.Resource;
/**
* @author Robert von Burg
- *
+ *
*/
-public class ResourceQuery {
-
-
- private String byType;
-
-
+public interface QueryVisitor {
- public void accept(ResourceQueryVisitor visitor) {
- visitor.visit(this);
- }
+ public void visitAnd(AndSelection andSelection);
+
+ public void visitOr(OrSelection orSelection);
}
diff --git a/src/main/java/li/strolch/runtime/query/ResourceTypeNavigation.java b/src/main/java/li/strolch/runtime/query/ResourceTypeNavigation.java
new file mode 100644
index 000000000..06008f74f
--- /dev/null
+++ b/src/main/java/li/strolch/runtime/query/ResourceTypeNavigation.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2012, Robert von Burg
+ *
+ * All rights reserved.
+ *
+ * This file is part of the XXX.
+ *
+ * XXX is free software: you can redistribute
+ * it and/or modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * XXX is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XXX. If not, see
+ * .
+ */
+package li.strolch.runtime.query;
+
+import li.strolch.runtime.query.visitor.StrolchElementVisitor;
+
+/**
+ * @author Robert von Burg
+ *
+ */
+public class ResourceTypeNavigation extends StrolchTypeNavigation{
+
+ /**
+ * @param type
+ */
+ ResourceTypeNavigation(String type) {
+ super(type);
+ }
+
+ @Override
+ public void accept(StrolchElementVisitor visitor) {
+ visitor.visit(this);
+ }
+}
diff --git a/src/main/java/li/strolch/runtime/query/ResourceQueryVisitor.java b/src/main/java/li/strolch/runtime/query/Selection.java
similarity index 90%
rename from src/main/java/li/strolch/runtime/query/ResourceQueryVisitor.java
rename to src/main/java/li/strolch/runtime/query/Selection.java
index f826bc2c2..8bce956fc 100644
--- a/src/main/java/li/strolch/runtime/query/ResourceQueryVisitor.java
+++ b/src/main/java/li/strolch/runtime/query/Selection.java
@@ -25,7 +25,7 @@ package li.strolch.runtime.query;
* @author Robert von Burg
*
*/
-public interface ResourceQueryVisitor {
+public interface Selection {
- public void visit(ResourceQuery query);
+ public void accept(T visitor);
}
diff --git a/src/main/java/li/strolch/runtime/query/StrolchElementSelection.java b/src/main/java/li/strolch/runtime/query/StrolchElementSelection.java
new file mode 100644
index 000000000..c9d6e5c61
--- /dev/null
+++ b/src/main/java/li/strolch/runtime/query/StrolchElementSelection.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2012, Robert von Burg
+ *
+ * All rights reserved.
+ *
+ * This file is part of the XXX.
+ *
+ * XXX is free software: you can redistribute
+ * it and/or modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * XXX is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XXX. If not, see
+ * .
+ */
+package li.strolch.runtime.query;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import li.strolch.runtime.query.visitor.StrolchElementVisitor;
+
+/**
+ * @author Robert von Burg
+ *
+ */
+public class StrolchElementSelection {
+
+ private List> selections;
+
+ public StrolchElementSelection() {
+ this.selections = new ArrayList<>();
+ }
+
+ public void addSelection(Selection selection) {
+ this.selections.add(selection);
+ }
+}
diff --git a/src/main/java/li/strolch/runtime/query/TypeSelection.java b/src/main/java/li/strolch/runtime/query/StrolchTypeNavigation.java
similarity index 82%
rename from src/main/java/li/strolch/runtime/query/TypeSelection.java
rename to src/main/java/li/strolch/runtime/query/StrolchTypeNavigation.java
index 7be6eb85e..f1185f71b 100644
--- a/src/main/java/li/strolch/runtime/query/TypeSelection.java
+++ b/src/main/java/li/strolch/runtime/query/StrolchTypeNavigation.java
@@ -21,18 +21,17 @@
*/
package li.strolch.runtime.query;
+import li.strolch.runtime.query.visitor.StrolchElementVisitor;
+
/**
* @author Robert von Burg
*
*/
-public class TypeSelection {
+public abstract class StrolchTypeNavigation implements Navigation {
private String type;
- /**
- * @param type
- */
- public TypeSelection(String type) {
+ StrolchTypeNavigation(String type) {
this.type = type;
}
diff --git a/src/main/java/li/strolch/runtime/query/inmemory/BooleanVisitor.java b/src/main/java/li/strolch/runtime/query/inmemory/BooleanVisitor.java
new file mode 100644
index 000000000..8f8450728
--- /dev/null
+++ b/src/main/java/li/strolch/runtime/query/inmemory/BooleanVisitor.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2012, Robert von Burg
+ *
+ * All rights reserved.
+ *
+ * This file is part of the XXX.
+ *
+ * XXX is free software: you can redistribute
+ * it and/or modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * XXX is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XXX. If not, see
+ * .
+ */
+package li.strolch.runtime.query.inmemory;
+
+import java.util.List;
+
+import li.strolch.model.StrolchElement;
+import li.strolch.runtime.query.AndSelection;
+import li.strolch.runtime.query.BooleanSelection;
+import li.strolch.runtime.query.OrSelection;
+import li.strolch.runtime.query.QueryVisitor;
+
+/**
+ * @author Robert von Burg
+ *
+ */
+public class BooleanVisitor implements QueryVisitor {
+
+ private List> selectors;
+
+ /**
+ * @param selectors
+ */
+ public BooleanVisitor(List> selectors) {
+ this.selectors = selectors;
+ }
+
+ /**
+ * @param selection
+ */
+ public void visit(BooleanSelection selection) {
+ selection.accept(this);
+ }
+
+ @Override
+ public void visitAnd(AndSelection selection) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void visitOr(OrSelection selection) {
+ // TODO Auto-generated method stub
+
+ }
+}
diff --git a/src/main/java/li/strolch/runtime/query/inmemory/InMemoryQueryVisitor.java b/src/main/java/li/strolch/runtime/query/inmemory/InMemoryQueryVisitor.java
new file mode 100644
index 000000000..a9f4d7c72
--- /dev/null
+++ b/src/main/java/li/strolch/runtime/query/inmemory/InMemoryQueryVisitor.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2012, Robert von Burg
+ *
+ * All rights reserved.
+ *
+ * This file is part of the XXX.
+ *
+ * XXX is free software: you can redistribute
+ * it and/or modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * XXX is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XXX. If not, see
+ * .
+ */
+package li.strolch.runtime.query.inmemory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import li.strolch.model.StrolchElement;
+import li.strolch.runtime.component.ComponentContainer;
+import li.strolch.runtime.query.AndSelection;
+import li.strolch.runtime.query.ElementQuery;
+import li.strolch.runtime.query.IdSelection;
+import li.strolch.runtime.query.NameSelection;
+import li.strolch.runtime.query.OrSelection;
+import li.strolch.runtime.query.OrderTypeNavigation;
+import li.strolch.runtime.query.QueryVisitor;
+import li.strolch.runtime.query.ResourceTypeNavigation;
+import li.strolch.runtime.query.Selection;
+import li.strolch.runtime.query.visitor.StrolchElementVisitor;
+
+/**
+ * @author Robert von Burg
+ */
+public class InMemoryQueryVisitor implements StrolchElementVisitor {
+
+ private Navigator navigator;
+ private List> selectors;
+ private ComponentContainer container;
+
+ public InMemoryQueryVisitor(ComponentContainer container) {
+ this.container = container;
+ this.selectors = new ArrayList<>();
+ }
+
+ /**
+ * @return the navigator
+ */
+ public Navigator getNavigator() {
+ return this.navigator;
+ }
+
+ /**
+ * @return the selectors
+ */
+ public List> getSelectors() {
+ return this.selectors;
+ }
+
+ public void visit(ElementQuery query) {
+ query.visit(this);
+ }
+
+ @Override
+ public void visitAnd(AndSelection andSelection) {
+ InMemoryQueryVisitor visitor = new InMemoryQueryVisitor<>(this.container);
+ List> selections = andSelection.getSelections();
+ for (Selection selection : selections) {
+ selection.accept(visitor);
+ }
+
+ AndSelector andSelector = new AndSelector<>(visitor.getSelectors());
+ this.selectors.add(andSelector);
+ }
+
+ @Override
+ public void visitOr(OrSelection orSelection) {
+ InMemoryQueryVisitor visitor = new InMemoryQueryVisitor<>(this.container);
+ List> selections = orSelection.getSelections();
+ for (Selection selection : selections) {
+ selection.accept(visitor);
+ }
+
+ OrSelector andSelector = new OrSelector<>(visitor.getSelectors());
+ this.selectors.add(andSelector);
+ }
+
+ @Override
+ public void visit(IdSelection selection) {
+ this.selectors.add(new IdSelector(selection.getId()));
+ }
+
+ @Override
+ public void visit(NameSelection selection) {
+ this.selectors.add(new NameSelector(selection.getName()));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void visit(OrderTypeNavigation navigation) {
+ this.navigator = (Navigator) new OrderTypeNavigator(navigation.getType(), this.container);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void visit(ResourceTypeNavigation navigation) {
+ // XXX not good... class should be parameterized, but then there is no sense in ResourceType... but then one would need the ElementMap passed in...
+ this.navigator = (Navigator) new ResourceTypeNavigator(navigation.getType(), this.container);
+ }
+}
diff --git a/src/test/java/li/strolch/runtime/query/inmemory/ListNavigator.java b/src/main/java/li/strolch/runtime/query/inmemory/ListNavigator.java
similarity index 100%
rename from src/test/java/li/strolch/runtime/query/inmemory/ListNavigator.java
rename to src/main/java/li/strolch/runtime/query/inmemory/ListNavigator.java
diff --git a/src/main/java/li/strolch/runtime/query/inmemory/OrderTypeNavigator.java b/src/main/java/li/strolch/runtime/query/inmemory/OrderTypeNavigator.java
index 21316c880..094785111 100644
--- a/src/main/java/li/strolch/runtime/query/inmemory/OrderTypeNavigator.java
+++ b/src/main/java/li/strolch/runtime/query/inmemory/OrderTypeNavigator.java
@@ -28,7 +28,6 @@ import li.strolch.runtime.component.ComponentContainer;
/**
* @author Robert von Burg
- *
*/
public class OrderTypeNavigator extends StrolchTypeNavigator {
diff --git a/src/main/java/li/strolch/runtime/query/inmemory/StrolchTypeNavigationVisitor.java b/src/main/java/li/strolch/runtime/query/inmemory/StrolchTypeNavigationVisitor.java
new file mode 100644
index 000000000..50d34cea8
--- /dev/null
+++ b/src/main/java/li/strolch/runtime/query/inmemory/StrolchTypeNavigationVisitor.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2012, Robert von Burg
+ *
+ * All rights reserved.
+ *
+ * This file is part of the XXX.
+ *
+ * XXX is free software: you can redistribute
+ * it and/or modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * XXX is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XXX. If not, see
+ * .
+ */
+package li.strolch.runtime.query.inmemory;
+
+/**
+ * @author Robert von Burg
+ *
+ */
+public class StrolchTypeNavigationVisitor {
+
+}
diff --git a/src/main/java/li/strolch/runtime/query/visitor/StrolchElementVisitor.java b/src/main/java/li/strolch/runtime/query/visitor/StrolchElementVisitor.java
new file mode 100644
index 000000000..70795ed5e
--- /dev/null
+++ b/src/main/java/li/strolch/runtime/query/visitor/StrolchElementVisitor.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2012, Robert von Burg
+ *
+ * All rights reserved.
+ *
+ * This file is part of the XXX.
+ *
+ * XXX is free software: you can redistribute
+ * it and/or modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * XXX is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XXX. If not, see
+ * .
+ */
+package li.strolch.runtime.query.visitor;
+
+import li.strolch.runtime.query.IdSelection;
+import li.strolch.runtime.query.NameSelection;
+import li.strolch.runtime.query.OrderTypeNavigation;
+import li.strolch.runtime.query.QueryVisitor;
+import li.strolch.runtime.query.ResourceTypeNavigation;
+
+/**
+ * @author Robert von Burg
+ *
+ */
+public interface StrolchElementVisitor extends QueryVisitor {
+
+ public void visit(IdSelection selection);
+
+ public void visit(NameSelection selection);
+
+ public void visit(OrderTypeNavigation navigation);
+
+ public void visit(ResourceTypeNavigation navigation);
+}
diff --git a/src/test/java/li/strolch/runtime/ComponentContainerTest.java b/src/test/java/li/strolch/runtime/test/component/ComponentContainerTest.java
similarity index 90%
rename from src/test/java/li/strolch/runtime/ComponentContainerTest.java
rename to src/test/java/li/strolch/runtime/test/component/ComponentContainerTest.java
index 98aff4033..4994604e8 100644
--- a/src/test/java/li/strolch/runtime/ComponentContainerTest.java
+++ b/src/test/java/li/strolch/runtime/test/component/ComponentContainerTest.java
@@ -1,4 +1,4 @@
-package li.strolch.runtime;
+package li.strolch.runtime.test.component;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -8,9 +8,6 @@ import java.io.File;
import li.strolch.model.Resource;
import li.strolch.runtime.agent.StrolchAgent;
import li.strolch.runtime.component.ComponentContainer;
-import li.strolch.runtime.test.PersistenceHandlerTest;
-import li.strolch.runtime.test.ServiceHandlerTest;
-import li.strolch.runtime.test.ServiceResultTest;
import org.junit.Test;
import org.slf4j.Logger;
diff --git a/src/test/java/li/strolch/runtime/ConfigurationParserTest.java b/src/test/java/li/strolch/runtime/test/component/ConfigurationParserTest.java
similarity index 98%
rename from src/test/java/li/strolch/runtime/ConfigurationParserTest.java
rename to src/test/java/li/strolch/runtime/test/component/ConfigurationParserTest.java
index 94d06139a..98cf82dc9 100644
--- a/src/test/java/li/strolch/runtime/ConfigurationParserTest.java
+++ b/src/test/java/li/strolch/runtime/test/component/ConfigurationParserTest.java
@@ -1,4 +1,4 @@
-package li.strolch.runtime;
+package li.strolch.runtime.test.component;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
diff --git a/src/test/java/li/strolch/runtime/ControllerDependencyTest.java b/src/test/java/li/strolch/runtime/test/component/ControllerDependencyTest.java
similarity index 99%
rename from src/test/java/li/strolch/runtime/ControllerDependencyTest.java
rename to src/test/java/li/strolch/runtime/test/component/ControllerDependencyTest.java
index 50bc05321..d84066c20 100644
--- a/src/test/java/li/strolch/runtime/ControllerDependencyTest.java
+++ b/src/test/java/li/strolch/runtime/test/component/ControllerDependencyTest.java
@@ -1,4 +1,4 @@
-package li.strolch.runtime;
+package li.strolch.runtime.test.component;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
diff --git a/src/test/java/li/strolch/runtime/test/PersistenceHandlerTest.java b/src/test/java/li/strolch/runtime/test/component/PersistenceHandlerTest.java
similarity index 77%
rename from src/test/java/li/strolch/runtime/test/PersistenceHandlerTest.java
rename to src/test/java/li/strolch/runtime/test/component/PersistenceHandlerTest.java
index 9bfeeb934..b740e7774 100644
--- a/src/test/java/li/strolch/runtime/test/PersistenceHandlerTest.java
+++ b/src/test/java/li/strolch/runtime/test/component/PersistenceHandlerTest.java
@@ -1,4 +1,4 @@
-package li.strolch.runtime.test;
+package li.strolch.runtime.test.component;
import li.strolch.model.Resource;
diff --git a/src/test/java/li/strolch/runtime/test/PersistenceHandlerTestImpl.java b/src/test/java/li/strolch/runtime/test/component/PersistenceHandlerTestImpl.java
similarity index 92%
rename from src/test/java/li/strolch/runtime/test/PersistenceHandlerTestImpl.java
rename to src/test/java/li/strolch/runtime/test/component/PersistenceHandlerTestImpl.java
index 5096f6044..582f8c4ca 100644
--- a/src/test/java/li/strolch/runtime/test/PersistenceHandlerTestImpl.java
+++ b/src/test/java/li/strolch/runtime/test/component/PersistenceHandlerTestImpl.java
@@ -1,4 +1,4 @@
-package li.strolch.runtime.test;
+package li.strolch.runtime.test.component;
import li.strolch.model.Resource;
import li.strolch.runtime.component.ComponentContainer;
diff --git a/src/test/java/li/strolch/runtime/test/PostInitializerTest.java b/src/test/java/li/strolch/runtime/test/component/PostInitializerTest.java
similarity index 59%
rename from src/test/java/li/strolch/runtime/test/PostInitializerTest.java
rename to src/test/java/li/strolch/runtime/test/component/PostInitializerTest.java
index 5c620096b..f8c6b48c1 100644
--- a/src/test/java/li/strolch/runtime/test/PostInitializerTest.java
+++ b/src/test/java/li/strolch/runtime/test/component/PostInitializerTest.java
@@ -1,4 +1,4 @@
-package li.strolch.runtime.test;
+package li.strolch.runtime.test.component;
public interface PostInitializerTest {
diff --git a/src/test/java/li/strolch/runtime/test/PostInitializerTestImpl.java b/src/test/java/li/strolch/runtime/test/component/PostInitializerTestImpl.java
similarity index 88%
rename from src/test/java/li/strolch/runtime/test/PostInitializerTestImpl.java
rename to src/test/java/li/strolch/runtime/test/component/PostInitializerTestImpl.java
index 955923a37..7e3761146 100644
--- a/src/test/java/li/strolch/runtime/test/PostInitializerTestImpl.java
+++ b/src/test/java/li/strolch/runtime/test/component/PostInitializerTestImpl.java
@@ -1,4 +1,4 @@
-package li.strolch.runtime.test;
+package li.strolch.runtime.test.component;
import li.strolch.runtime.component.ComponentContainer;
import li.strolch.runtime.component.StrolchComponent;
diff --git a/src/test/java/li/strolch/runtime/test/ServiceHandlerTest.java b/src/test/java/li/strolch/runtime/test/component/ServiceHandlerTest.java
similarity index 65%
rename from src/test/java/li/strolch/runtime/test/ServiceHandlerTest.java
rename to src/test/java/li/strolch/runtime/test/component/ServiceHandlerTest.java
index 166e5dbed..f3c47260d 100644
--- a/src/test/java/li/strolch/runtime/test/ServiceHandlerTest.java
+++ b/src/test/java/li/strolch/runtime/test/component/ServiceHandlerTest.java
@@ -1,4 +1,4 @@
-package li.strolch.runtime.test;
+package li.strolch.runtime.test.component;
public interface ServiceHandlerTest {
diff --git a/src/test/java/li/strolch/runtime/test/ServiceHandlerTestImpl.java b/src/test/java/li/strolch/runtime/test/component/ServiceHandlerTestImpl.java
similarity index 90%
rename from src/test/java/li/strolch/runtime/test/ServiceHandlerTestImpl.java
rename to src/test/java/li/strolch/runtime/test/component/ServiceHandlerTestImpl.java
index cf29a29d0..edfbb4bfc 100644
--- a/src/test/java/li/strolch/runtime/test/ServiceHandlerTestImpl.java
+++ b/src/test/java/li/strolch/runtime/test/component/ServiceHandlerTestImpl.java
@@ -1,4 +1,4 @@
-package li.strolch.runtime.test;
+package li.strolch.runtime.test.component;
import li.strolch.runtime.component.ComponentContainer;
import li.strolch.runtime.component.StrolchComponent;
diff --git a/src/test/java/li/strolch/runtime/test/ServiceResultTest.java b/src/test/java/li/strolch/runtime/test/component/ServiceResultTest.java
similarity index 80%
rename from src/test/java/li/strolch/runtime/test/ServiceResultTest.java
rename to src/test/java/li/strolch/runtime/test/component/ServiceResultTest.java
index 0666784c9..ce2872fde 100644
--- a/src/test/java/li/strolch/runtime/test/ServiceResultTest.java
+++ b/src/test/java/li/strolch/runtime/test/component/ServiceResultTest.java
@@ -1,4 +1,4 @@
-package li.strolch.runtime.test;
+package li.strolch.runtime.test.component;
public class ServiceResultTest {
diff --git a/src/test/java/li/strolch/runtime/ModelBuilder.java b/src/test/java/li/strolch/runtime/test/query/ModelBuilder.java
similarity index 99%
rename from src/test/java/li/strolch/runtime/ModelBuilder.java
rename to src/test/java/li/strolch/runtime/test/query/ModelBuilder.java
index 3aee6d4d9..0c660b0e3 100644
--- a/src/test/java/li/strolch/runtime/ModelBuilder.java
+++ b/src/test/java/li/strolch/runtime/test/query/ModelBuilder.java
@@ -19,7 +19,7 @@
* along with li.strolch.model. If not, see
* .
*/
-package li.strolch.runtime;
+package li.strolch.runtime.test.query;
import java.util.ArrayList;
import java.util.Date;
diff --git a/src/test/java/li/strolch/runtime/QueryTest.java b/src/test/java/li/strolch/runtime/test/query/QueryTest.java
similarity index 78%
rename from src/test/java/li/strolch/runtime/QueryTest.java
rename to src/test/java/li/strolch/runtime/test/query/QueryTest.java
index 83fc0a981..15c121244 100644
--- a/src/test/java/li/strolch/runtime/QueryTest.java
+++ b/src/test/java/li/strolch/runtime/test/query/QueryTest.java
@@ -19,7 +19,7 @@
* along with XXX. If not, see
* .
*/
-package li.strolch.runtime;
+package li.strolch.runtime.test.query;
import org.junit.Ignore;
import org.junit.Test;
@@ -35,11 +35,7 @@ public class QueryTest {
@Ignore
public void shouldQueryResourceWithParamValue() {
-// ResourceQuery resQuery = new ResourceQuery();
-// resQuery.with(new TypeMatcher("MyType"));
-// resQuery.with(new ParameterBagMatcher("Bla").with(ParameterMatcher.stringValue("color", "red")));
-//
-// List result = resQuery.doQuery();
+ //
}
}
diff --git a/src/test/java/li/strolch/runtime/query/inmemory/InMemoryQueryTest.java b/src/test/java/li/strolch/runtime/test/query/inmemory/InMemoryQueryTest.java
similarity index 90%
rename from src/test/java/li/strolch/runtime/query/inmemory/InMemoryQueryTest.java
rename to src/test/java/li/strolch/runtime/test/query/inmemory/InMemoryQueryTest.java
index bcf88c31c..171cd86e8 100644
--- a/src/test/java/li/strolch/runtime/query/inmemory/InMemoryQueryTest.java
+++ b/src/test/java/li/strolch/runtime/test/query/inmemory/InMemoryQueryTest.java
@@ -19,7 +19,7 @@
* along with XXX. If not, see
* .
*/
-package li.strolch.runtime.query.inmemory;
+package li.strolch.runtime.test.query.inmemory;
import static org.junit.Assert.assertEquals;
@@ -35,7 +35,17 @@ import li.strolch.model.State;
import li.strolch.model.parameter.BooleanParameter;
import li.strolch.model.parameter.FloatParameter;
import li.strolch.model.parameter.StringParameter;
-import li.strolch.runtime.ModelBuilder;
+import li.strolch.runtime.query.inmemory.AndSelector;
+import li.strolch.runtime.query.inmemory.BooleanSelector;
+import li.strolch.runtime.query.inmemory.IdSelector;
+import li.strolch.runtime.query.inmemory.InMemoryQuery;
+import li.strolch.runtime.query.inmemory.ListNavigator;
+import li.strolch.runtime.query.inmemory.NameSelector;
+import li.strolch.runtime.query.inmemory.OrSelector;
+import li.strolch.runtime.query.inmemory.ParameterSelector;
+import li.strolch.runtime.query.inmemory.ParameterizedElementSelector;
+import li.strolch.runtime.query.inmemory.Selector;
+import li.strolch.runtime.test.query.ModelBuilder;
import org.junit.Test;