You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2015/08/26 17:45:14 UTC
[11/24] zest-java git commit: ZEST-113;
Removed the use of Specification and replaced with Java 8 Predicate.
ZEST-113; Removed the use of Specification and replaced with Java 8 Predicate.
Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/b659ba67
Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/b659ba67
Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/b659ba67
Branch: refs/heads/develop
Commit: b659ba675214e353749527bd155dd0a6bb5fe6b2
Parents: 8f889ea
Author: Niclas Hedhman <ni...@hedhman.org>
Authored: Sat Aug 22 17:33:38 2015 +0800
Committer: Niclas Hedhman <ni...@hedhman.org>
Committed: Sat Aug 22 17:33:39 2015 +0800
----------------------------------------------------------------------
.../org/apache/zest/api/dataset/DataSet.java | 4 +-
.../java/org/apache/zest/api/dataset/Query.java | 4 +-
.../api/dataset/iterable/IterableDataSet.java | 4 +-
.../api/dataset/iterable/IterableQuery.java | 4 +-
.../org/apache/zest/api/query/QueryBuilder.java | 4 +-
.../apache/zest/api/query/QueryExpressions.java | 160 ++++++------
.../zest/api/query/grammar/AndPredicate.java | 56 ++++
.../api/query/grammar/AndSpecification.java | 56 ----
.../grammar/AssociationNotNullPredicate.java | 67 +++++
.../AssociationNotNullSpecification.java | 67 -----
.../query/grammar/AssociationNullPredicate.java | 67 +++++
.../grammar/AssociationNullSpecification.java | 67 -----
.../zest/api/query/grammar/BinaryPredicate.java | 41 +++
.../api/query/grammar/BinarySpecification.java | 41 ---
.../api/query/grammar/ComparisonPredicate.java | 76 ++++++
.../query/grammar/ComparisonSpecification.java | 76 ------
.../api/query/grammar/ContainsAllPredicate.java | 78 ++++++
.../query/grammar/ContainsAllSpecification.java | 78 ------
.../api/query/grammar/ContainsPredicate.java | 67 +++++
.../query/grammar/ContainsSpecification.java | 67 -----
.../zest/api/query/grammar/EqPredicate.java | 43 ++++
.../zest/api/query/grammar/EqSpecification.java | 43 ----
.../api/query/grammar/ExpressionPredicate.java | 60 +++++
.../query/grammar/ExpressionSpecification.java | 60 -----
.../zest/api/query/grammar/GePredicate.java | 44 ++++
.../zest/api/query/grammar/GeSpecification.java | 44 ----
.../zest/api/query/grammar/GtPredicate.java | 44 ++++
.../zest/api/query/grammar/GtSpecification.java | 44 ----
.../zest/api/query/grammar/LePredicate.java | 44 ++++
.../zest/api/query/grammar/LeSpecification.java | 44 ----
.../zest/api/query/grammar/LtPredicate.java | 44 ++++
.../zest/api/query/grammar/LtSpecification.java | 44 ----
.../ManyAssociationContainsPredicate.java | 65 +++++
.../ManyAssociationContainsSpecification.java | 65 -----
.../api/query/grammar/MatchesPredicate.java | 93 +++++++
.../api/query/grammar/MatchesSpecification.java | 93 -------
.../NamedAssociationContainsNamePredicate.java | 65 +++++
...medAssociationContainsNameSpecification.java | 65 -----
.../NamedAssociationContainsPredicate.java | 65 +++++
.../NamedAssociationContainsSpecification.java | 65 -----
.../zest/api/query/grammar/NePredicate.java | 43 ++++
.../zest/api/query/grammar/NeSpecification.java | 43 ----
.../api/query/grammar/NotSpecification.java | 53 ----
.../zest/api/query/grammar/Notpredicate.java | 53 ++++
.../zest/api/query/grammar/OrPredicate.java | 56 ++++
.../zest/api/query/grammar/OrSpecification.java | 56 ----
.../query/grammar/PropertyNotNullPredicate.java | 60 +++++
.../grammar/PropertyNotNullSpecification.java | 60 -----
.../query/grammar/PropertyNullPredicate.java | 60 +++++
.../grammar/PropertyNullSpecification.java | 60 -----
.../api/query/grammar/QuerySpecification.java | 8 +-
.../importer/ServiceSelectorImporter.java | 6 +-
.../zest/api/service/qualifier/Active.java | 4 +-
.../service/qualifier/AnnotationQualifier.java | 4 +-
.../zest/api/service/qualifier/Available.java | 4 +-
.../zest/api/service/qualifier/HasMetaInfo.java | 8 +-
.../api/service/qualifier/IdentifiedBy.java | 4 +-
.../api/service/qualifier/ServiceQualifier.java | 36 +--
.../zest/api/service/qualifier/Tagged.java | 4 +-
.../zest/api/type/MatchTypeSpecification.java | 6 +-
.../org/apache/zest/api/util/Annotations.java | 14 +-
.../java/org/apache/zest/api/util/Classes.java | 56 ++--
.../java/org/apache/zest/api/util/Methods.java | 6 +-
.../java/org/apache/zest/api/OperatorsTest.java | 10 +-
.../org/apache/zest/api/util/ClassesTest.java | 4 +-
.../zest/bootstrap/AssemblySpecifications.java | 10 +-
.../org/apache/zest/bootstrap/ClassScanner.java | 26 +-
.../apache/zest/bootstrap/LayerAssembly.java | 14 +-
.../apache/zest/bootstrap/ModuleAssembly.java | 16 +-
.../zest/bootstrap/DocumentationSupport.java | 6 +-
.../org/apache/zest/functional/ForEach.java | 3 +-
.../org/apache/zest/functional/Functions.java | 69 +----
.../org/apache/zest/functional/Iterables.java | 23 +-
.../apache/zest/functional/Specification.java | 37 ---
.../apache/zest/functional/Specifications.java | 88 +++----
.../IntegerRangeSpecificationTest.java | 17 +-
.../apache/zest/functional/IterablesTest.java | 5 +-
.../zest/functional/SpecificationsTest.java | 36 +--
.../java/org/apache/zest/io/Transforms.java | 10 +-
.../bootstrap/CompositeAssemblyImpl.java | 39 +--
.../runtime/bootstrap/LayerAssemblyImpl.java | 14 +-
.../runtime/bootstrap/ModuleAssemblyImpl.java | 34 +--
.../runtime/composite/CompositeMethodModel.java | 6 +-
.../runtime/composite/GenericSpecification.java | 37 ---
.../runtime/composite/Genericpredicate.java | 37 +++
.../zest/runtime/composite/MixinsModel.java | 6 +-
.../zest/runtime/injection/DependencyModel.java | 6 +-
.../runtime/injection/InjectedFieldModel.java | 6 +-
.../injection/InjectedParametersModel.java | 6 +-
.../ServiceInjectionProviderFactory.java | 16 +-
.../provider/ThisInjectionProviderFactory.java | 2 +-
.../zest/runtime/query/IterableQuerySource.java | 12 +-
.../zest/runtime/query/QueryBuilderImpl.java | 8 +-
.../apache/zest/runtime/query/QueryImpl.java | 6 +-
.../service/ImportedServicesInstance.java | 6 +-
.../zest/runtime/service/ServiceInstance.java | 2 +-
.../zest/runtime/service/ServicesInstance.java | 6 +-
.../zest/runtime/structure/ModuleInstance.java | 14 +-
.../runtime/structure/ModuleUnitOfWork.java | 8 +-
.../zest/runtime/structure/TypeLookup.java | 14 +-
.../structure/VisibilitySpecification.java | 47 ----
.../runtime/structure/Visibilitypredicate.java | 47 ++++
.../zest/runtime/types/ValueTypeFactory.java | 2 +-
.../runtime/unitofwork/BuilderEntityState.java | 2 +-
.../runtime/injection/ServiceInjectionTest.java | 8 +-
.../apache/zest/runtime/mixin/JDKMixinTest.java | 10 +-
.../entitystore/helpers/DefaultEntityState.java | 2 +-
.../org/apache/zest/spi/query/EntityFinder.java | 8 +-
.../org/apache/zest/spi/query/QuerySource.java | 8 +-
.../test/indexing/AbstractEntityFinderTest.java | 4 +-
.../test/indexing/AbstractNamedQueryTest.java | 8 +-
.../elasticsearch/ElasticSearchFinder.java | 154 +++++------
.../ElasticSearchFinderSupport.java | 12 +-
.../zest/index/rdf/query/RdfQueryParser.java | 4 +-
.../zest/index/rdf/query/RdfQueryService.java | 8 +-
.../rdf/query/internal/RdfQueryParserImpl.java | 140 +++++-----
.../zest/index/rdf/RdfNamedQueryTest.java | 4 +-
.../solr/internal/SolrEntityQueryMixin.java | 8 +-
.../zest/index/solr/SolrNamedQueryTest.java | 4 +-
.../index/sql/internal/SQLEntityFinder.java | 8 +-
.../zest/index/sql/support/api/SQLQuerying.java | 4 +-
.../support/postgresql/PostgreSQLQuerying.java | 4 +-
.../support/skeletons/AbstractSQLIndexing.java | 6 +-
.../support/skeletons/AbstractSQLQuerying.java | 254 +++++++++----------
.../support/skeletons/AbstractSQLStartup.java | 6 +-
.../skeletons/SQLCompatEntityStateWrapper.java | 6 +-
.../library/circuitbreaker/CircuitBreaker.java | 8 +-
.../library/circuitbreaker/CircuitBreakers.java | 16 +-
.../conversion/values/EntityToValue.java | 12 +-
.../zest/library/conversion/values/Shared.java | 20 +-
.../conversion/values/ValueToEntityMixin.java | 24 +-
.../conversion/values/ValueToEntityTest.java | 14 +-
.../source/helper/ApplicationEvents.java | 46 ++--
.../domain/source/helper/EventRouter.java | 10 +-
.../domain/source/helper/Events.java | 58 ++---
.../domain/source/helper/UnitOfWorkRouter.java | 10 +-
.../org/apache/zest/library/jmx/ZestMBeans.java | 6 +-
.../rest/client/api/ContextResourceClient.java | 2 +-
.../library/rest/client/api/ErrorHandler.java | 18 +-
.../library/rest/common/link/LinksUtil.java | 26 +-
.../server/assembler/RestServerAssembler.java | 6 +-
.../restlet/crud/IdentitySpecification.java | 7 +-
.../restlet/identity/IdentityManager.java | 6 +-
.../restlet/repository/CrudRepository.java | 5 +-
.../restlet/repository/RepositoryLocator.java | 5 +-
.../repository/SmallCrudRepositoryMixin.java | 5 +-
.../library/sql/datasource/DataSources.java | 4 +-
147 files changed, 2292 insertions(+), 2365 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/dataset/DataSet.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/dataset/DataSet.java b/core/api/src/main/java/org/apache/zest/api/dataset/DataSet.java
index 532c4c2..960cd39 100644
--- a/core/api/src/main/java/org/apache/zest/api/dataset/DataSet.java
+++ b/core/api/src/main/java/org/apache/zest/api/dataset/DataSet.java
@@ -19,7 +19,7 @@
package org.apache.zest.api.dataset;
import java.util.function.Function;
-import org.apache.zest.functional.Specification;
+import java.util.function.Predicate;
/**
* definition.constrain(entity(Person.class))
@@ -28,7 +28,7 @@ import org.apache.zest.functional.Specification;
*/
public interface DataSet<T>
{
- DataSet<T> constrain( Specification<T> selection );
+ DataSet<T> constrain( Predicate<T> selection );
<U> DataSet<U> project( Function<T, U> conversion );
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/dataset/Query.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/dataset/Query.java b/core/api/src/main/java/org/apache/zest/api/dataset/Query.java
index 53244ac..b5124cb 100644
--- a/core/api/src/main/java/org/apache/zest/api/dataset/Query.java
+++ b/core/api/src/main/java/org/apache/zest/api/dataset/Query.java
@@ -18,10 +18,10 @@
*/
package org.apache.zest.api.dataset;
+import java.util.function.Predicate;
import org.apache.zest.api.property.Property;
import org.apache.zest.api.query.QueryException;
import org.apache.zest.api.query.QueryExecutionException;
-import org.apache.zest.functional.Specification;
import org.apache.zest.functional.Visitor;
/**
@@ -34,7 +34,7 @@ public interface Query<T>
ASCENDING, DESCENDING
}
- Query filter( Specification<T> filter );
+ Query filter( Predicate<T> filter );
Query orderBy( final Property<?> property, final Order order );
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/dataset/iterable/IterableDataSet.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/dataset/iterable/IterableDataSet.java b/core/api/src/main/java/org/apache/zest/api/dataset/iterable/IterableDataSet.java
index 1f88034..be2ddf4 100644
--- a/core/api/src/main/java/org/apache/zest/api/dataset/iterable/IterableDataSet.java
+++ b/core/api/src/main/java/org/apache/zest/api/dataset/iterable/IterableDataSet.java
@@ -19,10 +19,10 @@
package org.apache.zest.api.dataset.iterable;
import java.util.function.Function;
+import java.util.function.Predicate;
import org.apache.zest.api.dataset.DataSet;
import org.apache.zest.api.dataset.Query;
import org.apache.zest.functional.Iterables;
-import org.apache.zest.functional.Specification;
/**
* TODO
@@ -38,7 +38,7 @@ public class IterableDataSet<T>
}
@Override
- public DataSet<T> constrain( Specification<T> selection )
+ public DataSet<T> constrain( Predicate<T> selection )
{
return new IterableDataSet<T>( Iterables.filter( selection, iterable ) );
}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/dataset/iterable/IterableQuery.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/dataset/iterable/IterableQuery.java b/core/api/src/main/java/org/apache/zest/api/dataset/iterable/IterableQuery.java
index 4c4952a..7476500 100644
--- a/core/api/src/main/java/org/apache/zest/api/dataset/iterable/IterableQuery.java
+++ b/core/api/src/main/java/org/apache/zest/api/dataset/iterable/IterableQuery.java
@@ -20,11 +20,11 @@ package org.apache.zest.api.dataset.iterable;
import java.util.HashMap;
import java.util.Map;
+import java.util.function.Predicate;
import org.apache.zest.api.dataset.Query;
import org.apache.zest.api.property.Property;
import org.apache.zest.api.query.QueryException;
import org.apache.zest.functional.Iterables;
-import org.apache.zest.functional.Specification;
import org.apache.zest.functional.Visitor;
/**
@@ -43,7 +43,7 @@ public class IterableQuery<T> implements Query<T>
}
@Override
- public Query filter( Specification<T> filter )
+ public Query filter( Predicate<T> filter )
{
iterable = Iterables.filter( filter, iterable );
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/query/QueryBuilder.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/QueryBuilder.java b/core/api/src/main/java/org/apache/zest/api/query/QueryBuilder.java
index 38b010c..3384911 100644
--- a/core/api/src/main/java/org/apache/zest/api/query/QueryBuilder.java
+++ b/core/api/src/main/java/org/apache/zest/api/query/QueryBuilder.java
@@ -19,8 +19,8 @@
*/
package org.apache.zest.api.query;
+import java.util.function.Predicate;
import org.apache.zest.api.composite.Composite;
-import org.apache.zest.functional.Specification;
/**
* QueryBuilders are used to create {@link Query} instances.
@@ -43,7 +43,7 @@ public interface QueryBuilder<T>
*
* @return a new builder with the added where-clause
*/
- QueryBuilder<T> where( Specification<Composite> specification );
+ QueryBuilder<T> where( Predicate<Composite> specification );
/**
* Create a new query with the declared where-clauses that will be evaluated against the iterable entries.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/query/QueryExpressions.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/QueryExpressions.java b/core/api/src/main/java/org/apache/zest/api/query/QueryExpressions.java
index a109310..7c18bcc 100644
--- a/core/api/src/main/java/org/apache/zest/api/query/QueryExpressions.java
+++ b/core/api/src/main/java/org/apache/zest/api/query/QueryExpressions.java
@@ -28,6 +28,7 @@ import java.lang.reflect.Proxy;
import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.Collection;
+import java.util.function.Predicate;
import org.apache.zest.api.association.Association;
import org.apache.zest.api.association.GenericAssociationInfo;
import org.apache.zest.api.association.ManyAssociation;
@@ -37,34 +38,33 @@ import org.apache.zest.api.entity.Identity;
import org.apache.zest.api.injection.scope.State;
import org.apache.zest.api.property.GenericPropertyInfo;
import org.apache.zest.api.property.Property;
-import org.apache.zest.api.query.grammar.AndSpecification;
+import org.apache.zest.api.query.grammar.AndPredicate;
import org.apache.zest.api.query.grammar.AssociationFunction;
-import org.apache.zest.api.query.grammar.AssociationNotNullSpecification;
-import org.apache.zest.api.query.grammar.AssociationNullSpecification;
-import org.apache.zest.api.query.grammar.ContainsAllSpecification;
-import org.apache.zest.api.query.grammar.ContainsSpecification;
-import org.apache.zest.api.query.grammar.EqSpecification;
-import org.apache.zest.api.query.grammar.GeSpecification;
-import org.apache.zest.api.query.grammar.GtSpecification;
-import org.apache.zest.api.query.grammar.LeSpecification;
-import org.apache.zest.api.query.grammar.LtSpecification;
-import org.apache.zest.api.query.grammar.ManyAssociationContainsSpecification;
+import org.apache.zest.api.query.grammar.AssociationNotNullPredicate;
+import org.apache.zest.api.query.grammar.AssociationNullPredicate;
+import org.apache.zest.api.query.grammar.ContainsAllPredicate;
+import org.apache.zest.api.query.grammar.ContainsPredicate;
+import org.apache.zest.api.query.grammar.EqPredicate;
+import org.apache.zest.api.query.grammar.GePredicate;
+import org.apache.zest.api.query.grammar.GtPredicate;
+import org.apache.zest.api.query.grammar.LePredicate;
+import org.apache.zest.api.query.grammar.LtPredicate;
+import org.apache.zest.api.query.grammar.ManyAssociationContainsPredicate;
import org.apache.zest.api.query.grammar.ManyAssociationFunction;
-import org.apache.zest.api.query.grammar.MatchesSpecification;
-import org.apache.zest.api.query.grammar.NamedAssociationContainsNameSpecification;
-import org.apache.zest.api.query.grammar.NamedAssociationContainsSpecification;
+import org.apache.zest.api.query.grammar.MatchesPredicate;
+import org.apache.zest.api.query.grammar.NamedAssociationContainsNamePredicate;
+import org.apache.zest.api.query.grammar.NamedAssociationContainsPredicate;
import org.apache.zest.api.query.grammar.NamedAssociationFunction;
-import org.apache.zest.api.query.grammar.NeSpecification;
-import org.apache.zest.api.query.grammar.NotSpecification;
-import org.apache.zest.api.query.grammar.OrSpecification;
+import org.apache.zest.api.query.grammar.NePredicate;
+import org.apache.zest.api.query.grammar.Notpredicate;
+import org.apache.zest.api.query.grammar.OrPredicate;
import org.apache.zest.api.query.grammar.OrderBy;
import org.apache.zest.api.query.grammar.PropertyFunction;
-import org.apache.zest.api.query.grammar.PropertyNotNullSpecification;
-import org.apache.zest.api.query.grammar.PropertyNullSpecification;
+import org.apache.zest.api.query.grammar.PropertyNotNullPredicate;
+import org.apache.zest.api.query.grammar.PropertyNullPredicate;
import org.apache.zest.api.query.grammar.PropertyReference;
import org.apache.zest.api.query.grammar.Variable;
import org.apache.zest.api.util.NullArgumentException;
-import org.apache.zest.functional.Specification;
import static org.apache.zest.functional.Iterables.first;
import static org.apache.zest.functional.Iterables.prepend;
@@ -300,12 +300,12 @@ public final class QueryExpressions
* @return a new AND specification
*/
@SafeVarargs
- public static AndSpecification and( Specification<Composite> left,
- Specification<Composite> right,
- Specification<Composite>... optionalRight
+ public static AndPredicate and( Predicate<Composite> left,
+ Predicate<Composite> right,
+ Predicate<Composite>... optionalRight
)
{
- return new AndSpecification( prepend( left, prepend( right, Arrays.asList( optionalRight ) ) ) );
+ return new AndPredicate( prepend( left, prepend( right, Arrays.asList( optionalRight ) ) ) );
}
/**
@@ -316,9 +316,9 @@ public final class QueryExpressions
* @return a new OR specification
*/
@SafeVarargs
- public static OrSpecification or( Specification<Composite>... specs )
+ public static OrPredicate or( Predicate<Composite>... specs )
{
- return new OrSpecification( Arrays.asList( specs ) );
+ return new OrPredicate( Arrays.asList( specs ) );
}
/**
@@ -328,9 +328,9 @@ public final class QueryExpressions
*
* @return a new NOT specification
*/
- public static NotSpecification not( Specification<Composite> operand )
+ public static Notpredicate not( Predicate<Composite> operand )
{
- return new NotSpecification( operand );
+ return new Notpredicate( operand );
}
// Comparisons -----------------------------------------------------------|
@@ -343,9 +343,9 @@ public final class QueryExpressions
*
* @return a new EQUALS specification for a Property.
*/
- public static <T> EqSpecification<T> eq( Property<T> property, T value )
+ public static <T> EqPredicate<T> eq( Property<T> property, T value )
{
- return new EqSpecification<>( property( property ), value );
+ return new EqPredicate<>( property( property ), value );
}
/**
@@ -357,9 +357,9 @@ public final class QueryExpressions
* @return a new EQUALS specification for a Property using a named Variable.
*/
@SuppressWarnings( {"raw", "unchecked"} )
- public static <T> EqSpecification<T> eq( Property<T> property, Variable variable )
+ public static <T> EqPredicate<T> eq( Property<T> property, Variable variable )
{
- return new EqSpecification( property( property ), variable );
+ return new EqPredicate( property( property ), variable );
}
/**
@@ -370,9 +370,9 @@ public final class QueryExpressions
*
* @return a new EQUALS specification for an Association.
*/
- public static <T> EqSpecification<String> eq( Association<T> association, T value )
+ public static <T> EqPredicate<String> eq( Association<T> association, T value )
{
- return new EqSpecification<>( new PropertyFunction<String>( null,
+ return new EqPredicate<>( new PropertyFunction<String>( null,
association( association ),
null,
null,
@@ -388,9 +388,9 @@ public final class QueryExpressions
*
* @return a new GREATER OR EQUALS specification for a Property.
*/
- public static <T> GeSpecification<T> ge( Property<T> property, T value )
+ public static <T> GePredicate<T> ge( Property<T> property, T value )
{
- return new GeSpecification<>( property( property ), value );
+ return new GePredicate<>( property( property ), value );
}
/**
@@ -402,9 +402,9 @@ public final class QueryExpressions
* @return a new GREATER OR EQUALS specification for a Property using a named Variable.
*/
@SuppressWarnings( {"raw", "unchecked"} )
- public static <T> GeSpecification<T> ge( Property<T> property, Variable variable )
+ public static <T> GePredicate<T> ge( Property<T> property, Variable variable )
{
- return new GeSpecification( property( property ), variable );
+ return new GePredicate( property( property ), variable );
}
/**
@@ -415,9 +415,9 @@ public final class QueryExpressions
*
* @return a new GREATER THAN specification for a Property.
*/
- public static <T> GtSpecification<T> gt( Property<T> property, T value )
+ public static <T> GtPredicate<T> gt( Property<T> property, T value )
{
- return new GtSpecification<>( property( property ), value );
+ return new GtPredicate<>( property( property ), value );
}
/**
@@ -429,9 +429,9 @@ public final class QueryExpressions
* @return a new GREATER THAN specification for a Property using a named Variable.
*/
@SuppressWarnings( {"raw", "unchecked"} )
- public static <T> GtSpecification<T> gt( Property<T> property, Variable variable )
+ public static <T> GtPredicate<T> gt( Property<T> property, Variable variable )
{
- return new GtSpecification( property( property ), variable );
+ return new GtPredicate( property( property ), variable );
}
/**
@@ -442,9 +442,9 @@ public final class QueryExpressions
*
* @return a new LESS OR EQUALS specification for a Property.
*/
- public static <T> LeSpecification<T> le( Property<T> property, T value )
+ public static <T> LePredicate<T> le( Property<T> property, T value )
{
- return new LeSpecification<>( property( property ), value );
+ return new LePredicate<>( property( property ), value );
}
/**
@@ -456,9 +456,9 @@ public final class QueryExpressions
* @return a new LESS OR EQUALS specification for a Property using a named Variable.
*/
@SuppressWarnings( {"raw", "unchecked"} )
- public static <T> LeSpecification<T> le( Property<T> property, Variable variable )
+ public static <T> LePredicate<T> le( Property<T> property, Variable variable )
{
- return new LeSpecification( property( property ), variable );
+ return new LePredicate( property( property ), variable );
}
/**
@@ -469,9 +469,9 @@ public final class QueryExpressions
*
* @return a new LESSER THAN specification for a Property.
*/
- public static <T> LtSpecification<T> lt( Property<T> property, T value )
+ public static <T> LtPredicate<T> lt( Property<T> property, T value )
{
- return new LtSpecification<>( property( property ), value );
+ return new LtPredicate<>( property( property ), value );
}
/**
@@ -483,9 +483,9 @@ public final class QueryExpressions
* @return a new LESSER THAN specification for a Property using a named Variable.
*/
@SuppressWarnings( {"raw", "unchecked"} )
- public static <T> LtSpecification<T> lt( Property<T> property, Variable variable )
+ public static <T> LtPredicate<T> lt( Property<T> property, Variable variable )
{
- return new LtSpecification( property( property ), variable );
+ return new LtPredicate( property( property ), variable );
}
/**
@@ -496,9 +496,9 @@ public final class QueryExpressions
*
* @return a new NOT EQUALS specification for a Property.
*/
- public static <T> NeSpecification<T> ne( Property<T> property, T value )
+ public static <T> NePredicate<T> ne( Property<T> property, T value )
{
- return new NeSpecification<>( property( property ), value );
+ return new NePredicate<>( property( property ), value );
}
/**
@@ -510,9 +510,9 @@ public final class QueryExpressions
* @return a new NOT EQUALS specification for a Property using a named Variable.
*/
@SuppressWarnings( {"raw", "unchecked"} )
- public static <T> NeSpecification<T> ne( Property<T> property, Variable variable )
+ public static <T> NePredicate<T> ne( Property<T> property, Variable variable )
{
- return new NeSpecification( property( property ), variable );
+ return new NePredicate( property( property ), variable );
}
/**
@@ -523,9 +523,9 @@ public final class QueryExpressions
*
* @return a new REGULAR EXPRESSION specification for a Property.
*/
- public static MatchesSpecification matches( Property<String> property, String regexp )
+ public static MatchesPredicate matches( Property<String> property, String regexp )
{
- return new MatchesSpecification( property( property ), regexp );
+ return new MatchesPredicate( property( property ), regexp );
}
/**
@@ -536,9 +536,9 @@ public final class QueryExpressions
*
* @return a new REGULAR EXPRESSION specification for a Property using a named Variable.
*/
- public static MatchesSpecification matches( Property<String> property, Variable variable )
+ public static MatchesPredicate matches( Property<String> property, Variable variable )
{
- return new MatchesSpecification( property( property ), variable );
+ return new MatchesPredicate( property( property ), variable );
}
// Null checks -----------------------------------------------------------|
@@ -550,9 +550,9 @@ public final class QueryExpressions
*
* @return a new NOT NULL specification for a Property.
*/
- public static <T> PropertyNotNullSpecification<T> isNotNull( Property<T> property )
+ public static <T> PropertyNotNullPredicate<T> isNotNull( Property<T> property )
{
- return new PropertyNotNullSpecification<>( property( property ) );
+ return new PropertyNotNullPredicate<>( property( property ) );
}
/**
@@ -562,9 +562,9 @@ public final class QueryExpressions
*
* @return a new NULL specification for a Property.
*/
- public static <T> PropertyNullSpecification<T> isNull( Property<T> property )
+ public static <T> PropertyNullPredicate<T> isNull( Property<T> property )
{
- return new PropertyNullSpecification<>( property( property ) );
+ return new PropertyNullPredicate<>( property( property ) );
}
/**
@@ -574,9 +574,9 @@ public final class QueryExpressions
*
* @return a new NOT NULL specification for an Association.
*/
- public static <T> AssociationNotNullSpecification<T> isNotNull( Association<T> association )
+ public static <T> AssociationNotNullPredicate<T> isNotNull( Association<T> association )
{
- return new AssociationNotNullSpecification<>( association( association ) );
+ return new AssociationNotNullPredicate<>( association( association ) );
}
/**
@@ -586,9 +586,9 @@ public final class QueryExpressions
*
* @return a new NULL specification for an Association.
*/
- public static <T> AssociationNullSpecification<T> isNull( Association<T> association )
+ public static <T> AssociationNullPredicate<T> isNull( Association<T> association )
{
- return new AssociationNullSpecification<>( association( association ) );
+ return new AssociationNullPredicate<>( association( association ) );
}
// Collections -----------------------------------------------------------|
@@ -601,11 +601,11 @@ public final class QueryExpressions
*
* @return a new CONTAINS ALL specification for a Collection Property.
*/
- public static <T> ContainsAllSpecification<T> containsAll( Property<? extends Collection<T>> collectionProperty,
+ public static <T> ContainsAllPredicate<T> containsAll( Property<? extends Collection<T>> collectionProperty,
Iterable<T> values )
{
NullArgumentException.validateNotNull( "Values", values );
- return new ContainsAllSpecification<>( property( collectionProperty ), values );
+ return new ContainsAllPredicate<>( property( collectionProperty ), values );
}
/**
@@ -617,12 +617,12 @@ public final class QueryExpressions
* @return a new CONTAINS ALL specification for a Collection Property using named Variables.
*/
@SuppressWarnings( {"raw", "unchecked"} )
- public static <T> ContainsAllSpecification<T> containsAllVariables(
+ public static <T> ContainsAllPredicate<T> containsAllVariables(
Property<? extends Collection<T>> collectionProperty,
Iterable<Variable> variables )
{
NullArgumentException.validateNotNull( "Variables", variables );
- return new ContainsAllSpecification( property( collectionProperty ), variables );
+ return new ContainsAllPredicate( property( collectionProperty ), variables );
}
/**
@@ -633,11 +633,11 @@ public final class QueryExpressions
*
* @return a new CONTAINS specification for a Collection Property.
*/
- public static <T> ContainsSpecification<T> contains( Property<? extends Collection<T>> collectionProperty,
+ public static <T> ContainsPredicate<T> contains( Property<? extends Collection<T>> collectionProperty,
T value )
{
NullArgumentException.validateNotNull( "Value", value );
- return new ContainsSpecification<>( property( collectionProperty ), value );
+ return new ContainsPredicate<>( property( collectionProperty ), value );
}
/**
@@ -649,11 +649,11 @@ public final class QueryExpressions
* @return a new CONTAINS specification for a Collection Property using named Variables.
*/
@SuppressWarnings( {"raw", "unchecked"} )
- public static <T> ContainsSpecification<T> contains( Property<? extends Collection<T>> collectionProperty,
+ public static <T> ContainsPredicate<T> contains( Property<? extends Collection<T>> collectionProperty,
Variable variable )
{
NullArgumentException.validateNotNull( "Variable", variable );
- return new ContainsSpecification( property( collectionProperty ), variable );
+ return new ContainsPredicate( property( collectionProperty ), variable );
}
/**
@@ -664,9 +664,9 @@ public final class QueryExpressions
*
* @return a new CONTAINS specification for a ManyAssociation.
*/
- public static <T> ManyAssociationContainsSpecification<T> contains( ManyAssociation<T> manyAssoc, T value )
+ public static <T> ManyAssociationContainsPredicate<T> contains( ManyAssociation<T> manyAssoc, T value )
{
- return new ManyAssociationContainsSpecification<>( manyAssociation( manyAssoc ), value );
+ return new ManyAssociationContainsPredicate<>( manyAssociation( manyAssoc ), value );
}
/**
@@ -677,9 +677,9 @@ public final class QueryExpressions
*
* @return a new CONTAINS specification for a NamedAssociation.
*/
- public static <T> NamedAssociationContainsSpecification<T> contains( NamedAssociation<T> namedAssoc, T value )
+ public static <T> NamedAssociationContainsPredicate<T> contains( NamedAssociation<T> namedAssoc, T value )
{
- return new NamedAssociationContainsSpecification<>( namedAssociation( namedAssoc ), value );
+ return new NamedAssociationContainsPredicate<>( namedAssociation( namedAssoc ), value );
}
/**
@@ -690,10 +690,10 @@ public final class QueryExpressions
*
* @return a new CONTAINS NAME specification for a NamedAssociation.
*/
- public static <T> NamedAssociationContainsNameSpecification<T> containsName( NamedAssociation<T> namedAssoc,
+ public static <T> NamedAssociationContainsNamePredicate<T> containsName( NamedAssociation<T> namedAssoc,
String name )
{
- return new NamedAssociationContainsNameSpecification<>( namedAssociation( namedAssoc ), name );
+ return new NamedAssociationContainsNamePredicate<>( namedAssociation( namedAssoc ), name );
}
// Ordering --------------------------------------------------------------|
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/query/grammar/AndPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/AndPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/AndPredicate.java
new file mode 100644
index 0000000..d89c65a
--- /dev/null
+++ b/core/api/src/main/java/org/apache/zest/api/query/grammar/AndPredicate.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.zest.api.query.grammar;
+
+import java.util.function.Predicate;
+import org.apache.zest.api.composite.Composite;
+import org.apache.zest.functional.Specifications;
+
+/**
+ * AND Specification.
+ */
+public class AndPredicate
+ extends BinaryPredicate
+{
+
+ public AndPredicate( Iterable<Predicate<Composite>> operands )
+ {
+ super( operands );
+ }
+
+ @Override
+ public boolean test( Composite item )
+ {
+ return Specifications.and( operands ).test( item );
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuilder sb = new StringBuilder( "(" );
+ String and = "";
+ for( Predicate<Composite> operand : operands )
+ {
+ sb.append( and ).append( operand );
+ and = " and ";
+ }
+ return sb.append( ")" ).toString();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/query/grammar/AndSpecification.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/AndSpecification.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/AndSpecification.java
deleted file mode 100644
index 3d710ad..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/AndSpecification.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.zest.api.query.grammar;
-
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.functional.Specification;
-import org.apache.zest.functional.Specifications;
-
-/**
- * AND Specification.
- */
-public class AndSpecification
- extends BinarySpecification
-{
-
- public AndSpecification( Iterable<Specification<Composite>> operands )
- {
- super( operands );
- }
-
- @Override
- public boolean satisfiedBy( Composite item )
- {
- return Specifications.and( operands ).satisfiedBy( item );
- }
-
- @Override
- public String toString()
- {
- StringBuilder sb = new StringBuilder( "(" );
- String and = "";
- for( Specification<Composite> operand : operands )
- {
- sb.append( and ).append( operand );
- and = " and ";
- }
- return sb.append( ")" ).toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationNotNullPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationNotNullPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationNotNullPredicate.java
new file mode 100644
index 0000000..05bb3b5
--- /dev/null
+++ b/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationNotNullPredicate.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.zest.api.query.grammar;
+
+import org.apache.zest.api.association.Association;
+import org.apache.zest.api.composite.Composite;
+
+/**
+ * Association not null Specification.
+ */
+public class AssociationNotNullPredicate<T>
+ extends ExpressionPredicate
+{
+ private AssociationFunction<T> association;
+
+ public AssociationNotNullPredicate( AssociationFunction<T> association )
+ {
+ this.association = association;
+ }
+
+ public AssociationFunction<T> association()
+ {
+ return association;
+ }
+
+ @Override
+ public boolean test( Composite item )
+ {
+ try
+ {
+ Association<T> assoc = association.apply( item );
+
+ if( assoc == null )
+ {
+ return false;
+ }
+
+ return assoc.get() != null;
+ }
+ catch( IllegalArgumentException e )
+ {
+ return false;
+ }
+ }
+
+ @Override
+ public String toString()
+ {
+ return association.toString() + "is not null";
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationNotNullSpecification.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationNotNullSpecification.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationNotNullSpecification.java
deleted file mode 100644
index 30774f8..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationNotNullSpecification.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.zest.api.query.grammar;
-
-import org.apache.zest.api.association.Association;
-import org.apache.zest.api.composite.Composite;
-
-/**
- * Association not null Specification.
- */
-public class AssociationNotNullSpecification<T>
- extends ExpressionSpecification
-{
- private AssociationFunction<T> association;
-
- public AssociationNotNullSpecification( AssociationFunction<T> association )
- {
- this.association = association;
- }
-
- public AssociationFunction<T> association()
- {
- return association;
- }
-
- @Override
- public boolean satisfiedBy( Composite item )
- {
- try
- {
- Association<T> assoc = association.apply( item );
-
- if( assoc == null )
- {
- return false;
- }
-
- return assoc.get() != null;
- }
- catch( IllegalArgumentException e )
- {
- return false;
- }
- }
-
- @Override
- public String toString()
- {
- return association.toString() + "is not null";
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationNullPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationNullPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationNullPredicate.java
new file mode 100644
index 0000000..7f04ed5
--- /dev/null
+++ b/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationNullPredicate.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.zest.api.query.grammar;
+
+import org.apache.zest.api.association.Association;
+import org.apache.zest.api.composite.Composite;
+
+/**
+ * Association null Specification.
+ */
+public class AssociationNullPredicate<T>
+ extends ExpressionPredicate
+{
+ private AssociationFunction<T> association;
+
+ public AssociationNullPredicate( AssociationFunction<T> association )
+ {
+ this.association = association;
+ }
+
+ public AssociationFunction<T> association()
+ {
+ return association;
+ }
+
+ @Override
+ public boolean test( Composite item )
+ {
+ try
+ {
+ Association<T> assoc = association.apply( item );
+
+ if( assoc == null )
+ {
+ return true;
+ }
+
+ return assoc.get() == null;
+ }
+ catch( IllegalArgumentException e )
+ {
+ return true;
+ }
+ }
+
+ @Override
+ public String toString()
+ {
+ return association.toString() + "is null";
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationNullSpecification.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationNullSpecification.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationNullSpecification.java
deleted file mode 100644
index 64f0171..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationNullSpecification.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.zest.api.query.grammar;
-
-import org.apache.zest.api.association.Association;
-import org.apache.zest.api.composite.Composite;
-
-/**
- * Association null Specification.
- */
-public class AssociationNullSpecification<T>
- extends ExpressionSpecification
-{
- private AssociationFunction<T> association;
-
- public AssociationNullSpecification( AssociationFunction<T> association )
- {
- this.association = association;
- }
-
- public AssociationFunction<T> association()
- {
- return association;
- }
-
- @Override
- public boolean satisfiedBy( Composite item )
- {
- try
- {
- Association<T> assoc = association.apply( item );
-
- if( assoc == null )
- {
- return true;
- }
-
- return assoc.get() == null;
- }
- catch( IllegalArgumentException e )
- {
- return true;
- }
- }
-
- @Override
- public String toString()
- {
- return association.toString() + "is null";
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/query/grammar/BinaryPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/BinaryPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/BinaryPredicate.java
new file mode 100644
index 0000000..73d5ec9
--- /dev/null
+++ b/core/api/src/main/java/org/apache/zest/api/query/grammar/BinaryPredicate.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.zest.api.query.grammar;
+
+import java.util.function.Predicate;
+import org.apache.zest.api.composite.Composite;
+
+/**
+ * Base binary Specification, used for AND and OR Specifications..
+ */
+public abstract class BinaryPredicate
+ extends ExpressionPredicate
+{
+ protected final Iterable<Predicate<Composite>> operands;
+
+ protected BinaryPredicate( Iterable<Predicate<Composite>> operands )
+ {
+ this.operands = operands;
+ }
+
+ public Iterable<Predicate<Composite>> operands()
+ {
+ return operands;
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/query/grammar/BinarySpecification.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/BinarySpecification.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/BinarySpecification.java
deleted file mode 100644
index 177caf0..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/BinarySpecification.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.zest.api.query.grammar;
-
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.functional.Specification;
-
-/**
- * Base binary Specification, used for AND and OR Specifications..
- */
-public abstract class BinarySpecification
- extends ExpressionSpecification
-{
- protected final Iterable<Specification<Composite>> operands;
-
- protected BinarySpecification( Iterable<Specification<Composite>> operands )
- {
- this.operands = operands;
- }
-
- public Iterable<Specification<Composite>> operands()
- {
- return operands;
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/query/grammar/ComparisonPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/ComparisonPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/ComparisonPredicate.java
new file mode 100644
index 0000000..a5cf551
--- /dev/null
+++ b/core/api/src/main/java/org/apache/zest/api/query/grammar/ComparisonPredicate.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.zest.api.query.grammar;
+
+import org.apache.zest.api.composite.Composite;
+import org.apache.zest.api.property.Property;
+
+/**
+ * Base comparison Specification.
+ */
+public abstract class ComparisonPredicate<T>
+ extends ExpressionPredicate
+{
+ protected final PropertyFunction<T> property;
+ protected final T value;
+
+ public ComparisonPredicate( PropertyFunction<T> property, T value )
+ {
+ this.property = property;
+ this.value = value;
+ }
+
+ public PropertyFunction<T> property()
+ {
+ return property;
+ }
+
+ @Override
+ public final boolean test( Composite item )
+ {
+ try
+ {
+ Property<T> prop = property.apply( item );
+
+ if( prop == null )
+ {
+ return false;
+ }
+
+ T propValue = prop.get();
+ if( propValue == null )
+ {
+ return false;
+ }
+
+ return compare( propValue );
+ }
+ catch( IllegalArgumentException e )
+ {
+ return false;
+ }
+ }
+
+ protected abstract boolean compare( T value );
+
+ public T value()
+ {
+ return value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/query/grammar/ComparisonSpecification.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/ComparisonSpecification.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/ComparisonSpecification.java
deleted file mode 100644
index 5cb6043..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/ComparisonSpecification.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.zest.api.query.grammar;
-
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.api.property.Property;
-
-/**
- * Base comparison Specification.
- */
-public abstract class ComparisonSpecification<T>
- extends ExpressionSpecification
-{
- protected final PropertyFunction<T> property;
- protected final T value;
-
- public ComparisonSpecification( PropertyFunction<T> property, T value )
- {
- this.property = property;
- this.value = value;
- }
-
- public PropertyFunction<T> property()
- {
- return property;
- }
-
- @Override
- public final boolean satisfiedBy( Composite item )
- {
- try
- {
- Property<T> prop = property.apply( item );
-
- if( prop == null )
- {
- return false;
- }
-
- T propValue = prop.get();
- if( propValue == null )
- {
- return false;
- }
-
- return compare( propValue );
- }
- catch( IllegalArgumentException e )
- {
- return false;
- }
- }
-
- protected abstract boolean compare( T value );
-
- public T value()
- {
- return value;
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/query/grammar/ContainsAllPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/ContainsAllPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/ContainsAllPredicate.java
new file mode 100644
index 0000000..ddbcc3a
--- /dev/null
+++ b/core/api/src/main/java/org/apache/zest/api/query/grammar/ContainsAllPredicate.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.zest.api.query.grammar;
+
+import java.util.Collection;
+import org.apache.zest.api.composite.Composite;
+import org.apache.zest.functional.Iterables;
+
+/**
+ * Contains All Specification.
+ */
+public class ContainsAllPredicate<T>
+ extends ExpressionPredicate
+{
+ private PropertyFunction<? extends Collection<T>> collectionProperty;
+ private Iterable<T> valueCollection;
+
+ public ContainsAllPredicate( PropertyFunction<? extends Collection<T>> collectionProperty,
+ Iterable<T> valueCollection
+ )
+ {
+ this.collectionProperty = collectionProperty;
+ this.valueCollection = valueCollection;
+ }
+
+ public PropertyFunction<? extends Collection<T>> collectionProperty()
+ {
+ return collectionProperty;
+ }
+
+ public Iterable<T> containedValues()
+ {
+ return valueCollection;
+ }
+
+ @Override
+ public boolean test( Composite item )
+ {
+ Collection<T> collection = collectionProperty.apply( item ).get();
+
+ if( collection == null )
+ {
+ return false;
+ }
+
+ for( T value : valueCollection )
+ {
+ if( !collection.contains( value ) )
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public String toString()
+ {
+ return collectionProperty + " contains " + Iterables.toList( valueCollection );
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/query/grammar/ContainsAllSpecification.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/ContainsAllSpecification.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/ContainsAllSpecification.java
deleted file mode 100644
index 89902e6..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/ContainsAllSpecification.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.zest.api.query.grammar;
-
-import java.util.Collection;
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.functional.Iterables;
-
-/**
- * Contains All Specification.
- */
-public class ContainsAllSpecification<T>
- extends ExpressionSpecification
-{
- private PropertyFunction<? extends Collection<T>> collectionProperty;
- private Iterable<T> valueCollection;
-
- public ContainsAllSpecification( PropertyFunction<? extends Collection<T>> collectionProperty,
- Iterable<T> valueCollection
- )
- {
- this.collectionProperty = collectionProperty;
- this.valueCollection = valueCollection;
- }
-
- public PropertyFunction<? extends Collection<T>> collectionProperty()
- {
- return collectionProperty;
- }
-
- public Iterable<T> containedValues()
- {
- return valueCollection;
- }
-
- @Override
- public boolean satisfiedBy( Composite item )
- {
- Collection<T> collection = collectionProperty.apply( item ).get();
-
- if( collection == null )
- {
- return false;
- }
-
- for( T value : valueCollection )
- {
- if( !collection.contains( value ) )
- {
- return false;
- }
- }
-
- return true;
- }
-
- @Override
- public String toString()
- {
- return collectionProperty + " contains " + Iterables.toList( valueCollection );
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/query/grammar/ContainsPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/ContainsPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/ContainsPredicate.java
new file mode 100644
index 0000000..dfb5087
--- /dev/null
+++ b/core/api/src/main/java/org/apache/zest/api/query/grammar/ContainsPredicate.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.zest.api.query.grammar;
+
+import java.util.Collection;
+import org.apache.zest.api.composite.Composite;
+
+/**
+ * Contains Specification.
+ */
+public class ContainsPredicate<T>
+ extends ExpressionPredicate
+{
+ private PropertyFunction<? extends Collection<T>> collectionProperty;
+ private T value;
+
+ public ContainsPredicate( PropertyFunction<? extends Collection<T>> collectionProperty, T value )
+ {
+ this.collectionProperty = collectionProperty;
+ this.value = value;
+ }
+
+ public PropertyFunction<? extends Collection<T>> collectionProperty()
+ {
+ return collectionProperty;
+ }
+
+ public T value()
+ {
+ return value;
+ }
+
+ @Override
+ public boolean test( Composite item )
+ {
+ Collection<T> collection = collectionProperty.apply( item ).get();
+
+ if( collection == null )
+ {
+ return false;
+ }
+
+ return collection.contains( value );
+ }
+
+ @Override
+ public String toString()
+ {
+ return collectionProperty + " contains " + value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/query/grammar/ContainsSpecification.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/ContainsSpecification.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/ContainsSpecification.java
deleted file mode 100644
index d1ecd88..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/ContainsSpecification.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.zest.api.query.grammar;
-
-import java.util.Collection;
-import org.apache.zest.api.composite.Composite;
-
-/**
- * Contains Specification.
- */
-public class ContainsSpecification<T>
- extends ExpressionSpecification
-{
- private PropertyFunction<? extends Collection<T>> collectionProperty;
- private T value;
-
- public ContainsSpecification( PropertyFunction<? extends Collection<T>> collectionProperty, T value )
- {
- this.collectionProperty = collectionProperty;
- this.value = value;
- }
-
- public PropertyFunction<? extends Collection<T>> collectionProperty()
- {
- return collectionProperty;
- }
-
- public T value()
- {
- return value;
- }
-
- @Override
- public boolean satisfiedBy( Composite item )
- {
- Collection<T> collection = collectionProperty.apply( item ).get();
-
- if( collection == null )
- {
- return false;
- }
-
- return collection.contains( value );
- }
-
- @Override
- public String toString()
- {
- return collectionProperty + " contains " + value;
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/query/grammar/EqPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/EqPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/EqPredicate.java
new file mode 100644
index 0000000..61dcb5a
--- /dev/null
+++ b/core/api/src/main/java/org/apache/zest/api/query/grammar/EqPredicate.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.zest.api.query.grammar;
+
+/**
+ * Equals Specification.
+ */
+public class EqPredicate<T>
+ extends ComparisonPredicate<T>
+{
+ public EqPredicate( PropertyFunction<T> property, T value )
+ {
+ super( property, value );
+ }
+
+ @Override
+ protected boolean compare( T value )
+ {
+ return value.equals( this.value );
+ }
+
+ @Override
+ public String toString()
+ {
+ return property.toString() + "=" + value.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/query/grammar/EqSpecification.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/EqSpecification.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/EqSpecification.java
deleted file mode 100644
index b7ed03c..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/EqSpecification.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.zest.api.query.grammar;
-
-/**
- * Equals Specification.
- */
-public class EqSpecification<T>
- extends ComparisonSpecification<T>
-{
- public EqSpecification( PropertyFunction<T> property, T value )
- {
- super( property, value );
- }
-
- @Override
- protected boolean compare( T value )
- {
- return value.equals( this.value );
- }
-
- @Override
- public String toString()
- {
- return property.toString() + "=" + value.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/query/grammar/ExpressionPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/ExpressionPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/ExpressionPredicate.java
new file mode 100644
index 0000000..36dc427
--- /dev/null
+++ b/core/api/src/main/java/org/apache/zest/api/query/grammar/ExpressionPredicate.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.zest.api.query.grammar;
+
+import java.util.function.Predicate;
+import org.apache.zest.api.composite.Composite;
+
+import static org.apache.zest.functional.Iterables.append;
+import static org.apache.zest.functional.Iterables.iterable;
+
+/**
+ * Base expression Specification.
+ */
+public abstract class ExpressionPredicate
+ implements Predicate<Composite>
+{
+
+// @SuppressWarnings( "unchecked" )
+// public AndPredicate and( Predicate<Composite> specification )
+// {
+// if( this instanceof AndPredicate )
+// {
+// return new AndPredicate( append( specification, ( (AndPredicate) this ).operands() ) );
+// }
+// else
+// {
+// return new AndPredicate( iterable( this, specification ) );
+// }
+// }
+//
+// @SuppressWarnings( "unchecked" )
+// public OrPredicate or( Predicate<Composite> specification )
+// {
+// if( this instanceof OrPredicate )
+// {
+// return new OrPredicate( append( specification, ( (OrPredicate) this ).operands() ) );
+// }
+// else
+// {
+// return new OrPredicate( iterable( this, specification ) );
+// }
+// }
+//
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/query/grammar/ExpressionSpecification.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/ExpressionSpecification.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/ExpressionSpecification.java
deleted file mode 100644
index f0dd6b2..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/ExpressionSpecification.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.zest.api.query.grammar;
-
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.functional.Specification;
-
-import static org.apache.zest.functional.Iterables.append;
-import static org.apache.zest.functional.Iterables.iterable;
-
-/**
- * Base expression Specification.
- */
-public abstract class ExpressionSpecification
- implements Specification<Composite>
-{
-
- @SuppressWarnings( "unchecked" )
- public AndSpecification and( Specification<Composite> specification )
- {
- if( this instanceof AndSpecification )
- {
- return new AndSpecification( append( specification, ( (AndSpecification) this ).operands() ) );
- }
- else
- {
- return new AndSpecification( iterable( this, specification ) );
- }
- }
-
- @SuppressWarnings( "unchecked" )
- public OrSpecification or( Specification<Composite> specification )
- {
- if( this instanceof OrSpecification )
- {
- return new OrSpecification( append( specification, ( (OrSpecification) this ).operands() ) );
- }
- else
- {
- return new OrSpecification( iterable( this, specification ) );
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/query/grammar/GePredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/GePredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/GePredicate.java
new file mode 100644
index 0000000..13d5d0b
--- /dev/null
+++ b/core/api/src/main/java/org/apache/zest/api/query/grammar/GePredicate.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.zest.api.query.grammar;
+
+/**
+ * Greater or equals Specification.
+ */
+public class GePredicate<T>
+ extends ComparisonPredicate<T>
+{
+ public GePredicate( PropertyFunction<T> property, T value )
+ {
+ super( property, value );
+ }
+
+ @Override
+ @SuppressWarnings( "unchecked" )
+ protected boolean compare( T value )
+ {
+ return ( (Comparable) value ).compareTo( this.value ) >= 0;
+ }
+
+ @Override
+ public String toString()
+ {
+ return property.toString() + ">=" + value.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/query/grammar/GeSpecification.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/GeSpecification.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/GeSpecification.java
deleted file mode 100644
index f012293..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/GeSpecification.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.zest.api.query.grammar;
-
-/**
- * Greater or equals Specification.
- */
-public class GeSpecification<T>
- extends ComparisonSpecification<T>
-{
- public GeSpecification( PropertyFunction<T> property, T value )
- {
- super( property, value );
- }
-
- @Override
- @SuppressWarnings( "unchecked" )
- protected boolean compare( T value )
- {
- return ( (Comparable) value ).compareTo( this.value ) >= 0;
- }
-
- @Override
- public String toString()
- {
- return property.toString() + ">=" + value.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/query/grammar/GtPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/GtPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/GtPredicate.java
new file mode 100644
index 0000000..ee42c96
--- /dev/null
+++ b/core/api/src/main/java/org/apache/zest/api/query/grammar/GtPredicate.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.zest.api.query.grammar;
+
+/**
+ * Greater than Specification.
+ */
+public class GtPredicate<T>
+ extends ComparisonPredicate<T>
+{
+ public GtPredicate( PropertyFunction<T> property, T value )
+ {
+ super( property, value );
+ }
+
+ @Override
+ @SuppressWarnings( "unchecked" )
+ protected boolean compare( T value )
+ {
+ return ( (Comparable) value ).compareTo( this.value ) > 0;
+ }
+
+ @Override
+ public String toString()
+ {
+ return property.toString() + ">" + value.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/query/grammar/GtSpecification.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/GtSpecification.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/GtSpecification.java
deleted file mode 100644
index 880fb67..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/GtSpecification.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.zest.api.query.grammar;
-
-/**
- * Greater than Specification.
- */
-public class GtSpecification<T>
- extends ComparisonSpecification<T>
-{
- public GtSpecification( PropertyFunction<T> property, T value )
- {
- super( property, value );
- }
-
- @Override
- @SuppressWarnings( "unchecked" )
- protected boolean compare( T value )
- {
- return ( (Comparable) value ).compareTo( this.value ) > 0;
- }
-
- @Override
- public String toString()
- {
- return property.toString() + ">" + value.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b659ba67/core/api/src/main/java/org/apache/zest/api/query/grammar/LePredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/LePredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/LePredicate.java
new file mode 100644
index 0000000..0d31998
--- /dev/null
+++ b/core/api/src/main/java/org/apache/zest/api/query/grammar/LePredicate.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.zest.api.query.grammar;
+
+/**
+ * Less or equals Specification.
+ */
+public class LePredicate<T>
+ extends ComparisonPredicate<T>
+{
+ public LePredicate( PropertyFunction<T> property, T value )
+ {
+ super( property, value );
+ }
+
+ @Override
+ @SuppressWarnings( "unchecked" )
+ protected boolean compare( T value )
+ {
+ return ( (Comparable) value ).compareTo( this.value ) <= 0;
+ }
+
+ @Override
+ public String toString()
+ {
+ return property.toString() + "<=" + value.toString();
+ }
+}