Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* The `Transform` class contains functions for common data transformations.
* Removed the `Strings` utility class in favor of `AnyStrings` from `accent4j`.
* Removed the `StringSplitter` framework in favor of the same from `accent4j`.
* Refactored the `Criteria` class into an interface that is implemented by any language symbols that can be immediately transformed to a well-built criteria (e.g. `ValueState` and `TimestampState`). The primary benefit of this change is that methods that took a generic Object parameter and checked whether that object could be built into a `Criteria` have now been removed from the `Concourse` driver since that logic is automatically captured within the new class hiearchy. Another positive side effect of this change is that it is no longer necessary to explicitly build a nested `Criteria` when using the `group` functionality of the `Criteria` builder.
* Deprecated `Criteria#getCclString` in favor of `Criteria#ccl`.

#### Version 0.9.6 (February 16, 2019)
* Fixed a bug that caused a `ParseException` to be thrown when trying to use a `Criteria` object containing a string value wrapped in single or double quotes out of necessity (i.e. because the value contained a keyword). This bug happened because the wrapping quotes were dropped by Concourse Server when parsing the `Criteria`.
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@

import com.cinchapi.common.base.CheckedExceptions;
import com.cinchapi.concourse.config.ConcourseClientPreferences;
import com.cinchapi.concourse.lang.BuildableState;
import com.cinchapi.concourse.lang.Criteria;
import com.cinchapi.concourse.lang.Language;
import com.cinchapi.concourse.security.ClientSecurity;
Expand Down Expand Up @@ -830,17 +829,6 @@ public Set<Long> find(Criteria criteria) {
});
}

@Override
public Set<Long> find(Object criteria) {
if(criteria instanceof BuildableState) {
return find(((BuildableState) criteria).build());
}
else {
throw new IllegalArgumentException(
criteria + " is not a valid argument for the find method");
}
}

@Override
public Set<Long> find(String ccl) {
return execute(() -> {
Expand Down Expand Up @@ -1063,30 +1051,6 @@ public <T> Map<String, T> get(Collection<String> keys, long record,
});
}

@Override
public <T> Map<Long, Map<String, T>> get(Collection<String> keys,
Object criteria) {
if(criteria instanceof BuildableState) {
return get(keys, ((BuildableState) criteria).build());
}
else {
throw new IllegalArgumentException(
criteria + " is not a valid argument for the get method");
}
}

@Override
public <T> Map<Long, Map<String, T>> get(Collection<String> keys,
Object criteria, Timestamp timestamp) {
if(criteria instanceof BuildableState) {
return get(keys, ((BuildableState) criteria).build(), timestamp);
}
else {
throw new IllegalArgumentException(
criteria + " is not a valid argument for the get method");
}
}

@Override
public <T> Map<Long, Map<String, T>> get(Collection<String> keys,
String ccl) {
Expand Down Expand Up @@ -1172,29 +1136,6 @@ public <T> Map<Long, Map<String, T>> get(Criteria criteria,
});
}

@Override
public <T> Map<Long, Map<String, T>> get(Object criteria) {
if(criteria instanceof BuildableState) {
return get(((BuildableState) criteria).build());
}
else {
throw new IllegalArgumentException(
criteria + " is not a valid argument for the get method");
}
}

@Override
public <T> Map<Long, Map<String, T>> get(Object criteria,
Timestamp timestamp) {
if(criteria instanceof BuildableState) {
return get(((BuildableState) criteria).build(), timestamp);
}
else {
throw new IllegalArgumentException(
criteria + " is not a valid argument for the get method");
}
}

@Override
public <T> Map<Long, Map<String, T>> get(String ccl) {
return execute(() -> {
Expand Down Expand Up @@ -1324,29 +1265,6 @@ public <T> T get(String key, long record, Timestamp timestamp) {
});
}

@Override
public <T> Map<Long, T> get(String key, Object criteria) {
if(criteria instanceof BuildableState) {
return get(key, ((BuildableState) criteria).build());
}
else {
throw new IllegalArgumentException(
criteria + " is not a valid argument for the get method");
}
}

@Override
public <T> Map<Long, T> get(String key, Object criteria,
Timestamp timestamp) {
if(criteria instanceof BuildableState) {
return get(key, ((BuildableState) criteria).build(), timestamp);
}
else {
throw new IllegalArgumentException(
criteria + " is not a valid argument for the get method");
}
}

@SuppressWarnings("unchecked")
@Override
public <T> Map<Long, T> get(String key, String ccl) {
Expand Down Expand Up @@ -2112,30 +2030,6 @@ public <T> Map<String, Set<T>> select(Collection<String> keys, long record,
});
}

@Override
public <T> Map<Long, Map<String, Set<T>>> select(Collection<String> keys,
Object criteria) {
if(criteria instanceof BuildableState) {
return select(keys, ((BuildableState) criteria).build());
}
else {
throw new IllegalArgumentException(criteria
+ " is not a valid argument for the select method");
}
}

@Override
public <T> Map<Long, Map<String, Set<T>>> select(Collection<String> keys,
Object criteria, Timestamp timestamp) {
if(criteria instanceof BuildableState) {
return select(keys, ((BuildableState) criteria).build(), timestamp);
}
else {
throw new IllegalArgumentException(criteria
+ " is not a valid argument for the select method");
}
}

@Override
public <T> Map<Long, Map<String, Set<T>>> select(Collection<String> keys,
String ccl) {
Expand Down Expand Up @@ -2266,29 +2160,6 @@ public Map<String, Set<Object>> select(long record, Timestamp timestamp) {
});
}

@Override
public <T> Map<Long, Map<String, Set<T>>> select(Object criteria) {
if(criteria instanceof BuildableState) {
return select(((BuildableState) criteria).build());
}
else {
throw new IllegalArgumentException(
criteria + " is not a valid argument for the get method");
}
}

@Override
public <T> Map<Long, Map<String, Set<T>>> select(Object criteria,
Timestamp timestamp) {
if(criteria instanceof BuildableState) {
return select(((BuildableState) criteria).build(), timestamp);
}
else {
throw new IllegalArgumentException(
criteria + " is not a valid argument for the get method");
}
}

@Override
public <T> Map<Long, Map<String, Set<T>>> select(String ccl) {
return execute(() -> {
Expand Down Expand Up @@ -2420,29 +2291,6 @@ public <T> Set<T> select(String key, long record, Timestamp timestamp) {
});
}

@Override
public <T> Map<Long, Set<T>> select(String key, Object criteria) {
if(criteria instanceof BuildableState) {
return select(key, ((BuildableState) criteria).build());
}
else {
throw new IllegalArgumentException(criteria
+ " is not a valid argument for the select method");
}
}

@Override
public <T> Map<Long, Set<T>> select(String key, Object criteria,
Timestamp timestamp) {
if(criteria instanceof BuildableState) {
return select(key, ((BuildableState) criteria).build(), timestamp);
}
else {
throw new IllegalArgumentException(criteria
+ " is not a valid argument for the select method");
}
}

@Override
public <T> Map<Long, Set<T>> select(String key, String ccl) {
return execute(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public static String toWhere(String ccl) {
* resolvable link instruction}
*/
public static String toWhere(Criteria criteria) {
return toWhere(criteria.getCclString());
return toWhere(criteria.ccl());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class BuildableStartState extends BuildableState {
*
* @param criteria
*/
protected BuildableStartState(Criteria criteria) {
protected BuildableStartState(BuiltCriteria criteria) {
super(criteria);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,26 @@
*/
package com.cinchapi.concourse.lang;

import java.util.List;

import com.cinchapi.ccl.grammar.ConjunctionSymbol;
import com.cinchapi.ccl.grammar.Symbol;
import com.cinchapi.concourse.Timestamp;

/**
* The base class for a language state that can be transformed into a complete
* and well-formed {@link Criteria}.
*
* @author Jeff Nelson
*/
public abstract class BuildableState extends State {
public abstract class BuildableState extends State implements Criteria {

/**
* Construct a new instance.
*
* @param criteria
*/
protected BuildableState(Criteria criteria) {
protected BuildableState(BuiltCriteria criteria) {
super(criteria);
}

Expand Down Expand Up @@ -64,4 +68,24 @@ public StartState or() {
return new StartState(criteria);
}

@Override
public Criteria at(Timestamp timestamp) {
return build().at(timestamp);
}

@Override
public final String ccl() {
return build().ccl();
}

@Override
public final List<Symbol> symbols() {
return build().symbols();
}

@Override
public final String toString() {
return build().toString();
}

}
Loading