id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
8,200
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/filter/Filter.java
Filter.filterFor
public static <S extends Storable> Filter<S> filterFor(Class<S> type, String expression) { SoftValuedCache<Object, Filter<S>> filterCache = getFilterCache(type); synchronized (filterCache) { Filter<S> filter = filterCache.get(expression); if (filter == null) { filter = new FilterParser<S>(type, expression).parseRoot(); filterCache.put(expression, filter); } return filter; } }
java
public static <S extends Storable> Filter<S> filterFor(Class<S> type, String expression) { SoftValuedCache<Object, Filter<S>> filterCache = getFilterCache(type); synchronized (filterCache) { Filter<S> filter = filterCache.get(expression); if (filter == null) { filter = new FilterParser<S>(type, expression).parseRoot(); filterCache.put(expression, filter); } return filter; } }
[ "public", "static", "<", "S", "extends", "Storable", ">", "Filter", "<", "S", ">", "filterFor", "(", "Class", "<", "S", ">", "type", ",", "String", "expression", ")", "{", "SoftValuedCache", "<", "Object", ",", "Filter", "<", "S", ">", ">", "filterCache", "=", "getFilterCache", "(", "type", ")", ";", "synchronized", "(", "filterCache", ")", "{", "Filter", "<", "S", ">", "filter", "=", "filterCache", ".", "get", "(", "expression", ")", ";", "if", "(", "filter", "==", "null", ")", "{", "filter", "=", "new", "FilterParser", "<", "S", ">", "(", "type", ",", "expression", ")", ".", "parseRoot", "(", ")", ";", "filterCache", ".", "put", "(", "expression", ",", "filter", ")", ";", "}", "return", "filter", ";", "}", "}" ]
Returns a cached filter instance that operates on the given type and filter expression. @param type type of Storable that query is made against @param expression query filter expression to parse @return canonical Filter instance @throws IllegalArgumentException if type or filter expression is null @throws MalformedFilterException if filter expression is malformed
[ "Returns", "a", "cached", "filter", "instance", "that", "operates", "on", "the", "given", "type", "and", "filter", "expression", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/filter/Filter.java#L90-L100
8,201
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/filter/Filter.java
Filter.getOpenFilter
public static <S extends Storable> OpenFilter<S> getOpenFilter(Class<S> type) { SoftValuedCache<Object, Filter<S>> filterCache = getFilterCache(type); synchronized (filterCache) { Filter<S> filter = filterCache.get(OPEN_KEY); if (filter == null) { filter = OpenFilter.getCanonical(type); filterCache.put(OPEN_KEY, filter); } return (OpenFilter<S>) filter; } }
java
public static <S extends Storable> OpenFilter<S> getOpenFilter(Class<S> type) { SoftValuedCache<Object, Filter<S>> filterCache = getFilterCache(type); synchronized (filterCache) { Filter<S> filter = filterCache.get(OPEN_KEY); if (filter == null) { filter = OpenFilter.getCanonical(type); filterCache.put(OPEN_KEY, filter); } return (OpenFilter<S>) filter; } }
[ "public", "static", "<", "S", "extends", "Storable", ">", "OpenFilter", "<", "S", ">", "getOpenFilter", "(", "Class", "<", "S", ">", "type", ")", "{", "SoftValuedCache", "<", "Object", ",", "Filter", "<", "S", ">", ">", "filterCache", "=", "getFilterCache", "(", "type", ")", ";", "synchronized", "(", "filterCache", ")", "{", "Filter", "<", "S", ">", "filter", "=", "filterCache", ".", "get", "(", "OPEN_KEY", ")", ";", "if", "(", "filter", "==", "null", ")", "{", "filter", "=", "OpenFilter", ".", "getCanonical", "(", "type", ")", ";", "filterCache", ".", "put", "(", "OPEN_KEY", ",", "filter", ")", ";", "}", "return", "(", "OpenFilter", "<", "S", ">", ")", "filter", ";", "}", "}" ]
Returns a cached filter instance that operates on the given type, which allows all results to pass through. @param type type of Storable that query is made against @return canonical Filter instance @see OpenFilter
[ "Returns", "a", "cached", "filter", "instance", "that", "operates", "on", "the", "given", "type", "which", "allows", "all", "results", "to", "pass", "through", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/filter/Filter.java#L110-L120
8,202
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/filter/Filter.java
Filter.getClosedFilter
public static <S extends Storable> ClosedFilter<S> getClosedFilter(Class<S> type) { SoftValuedCache<Object, Filter<S>> filterCache = getFilterCache(type); synchronized (filterCache) { Filter<S> filter = filterCache.get(CLOSED_KEY); if (filter == null) { filter = ClosedFilter.getCanonical(type); filterCache.put(CLOSED_KEY, filter); } return (ClosedFilter<S>) filter; } }
java
public static <S extends Storable> ClosedFilter<S> getClosedFilter(Class<S> type) { SoftValuedCache<Object, Filter<S>> filterCache = getFilterCache(type); synchronized (filterCache) { Filter<S> filter = filterCache.get(CLOSED_KEY); if (filter == null) { filter = ClosedFilter.getCanonical(type); filterCache.put(CLOSED_KEY, filter); } return (ClosedFilter<S>) filter; } }
[ "public", "static", "<", "S", "extends", "Storable", ">", "ClosedFilter", "<", "S", ">", "getClosedFilter", "(", "Class", "<", "S", ">", "type", ")", "{", "SoftValuedCache", "<", "Object", ",", "Filter", "<", "S", ">", ">", "filterCache", "=", "getFilterCache", "(", "type", ")", ";", "synchronized", "(", "filterCache", ")", "{", "Filter", "<", "S", ">", "filter", "=", "filterCache", ".", "get", "(", "CLOSED_KEY", ")", ";", "if", "(", "filter", "==", "null", ")", "{", "filter", "=", "ClosedFilter", ".", "getCanonical", "(", "type", ")", ";", "filterCache", ".", "put", "(", "CLOSED_KEY", ",", "filter", ")", ";", "}", "return", "(", "ClosedFilter", "<", "S", ">", ")", "filter", ";", "}", "}" ]
Returns a cached filter instance that operates on the given type, which prevents any results from passing through. @param type type of Storable that query is made against @return canonical Filter instance @see ClosedFilter
[ "Returns", "a", "cached", "filter", "instance", "that", "operates", "on", "the", "given", "type", "which", "prevents", "any", "results", "from", "passing", "through", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/filter/Filter.java#L130-L140
8,203
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/filter/Filter.java
Filter.initialFilterValues
public FilterValues<S> initialFilterValues() { FilterValues<S> filterValues = mFilterValues; if (filterValues == null) { buildFilterValues(); filterValues = mFilterValues; } return filterValues; }
java
public FilterValues<S> initialFilterValues() { FilterValues<S> filterValues = mFilterValues; if (filterValues == null) { buildFilterValues(); filterValues = mFilterValues; } return filterValues; }
[ "public", "FilterValues", "<", "S", ">", "initialFilterValues", "(", ")", "{", "FilterValues", "<", "S", ">", "filterValues", "=", "mFilterValues", ";", "if", "(", "filterValues", "==", "null", ")", "{", "buildFilterValues", "(", ")", ";", "filterValues", "=", "mFilterValues", ";", "}", "return", "filterValues", ";", "}" ]
Returns a FilterValues instance for assigning values to a Filter. Returns null if Filter has no parameters. <p>Note: The returned FilterValues instance may reference a different filter instance than this one. Call getFilter to retrieve it. The difference is caused by the filter property values being {@link #bind bound}.
[ "Returns", "a", "FilterValues", "instance", "for", "assigning", "values", "to", "a", "Filter", ".", "Returns", "null", "if", "Filter", "has", "no", "parameters", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/filter/Filter.java#L190-L197
8,204
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/filter/Filter.java
Filter.getTailPropertyFilterList
PropertyFilterList<S> getTailPropertyFilterList() { PropertyFilterList<S> tail = mTailPropertyFilterList; if (tail == null) { buildFilterValues(); tail = mTailPropertyFilterList; } return tail; }
java
PropertyFilterList<S> getTailPropertyFilterList() { PropertyFilterList<S> tail = mTailPropertyFilterList; if (tail == null) { buildFilterValues(); tail = mTailPropertyFilterList; } return tail; }
[ "PropertyFilterList", "<", "S", ">", "getTailPropertyFilterList", "(", ")", "{", "PropertyFilterList", "<", "S", ">", "tail", "=", "mTailPropertyFilterList", ";", "if", "(", "tail", "==", "null", ")", "{", "buildFilterValues", "(", ")", ";", "tail", "=", "mTailPropertyFilterList", ";", "}", "return", "tail", ";", "}" ]
Returns tail of linked list, and so it can only be traversed by getting previous nodes. @return tail of PropertyFilterList, or null if no parameters
[ "Returns", "tail", "of", "linked", "list", "and", "so", "it", "can", "only", "be", "traversed", "by", "getting", "previous", "nodes", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/filter/Filter.java#L205-L212
8,205
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/filter/Filter.java
Filter.andExists
public final Filter<S> andExists(String propertyName, Filter<?> subFilter) { ChainedProperty<S> prop = new FilterParser<S>(mType, propertyName).parseChainedProperty(); return and(ExistsFilter.build(prop, subFilter, false)); }
java
public final Filter<S> andExists(String propertyName, Filter<?> subFilter) { ChainedProperty<S> prop = new FilterParser<S>(mType, propertyName).parseChainedProperty(); return and(ExistsFilter.build(prop, subFilter, false)); }
[ "public", "final", "Filter", "<", "S", ">", "andExists", "(", "String", "propertyName", ",", "Filter", "<", "?", ">", "subFilter", ")", "{", "ChainedProperty", "<", "S", ">", "prop", "=", "new", "FilterParser", "<", "S", ">", "(", "mType", ",", "propertyName", ")", ".", "parseChainedProperty", "(", ")", ";", "return", "and", "(", "ExistsFilter", ".", "build", "(", "prop", ",", "subFilter", ",", "false", ")", ")", ";", "}" ]
Returns a combined filter instance that accepts records which are only accepted by this filter and the "exists" test applied to a join. @param propertyName join property name, which may be a chained property @param subFilter sub-filter to apply to join, which may be null to test for any existing @return canonical Filter instance @throws IllegalArgumentException if property is not found @since 1.2
[ "Returns", "a", "combined", "filter", "instance", "that", "accepts", "records", "which", "are", "only", "accepted", "by", "this", "filter", "and", "the", "exists", "test", "applied", "to", "a", "join", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/filter/Filter.java#L304-L307
8,206
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/filter/Filter.java
Filter.andNotExists
public final Filter<S> andNotExists(String propertyName, Filter<?> subFilter) { ChainedProperty<S> prop = new FilterParser<S>(mType, propertyName).parseChainedProperty(); return and(ExistsFilter.build(prop, subFilter, true)); }
java
public final Filter<S> andNotExists(String propertyName, Filter<?> subFilter) { ChainedProperty<S> prop = new FilterParser<S>(mType, propertyName).parseChainedProperty(); return and(ExistsFilter.build(prop, subFilter, true)); }
[ "public", "final", "Filter", "<", "S", ">", "andNotExists", "(", "String", "propertyName", ",", "Filter", "<", "?", ">", "subFilter", ")", "{", "ChainedProperty", "<", "S", ">", "prop", "=", "new", "FilterParser", "<", "S", ">", "(", "mType", ",", "propertyName", ")", ".", "parseChainedProperty", "(", ")", ";", "return", "and", "(", "ExistsFilter", ".", "build", "(", "prop", ",", "subFilter", ",", "true", ")", ")", ";", "}" ]
Returns a combined filter instance that accepts records which are only accepted by this filter and the "not exists" test applied to a join. @param propertyName join property name, which may be a chained property @param subFilter sub-filter to apply to join, which may be null to test for any not existing @return canonical Filter instance @throws IllegalArgumentException if property is not found @since 1.2
[ "Returns", "a", "combined", "filter", "instance", "that", "accepts", "records", "which", "are", "only", "accepted", "by", "this", "filter", "and", "the", "not", "exists", "test", "applied", "to", "a", "join", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/filter/Filter.java#L320-L323
8,207
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/filter/Filter.java
Filter.orExists
public final Filter<S> orExists(String propertyName, Filter<?> subFilter) { ChainedProperty<S> prop = new FilterParser<S>(mType, propertyName).parseChainedProperty(); return or(ExistsFilter.build(prop, subFilter, false)); }
java
public final Filter<S> orExists(String propertyName, Filter<?> subFilter) { ChainedProperty<S> prop = new FilterParser<S>(mType, propertyName).parseChainedProperty(); return or(ExistsFilter.build(prop, subFilter, false)); }
[ "public", "final", "Filter", "<", "S", ">", "orExists", "(", "String", "propertyName", ",", "Filter", "<", "?", ">", "subFilter", ")", "{", "ChainedProperty", "<", "S", ">", "prop", "=", "new", "FilterParser", "<", "S", ">", "(", "mType", ",", "propertyName", ")", ".", "parseChainedProperty", "(", ")", ";", "return", "or", "(", "ExistsFilter", ".", "build", "(", "prop", ",", "subFilter", ",", "false", ")", ")", ";", "}" ]
Returns a combined filter instance that accepts records which are accepted either by this filter or the "exists" test applied to a join. @param propertyName one-to-many join property name, which may be a chained property @param subFilter sub-filter to apply to join, which may be null to test for any existing @return canonical Filter instance @throws IllegalArgumentException if property is not found @since 1.2
[ "Returns", "a", "combined", "filter", "instance", "that", "accepts", "records", "which", "are", "accepted", "either", "by", "this", "filter", "or", "the", "exists", "test", "applied", "to", "a", "join", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/filter/Filter.java#L394-L397
8,208
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/filter/Filter.java
Filter.orNotExists
public final Filter<S> orNotExists(String propertyName, Filter<?> subFilter) { ChainedProperty<S> prop = new FilterParser<S>(mType, propertyName).parseChainedProperty(); return or(ExistsFilter.build(prop, subFilter, true)); }
java
public final Filter<S> orNotExists(String propertyName, Filter<?> subFilter) { ChainedProperty<S> prop = new FilterParser<S>(mType, propertyName).parseChainedProperty(); return or(ExistsFilter.build(prop, subFilter, true)); }
[ "public", "final", "Filter", "<", "S", ">", "orNotExists", "(", "String", "propertyName", ",", "Filter", "<", "?", ">", "subFilter", ")", "{", "ChainedProperty", "<", "S", ">", "prop", "=", "new", "FilterParser", "<", "S", ">", "(", "mType", ",", "propertyName", ")", ".", "parseChainedProperty", "(", ")", ";", "return", "or", "(", "ExistsFilter", ".", "build", "(", "prop", ",", "subFilter", ",", "true", ")", ")", ";", "}" ]
Returns a combined filter instance that accepts records which are accepted either by this filter or the "not exists" test applied to a join. @param propertyName one-to-many join property name, which may be a chained property @param subFilter sub-filter to apply to join, which may be null to test for any not existing @return canonical Filter instance @throws IllegalArgumentException if property is not found @since 1.2
[ "Returns", "a", "combined", "filter", "instance", "that", "accepts", "records", "which", "are", "accepted", "either", "by", "this", "filter", "or", "the", "not", "exists", "test", "applied", "to", "a", "join", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/filter/Filter.java#L411-L414
8,209
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/filter/Filter.java
Filter.disjunctiveNormalFormSplit
public List<Filter<S>> disjunctiveNormalFormSplit() { final List<Filter<S>> list = new ArrayList<Filter<S>>(); disjunctiveNormalForm().accept(new Visitor<S, Object, Object>() { @Override public Object visit(AndFilter<S> filter, Object param) { list.add(filter); return null; } @Override public Object visit(PropertyFilter<S> filter, Object param) { list.add(filter); return null; } @Override public Object visit(ExistsFilter<S> filter, Object param) { list.add(filter); return null; } }, null); return Collections.unmodifiableList(list); }
java
public List<Filter<S>> disjunctiveNormalFormSplit() { final List<Filter<S>> list = new ArrayList<Filter<S>>(); disjunctiveNormalForm().accept(new Visitor<S, Object, Object>() { @Override public Object visit(AndFilter<S> filter, Object param) { list.add(filter); return null; } @Override public Object visit(PropertyFilter<S> filter, Object param) { list.add(filter); return null; } @Override public Object visit(ExistsFilter<S> filter, Object param) { list.add(filter); return null; } }, null); return Collections.unmodifiableList(list); }
[ "public", "List", "<", "Filter", "<", "S", ">", ">", "disjunctiveNormalFormSplit", "(", ")", "{", "final", "List", "<", "Filter", "<", "S", ">", ">", "list", "=", "new", "ArrayList", "<", "Filter", "<", "S", ">", ">", "(", ")", ";", "disjunctiveNormalForm", "(", ")", ".", "accept", "(", "new", "Visitor", "<", "S", ",", "Object", ",", "Object", ">", "(", ")", "{", "@", "Override", "public", "Object", "visit", "(", "AndFilter", "<", "S", ">", "filter", ",", "Object", "param", ")", "{", "list", ".", "add", "(", "filter", ")", ";", "return", "null", ";", "}", "@", "Override", "public", "Object", "visit", "(", "PropertyFilter", "<", "S", ">", "filter", ",", "Object", "param", ")", "{", "list", ".", "add", "(", "filter", ")", ";", "return", "null", ";", "}", "@", "Override", "public", "Object", "visit", "(", "ExistsFilter", "<", "S", ">", "filter", ",", "Object", "param", ")", "{", "list", ".", "add", "(", "filter", ")", ";", "return", "null", ";", "}", "}", ",", "null", ")", ";", "return", "Collections", ".", "unmodifiableList", "(", "list", ")", ";", "}" ]
Splits the filter from its disjunctive normal form. Or'ng the filters together produces the full disjunctive normal form. @return unmodifiable list of sub filters which don't perform any 'or' operations @since 1.1.1
[ "Splits", "the", "filter", "from", "its", "disjunctive", "normal", "form", ".", "Or", "ng", "the", "filters", "together", "produces", "the", "full", "disjunctive", "normal", "form", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/filter/Filter.java#L453-L477
8,210
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/filter/Filter.java
Filter.conjunctiveNormalFormSplit
public List<Filter<S>> conjunctiveNormalFormSplit() { final List<Filter<S>> list = new ArrayList<Filter<S>>(); conjunctiveNormalForm().accept(new Visitor<S, Object, Object>() { @Override public Object visit(OrFilter<S> filter, Object param) { list.add(filter); return null; } @Override public Object visit(PropertyFilter<S> filter, Object param) { list.add(filter); return null; } @Override public Object visit(ExistsFilter<S> filter, Object param) { list.add(filter); return null; } }, null); return Collections.unmodifiableList(list); }
java
public List<Filter<S>> conjunctiveNormalFormSplit() { final List<Filter<S>> list = new ArrayList<Filter<S>>(); conjunctiveNormalForm().accept(new Visitor<S, Object, Object>() { @Override public Object visit(OrFilter<S> filter, Object param) { list.add(filter); return null; } @Override public Object visit(PropertyFilter<S> filter, Object param) { list.add(filter); return null; } @Override public Object visit(ExistsFilter<S> filter, Object param) { list.add(filter); return null; } }, null); return Collections.unmodifiableList(list); }
[ "public", "List", "<", "Filter", "<", "S", ">", ">", "conjunctiveNormalFormSplit", "(", ")", "{", "final", "List", "<", "Filter", "<", "S", ">", ">", "list", "=", "new", "ArrayList", "<", "Filter", "<", "S", ">", ">", "(", ")", ";", "conjunctiveNormalForm", "(", ")", ".", "accept", "(", "new", "Visitor", "<", "S", ",", "Object", ",", "Object", ">", "(", ")", "{", "@", "Override", "public", "Object", "visit", "(", "OrFilter", "<", "S", ">", "filter", ",", "Object", "param", ")", "{", "list", ".", "add", "(", "filter", ")", ";", "return", "null", ";", "}", "@", "Override", "public", "Object", "visit", "(", "PropertyFilter", "<", "S", ">", "filter", ",", "Object", "param", ")", "{", "list", ".", "add", "(", "filter", ")", ";", "return", "null", ";", "}", "@", "Override", "public", "Object", "visit", "(", "ExistsFilter", "<", "S", ">", "filter", ",", "Object", "param", ")", "{", "list", ".", "add", "(", "filter", ")", ";", "return", "null", ";", "}", "}", ",", "null", ")", ";", "return", "Collections", ".", "unmodifiableList", "(", "list", ")", ";", "}" ]
Splits the filter from its conjunctive normal form. And'ng the filters together produces the full conjunctive normal form. @return unmodifiable list of sub filters which don't perform any 'and' operations @since 1.1.1
[ "Splits", "the", "filter", "from", "its", "conjunctive", "normal", "form", ".", "And", "ng", "the", "filters", "together", "produces", "the", "full", "conjunctive", "normal", "form", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/filter/Filter.java#L517-L541
8,211
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/filter/Filter.java
Filter.notJoinedFromCNF
NotJoined notJoinedFromCNF(ChainedProperty<S> joinProperty) { return new NotJoined(getOpenFilter(joinProperty.getLastProperty().getJoinedType()), this); }
java
NotJoined notJoinedFromCNF(ChainedProperty<S> joinProperty) { return new NotJoined(getOpenFilter(joinProperty.getLastProperty().getJoinedType()), this); }
[ "NotJoined", "notJoinedFromCNF", "(", "ChainedProperty", "<", "S", ">", "joinProperty", ")", "{", "return", "new", "NotJoined", "(", "getOpenFilter", "(", "joinProperty", ".", "getLastProperty", "(", ")", ".", "getJoinedType", "(", ")", ")", ",", "this", ")", ";", "}" ]
Should only be called on a filter in conjunctive normal form.
[ "Should", "only", "be", "called", "on", "a", "filter", "in", "conjunctive", "normal", "form", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/filter/Filter.java#L734-L736
8,212
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/DataDecoder.java
DataDecoder.decodeInt
public static int decodeInt(byte[] src, int srcOffset) throws CorruptEncodingException { try { int value = (src[srcOffset] << 24) | ((src[srcOffset + 1] & 0xff) << 16) | ((src[srcOffset + 2] & 0xff) << 8) | (src[srcOffset + 3] & 0xff); return value ^ 0x80000000; } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
java
public static int decodeInt(byte[] src, int srcOffset) throws CorruptEncodingException { try { int value = (src[srcOffset] << 24) | ((src[srcOffset + 1] & 0xff) << 16) | ((src[srcOffset + 2] & 0xff) << 8) | (src[srcOffset + 3] & 0xff); return value ^ 0x80000000; } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
[ "public", "static", "int", "decodeInt", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ")", "throws", "CorruptEncodingException", "{", "try", "{", "int", "value", "=", "(", "src", "[", "srcOffset", "]", "<<", "24", ")", "|", "(", "(", "src", "[", "srcOffset", "+", "1", "]", "&", "0xff", ")", "<<", "16", ")", "|", "(", "(", "src", "[", "srcOffset", "+", "2", "]", "&", "0xff", ")", "<<", "8", ")", "|", "(", "src", "[", "srcOffset", "+", "3", "]", "&", "0xff", ")", ";", "return", "value", "^", "0x80000000", ";", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "throw", "new", "CorruptEncodingException", "(", "null", ",", "e", ")", ";", "}", "}" ]
Decodes a signed integer from exactly 4 bytes. @param src source of encoded bytes @param srcOffset offset into source array @return signed integer value
[ "Decodes", "a", "signed", "integer", "from", "exactly", "4", "bytes", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L47-L57
8,213
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/DataDecoder.java
DataDecoder.decodeIntegerObj
public static Integer decodeIntegerObj(byte[] src, int srcOffset) throws CorruptEncodingException { try { int b = src[srcOffset]; if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) { return null; } return decodeInt(src, srcOffset + 1); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
java
public static Integer decodeIntegerObj(byte[] src, int srcOffset) throws CorruptEncodingException { try { int b = src[srcOffset]; if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) { return null; } return decodeInt(src, srcOffset + 1); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
[ "public", "static", "Integer", "decodeIntegerObj", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ")", "throws", "CorruptEncodingException", "{", "try", "{", "int", "b", "=", "src", "[", "srcOffset", "]", ";", "if", "(", "b", "==", "NULL_BYTE_HIGH", "||", "b", "==", "NULL_BYTE_LOW", ")", "{", "return", "null", ";", "}", "return", "decodeInt", "(", "src", ",", "srcOffset", "+", "1", ")", ";", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "throw", "new", "CorruptEncodingException", "(", "null", ",", "e", ")", ";", "}", "}" ]
Decodes a signed Integer object from exactly 1 or 5 bytes. If null is returned, then 1 byte was read. @param src source of encoded bytes @param srcOffset offset into source array @return signed Integer object or null
[ "Decodes", "a", "signed", "Integer", "object", "from", "exactly", "1", "or", "5", "bytes", ".", "If", "null", "is", "returned", "then", "1", "byte", "was", "read", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L67-L79
8,214
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/DataDecoder.java
DataDecoder.decodeLong
public static long decodeLong(byte[] src, int srcOffset) throws CorruptEncodingException { try { return (((long)(((src[srcOffset ] ) << 24) | ((src[srcOffset + 1] & 0xff) << 16) | ((src[srcOffset + 2] & 0xff) << 8 ) | ((src[srcOffset + 3] & 0xff) )) ^ 0x80000000 ) << 32) | (((long)(((src[srcOffset + 4] ) << 24) | ((src[srcOffset + 5] & 0xff) << 16) | ((src[srcOffset + 6] & 0xff) << 8 ) | ((src[srcOffset + 7] & 0xff) )) & 0xffffffffL) ); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
java
public static long decodeLong(byte[] src, int srcOffset) throws CorruptEncodingException { try { return (((long)(((src[srcOffset ] ) << 24) | ((src[srcOffset + 1] & 0xff) << 16) | ((src[srcOffset + 2] & 0xff) << 8 ) | ((src[srcOffset + 3] & 0xff) )) ^ 0x80000000 ) << 32) | (((long)(((src[srcOffset + 4] ) << 24) | ((src[srcOffset + 5] & 0xff) << 16) | ((src[srcOffset + 6] & 0xff) << 8 ) | ((src[srcOffset + 7] & 0xff) )) & 0xffffffffL) ); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
[ "public", "static", "long", "decodeLong", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ")", "throws", "CorruptEncodingException", "{", "try", "{", "return", "(", "(", "(", "long", ")", "(", "(", "(", "src", "[", "srcOffset", "]", ")", "<<", "24", ")", "|", "(", "(", "src", "[", "srcOffset", "+", "1", "]", "&", "0xff", ")", "<<", "16", ")", "|", "(", "(", "src", "[", "srcOffset", "+", "2", "]", "&", "0xff", ")", "<<", "8", ")", "|", "(", "(", "src", "[", "srcOffset", "+", "3", "]", "&", "0xff", ")", ")", ")", "^", "0x80000000", ")", "<<", "32", ")", "|", "(", "(", "(", "long", ")", "(", "(", "(", "src", "[", "srcOffset", "+", "4", "]", ")", "<<", "24", ")", "|", "(", "(", "src", "[", "srcOffset", "+", "5", "]", "&", "0xff", ")", "<<", "16", ")", "|", "(", "(", "src", "[", "srcOffset", "+", "6", "]", "&", "0xff", ")", "<<", "8", ")", "|", "(", "(", "src", "[", "srcOffset", "+", "7", "]", "&", "0xff", ")", ")", ")", "&", "0xffffffff", "L", ")", ")", ";", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "throw", "new", "CorruptEncodingException", "(", "null", ",", "e", ")", ";", "}", "}" ]
Decodes a signed long from exactly 8 bytes. @param src source of encoded bytes @param srcOffset offset into source array @return signed long value
[ "Decodes", "a", "signed", "long", "from", "exactly", "8", "bytes", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L88-L104
8,215
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/DataDecoder.java
DataDecoder.decodeLongObj
public static Long decodeLongObj(byte[] src, int srcOffset) throws CorruptEncodingException { try { int b = src[srcOffset]; if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) { return null; } return decodeLong(src, srcOffset + 1); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
java
public static Long decodeLongObj(byte[] src, int srcOffset) throws CorruptEncodingException { try { int b = src[srcOffset]; if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) { return null; } return decodeLong(src, srcOffset + 1); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
[ "public", "static", "Long", "decodeLongObj", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ")", "throws", "CorruptEncodingException", "{", "try", "{", "int", "b", "=", "src", "[", "srcOffset", "]", ";", "if", "(", "b", "==", "NULL_BYTE_HIGH", "||", "b", "==", "NULL_BYTE_LOW", ")", "{", "return", "null", ";", "}", "return", "decodeLong", "(", "src", ",", "srcOffset", "+", "1", ")", ";", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "throw", "new", "CorruptEncodingException", "(", "null", ",", "e", ")", ";", "}", "}" ]
Decodes a signed Long object from exactly 1 or 9 bytes. If null is returned, then 1 byte was read. @param src source of encoded bytes @param srcOffset offset into source array @return signed Long object or null
[ "Decodes", "a", "signed", "Long", "object", "from", "exactly", "1", "or", "9", "bytes", ".", "If", "null", "is", "returned", "then", "1", "byte", "was", "read", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L114-L126
8,216
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/DataDecoder.java
DataDecoder.decodeByte
public static byte decodeByte(byte[] src, int srcOffset) throws CorruptEncodingException { try { return (byte)(src[srcOffset] ^ 0x80); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
java
public static byte decodeByte(byte[] src, int srcOffset) throws CorruptEncodingException { try { return (byte)(src[srcOffset] ^ 0x80); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
[ "public", "static", "byte", "decodeByte", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ")", "throws", "CorruptEncodingException", "{", "try", "{", "return", "(", "byte", ")", "(", "src", "[", "srcOffset", "]", "^", "0x80", ")", ";", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "throw", "new", "CorruptEncodingException", "(", "null", ",", "e", ")", ";", "}", "}" ]
Decodes a signed byte from exactly 1 byte. @param src source of encoded bytes @param srcOffset offset into source array @return signed byte value
[ "Decodes", "a", "signed", "byte", "from", "exactly", "1", "byte", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L135-L143
8,217
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/DataDecoder.java
DataDecoder.decodeByteObj
public static Byte decodeByteObj(byte[] src, int srcOffset) throws CorruptEncodingException { try { int b = src[srcOffset]; if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) { return null; } return decodeByte(src, srcOffset + 1); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
java
public static Byte decodeByteObj(byte[] src, int srcOffset) throws CorruptEncodingException { try { int b = src[srcOffset]; if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) { return null; } return decodeByte(src, srcOffset + 1); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
[ "public", "static", "Byte", "decodeByteObj", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ")", "throws", "CorruptEncodingException", "{", "try", "{", "int", "b", "=", "src", "[", "srcOffset", "]", ";", "if", "(", "b", "==", "NULL_BYTE_HIGH", "||", "b", "==", "NULL_BYTE_LOW", ")", "{", "return", "null", ";", "}", "return", "decodeByte", "(", "src", ",", "srcOffset", "+", "1", ")", ";", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "throw", "new", "CorruptEncodingException", "(", "null", ",", "e", ")", ";", "}", "}" ]
Decodes a signed Byte object from exactly 1 or 2 bytes. If null is returned, then 1 byte was read. @param src source of encoded bytes @param srcOffset offset into source array @return signed Byte object or null
[ "Decodes", "a", "signed", "Byte", "object", "from", "exactly", "1", "or", "2", "bytes", ".", "If", "null", "is", "returned", "then", "1", "byte", "was", "read", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L153-L165
8,218
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/DataDecoder.java
DataDecoder.decodeShort
public static short decodeShort(byte[] src, int srcOffset) throws CorruptEncodingException { try { return (short)(((src[srcOffset] << 8) | (src[srcOffset + 1] & 0xff)) ^ 0x8000); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
java
public static short decodeShort(byte[] src, int srcOffset) throws CorruptEncodingException { try { return (short)(((src[srcOffset] << 8) | (src[srcOffset + 1] & 0xff)) ^ 0x8000); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
[ "public", "static", "short", "decodeShort", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ")", "throws", "CorruptEncodingException", "{", "try", "{", "return", "(", "short", ")", "(", "(", "(", "src", "[", "srcOffset", "]", "<<", "8", ")", "|", "(", "src", "[", "srcOffset", "+", "1", "]", "&", "0xff", ")", ")", "^", "0x8000", ")", ";", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "throw", "new", "CorruptEncodingException", "(", "null", ",", "e", ")", ";", "}", "}" ]
Decodes a signed short from exactly 2 bytes. @param src source of encoded bytes @param srcOffset offset into source array @return signed short value
[ "Decodes", "a", "signed", "short", "from", "exactly", "2", "bytes", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L174-L182
8,219
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/DataDecoder.java
DataDecoder.decodeShortObj
public static Short decodeShortObj(byte[] src, int srcOffset) throws CorruptEncodingException { try { int b = src[srcOffset]; if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) { return null; } return decodeShort(src, srcOffset + 1); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
java
public static Short decodeShortObj(byte[] src, int srcOffset) throws CorruptEncodingException { try { int b = src[srcOffset]; if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) { return null; } return decodeShort(src, srcOffset + 1); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
[ "public", "static", "Short", "decodeShortObj", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ")", "throws", "CorruptEncodingException", "{", "try", "{", "int", "b", "=", "src", "[", "srcOffset", "]", ";", "if", "(", "b", "==", "NULL_BYTE_HIGH", "||", "b", "==", "NULL_BYTE_LOW", ")", "{", "return", "null", ";", "}", "return", "decodeShort", "(", "src", ",", "srcOffset", "+", "1", ")", ";", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "throw", "new", "CorruptEncodingException", "(", "null", ",", "e", ")", ";", "}", "}" ]
Decodes a signed Short object from exactly 1 or 3 bytes. If null is returned, then 1 byte was read. @param src source of encoded bytes @param srcOffset offset into source array @return signed Short object or null
[ "Decodes", "a", "signed", "Short", "object", "from", "exactly", "1", "or", "3", "bytes", ".", "If", "null", "is", "returned", "then", "1", "byte", "was", "read", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L192-L204
8,220
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/DataDecoder.java
DataDecoder.decodeChar
public static char decodeChar(byte[] src, int srcOffset) throws CorruptEncodingException { try { return (char)((src[srcOffset] << 8) | (src[srcOffset + 1] & 0xff)); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
java
public static char decodeChar(byte[] src, int srcOffset) throws CorruptEncodingException { try { return (char)((src[srcOffset] << 8) | (src[srcOffset + 1] & 0xff)); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
[ "public", "static", "char", "decodeChar", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ")", "throws", "CorruptEncodingException", "{", "try", "{", "return", "(", "char", ")", "(", "(", "src", "[", "srcOffset", "]", "<<", "8", ")", "|", "(", "src", "[", "srcOffset", "+", "1", "]", "&", "0xff", ")", ")", ";", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "throw", "new", "CorruptEncodingException", "(", "null", ",", "e", ")", ";", "}", "}" ]
Decodes a char from exactly 2 bytes. @param src source of encoded bytes @param srcOffset offset into source array @return char value
[ "Decodes", "a", "char", "from", "exactly", "2", "bytes", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L213-L221
8,221
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/DataDecoder.java
DataDecoder.decodeCharacterObj
public static Character decodeCharacterObj(byte[] src, int srcOffset) throws CorruptEncodingException { try { int b = src[srcOffset]; if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) { return null; } return decodeChar(src, srcOffset + 1); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
java
public static Character decodeCharacterObj(byte[] src, int srcOffset) throws CorruptEncodingException { try { int b = src[srcOffset]; if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) { return null; } return decodeChar(src, srcOffset + 1); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
[ "public", "static", "Character", "decodeCharacterObj", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ")", "throws", "CorruptEncodingException", "{", "try", "{", "int", "b", "=", "src", "[", "srcOffset", "]", ";", "if", "(", "b", "==", "NULL_BYTE_HIGH", "||", "b", "==", "NULL_BYTE_LOW", ")", "{", "return", "null", ";", "}", "return", "decodeChar", "(", "src", ",", "srcOffset", "+", "1", ")", ";", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "throw", "new", "CorruptEncodingException", "(", "null", ",", "e", ")", ";", "}", "}" ]
Decodes a Character object from exactly 1 or 3 bytes. If null is returned, then 1 byte was read. @param src source of encoded bytes @param srcOffset offset into source array @return Character object or null
[ "Decodes", "a", "Character", "object", "from", "exactly", "1", "or", "3", "bytes", ".", "If", "null", "is", "returned", "then", "1", "byte", "was", "read", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L231-L243
8,222
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/DataDecoder.java
DataDecoder.decodeBoolean
public static boolean decodeBoolean(byte[] src, int srcOffset) throws CorruptEncodingException { try { return src[srcOffset] == (byte)128; } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
java
public static boolean decodeBoolean(byte[] src, int srcOffset) throws CorruptEncodingException { try { return src[srcOffset] == (byte)128; } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
[ "public", "static", "boolean", "decodeBoolean", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ")", "throws", "CorruptEncodingException", "{", "try", "{", "return", "src", "[", "srcOffset", "]", "==", "(", "byte", ")", "128", ";", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "throw", "new", "CorruptEncodingException", "(", "null", ",", "e", ")", ";", "}", "}" ]
Decodes a boolean from exactly 1 byte. @param src source of encoded bytes @param srcOffset offset into source array @return boolean value
[ "Decodes", "a", "boolean", "from", "exactly", "1", "byte", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L252-L260
8,223
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/DataDecoder.java
DataDecoder.decodeBooleanObj
public static Boolean decodeBooleanObj(byte[] src, int srcOffset) throws CorruptEncodingException { try { switch (src[srcOffset]) { case NULL_BYTE_LOW: case NULL_BYTE_HIGH: return null; case (byte)128: return Boolean.TRUE; default: return Boolean.FALSE; } } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
java
public static Boolean decodeBooleanObj(byte[] src, int srcOffset) throws CorruptEncodingException { try { switch (src[srcOffset]) { case NULL_BYTE_LOW: case NULL_BYTE_HIGH: return null; case (byte)128: return Boolean.TRUE; default: return Boolean.FALSE; } } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
[ "public", "static", "Boolean", "decodeBooleanObj", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ")", "throws", "CorruptEncodingException", "{", "try", "{", "switch", "(", "src", "[", "srcOffset", "]", ")", "{", "case", "NULL_BYTE_LOW", ":", "case", "NULL_BYTE_HIGH", ":", "return", "null", ";", "case", "(", "byte", ")", "128", ":", "return", "Boolean", ".", "TRUE", ";", "default", ":", "return", "Boolean", ".", "FALSE", ";", "}", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "throw", "new", "CorruptEncodingException", "(", "null", ",", "e", ")", ";", "}", "}" ]
Decodes a Boolean object from exactly 1 byte. @param src source of encoded bytes @param srcOffset offset into source array @return Boolean object or null
[ "Decodes", "a", "Boolean", "object", "from", "exactly", "1", "byte", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L269-L284
8,224
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/DataDecoder.java
DataDecoder.decodeFloat
public static float decodeFloat(byte[] src, int srcOffset) throws CorruptEncodingException { int bits = decodeFloatBits(src, srcOffset); bits ^= (bits < 0) ? 0x80000000 : 0xffffffff; return Float.intBitsToFloat(bits); }
java
public static float decodeFloat(byte[] src, int srcOffset) throws CorruptEncodingException { int bits = decodeFloatBits(src, srcOffset); bits ^= (bits < 0) ? 0x80000000 : 0xffffffff; return Float.intBitsToFloat(bits); }
[ "public", "static", "float", "decodeFloat", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ")", "throws", "CorruptEncodingException", "{", "int", "bits", "=", "decodeFloatBits", "(", "src", ",", "srcOffset", ")", ";", "bits", "^=", "(", "bits", "<", "0", ")", "?", "0x80000000", ":", "0xffffffff", ";", "return", "Float", ".", "intBitsToFloat", "(", "bits", ")", ";", "}" ]
Decodes a float from exactly 4 bytes. @param src source of encoded bytes @param srcOffset offset into source array @return float value
[ "Decodes", "a", "float", "from", "exactly", "4", "bytes", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L293-L299
8,225
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/DataDecoder.java
DataDecoder.decodeDouble
public static double decodeDouble(byte[] src, int srcOffset) throws CorruptEncodingException { long bits = decodeDoubleBits(src, srcOffset); bits ^= (bits < 0) ? 0x8000000000000000L : 0xffffffffffffffffL; return Double.longBitsToDouble(bits); }
java
public static double decodeDouble(byte[] src, int srcOffset) throws CorruptEncodingException { long bits = decodeDoubleBits(src, srcOffset); bits ^= (bits < 0) ? 0x8000000000000000L : 0xffffffffffffffffL; return Double.longBitsToDouble(bits); }
[ "public", "static", "double", "decodeDouble", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ")", "throws", "CorruptEncodingException", "{", "long", "bits", "=", "decodeDoubleBits", "(", "src", ",", "srcOffset", ")", ";", "bits", "^=", "(", "bits", "<", "0", ")", "?", "0x8000000000000000", "L", ":", "0xffffffffffffffff", "", "L", ";", "return", "Double", ".", "longBitsToDouble", "(", "bits", ")", ";", "}" ]
Decodes a double from exactly 8 bytes. @param src source of encoded bytes @param srcOffset offset into source array @return double value
[ "Decodes", "a", "double", "from", "exactly", "8", "bytes", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L334-L340
8,226
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/DataDecoder.java
DataDecoder.decode
public static int decode(byte[] src, int srcOffset, BigInteger[] valueRef) throws CorruptEncodingException { byte[][] bytesRef = new byte[1][]; int amt = decode(src, srcOffset, bytesRef); valueRef[0] = (bytesRef[0] == null) ? null : new BigInteger(bytesRef[0]); return amt; }
java
public static int decode(byte[] src, int srcOffset, BigInteger[] valueRef) throws CorruptEncodingException { byte[][] bytesRef = new byte[1][]; int amt = decode(src, srcOffset, bytesRef); valueRef[0] = (bytesRef[0] == null) ? null : new BigInteger(bytesRef[0]); return amt; }
[ "public", "static", "int", "decode", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ",", "BigInteger", "[", "]", "valueRef", ")", "throws", "CorruptEncodingException", "{", "byte", "[", "]", "[", "]", "bytesRef", "=", "new", "byte", "[", "1", "]", "[", "", "]", ";", "int", "amt", "=", "decode", "(", "src", ",", "srcOffset", ",", "bytesRef", ")", ";", "valueRef", "[", "0", "]", "=", "(", "bytesRef", "[", "0", "]", "==", "null", ")", "?", "null", ":", "new", "BigInteger", "(", "bytesRef", "[", "0", "]", ")", ";", "return", "amt", ";", "}" ]
Decodes a BigInteger. @param src source of encoded data @param srcOffset offset into encoded data @param valueRef decoded BigInteger is stored in element 0, which may be null @return amount of bytes read from source @throws CorruptEncodingException if source data is corrupt @since 1.2
[ "Decodes", "a", "BigInteger", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L385-L392
8,227
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/DataDecoder.java
DataDecoder.decode
public static int decode(byte[] src, int srcOffset, BigDecimal[] valueRef) throws CorruptEncodingException { try { final int originalOffset = srcOffset; int b = src[srcOffset++] & 0xff; if (b >= 0xf8) { valueRef[0] = null; return 1; } int scale; if (b <= 0x7f) { scale = b; } else if (b <= 0xbf) { scale = ((b & 0x3f) << 8) | (src[srcOffset++] & 0xff); } else if (b <= 0xdf) { scale = ((b & 0x1f) << 16) | ((src[srcOffset++] & 0xff) << 8) | (src[srcOffset++] & 0xff); } else if (b <= 0xef) { scale = ((b & 0x0f) << 24) | ((src[srcOffset++] & 0xff) << 16) | ((src[srcOffset++] & 0xff) << 8) | (src[srcOffset++] & 0xff); } else { scale = ((src[srcOffset++] & 0xff) << 24) | ((src[srcOffset++] & 0xff) << 16) | ((src[srcOffset++] & 0xff) << 8) | (src[srcOffset++] & 0xff); } if ((scale & 1) != 0) { scale = (~(scale >> 1)) | (1 << 31); } else { scale >>>= 1; } BigInteger[] unscaledRef = new BigInteger[1]; int amt = decode(src, srcOffset, unscaledRef); valueRef[0] = new BigDecimal(unscaledRef[0], scale); return (srcOffset + amt) - originalOffset; } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
java
public static int decode(byte[] src, int srcOffset, BigDecimal[] valueRef) throws CorruptEncodingException { try { final int originalOffset = srcOffset; int b = src[srcOffset++] & 0xff; if (b >= 0xf8) { valueRef[0] = null; return 1; } int scale; if (b <= 0x7f) { scale = b; } else if (b <= 0xbf) { scale = ((b & 0x3f) << 8) | (src[srcOffset++] & 0xff); } else if (b <= 0xdf) { scale = ((b & 0x1f) << 16) | ((src[srcOffset++] & 0xff) << 8) | (src[srcOffset++] & 0xff); } else if (b <= 0xef) { scale = ((b & 0x0f) << 24) | ((src[srcOffset++] & 0xff) << 16) | ((src[srcOffset++] & 0xff) << 8) | (src[srcOffset++] & 0xff); } else { scale = ((src[srcOffset++] & 0xff) << 24) | ((src[srcOffset++] & 0xff) << 16) | ((src[srcOffset++] & 0xff) << 8) | (src[srcOffset++] & 0xff); } if ((scale & 1) != 0) { scale = (~(scale >> 1)) | (1 << 31); } else { scale >>>= 1; } BigInteger[] unscaledRef = new BigInteger[1]; int amt = decode(src, srcOffset, unscaledRef); valueRef[0] = new BigDecimal(unscaledRef[0], scale); return (srcOffset + amt) - originalOffset; } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
[ "public", "static", "int", "decode", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ",", "BigDecimal", "[", "]", "valueRef", ")", "throws", "CorruptEncodingException", "{", "try", "{", "final", "int", "originalOffset", "=", "srcOffset", ";", "int", "b", "=", "src", "[", "srcOffset", "++", "]", "&", "0xff", ";", "if", "(", "b", ">=", "0xf8", ")", "{", "valueRef", "[", "0", "]", "=", "null", ";", "return", "1", ";", "}", "int", "scale", ";", "if", "(", "b", "<=", "0x7f", ")", "{", "scale", "=", "b", ";", "}", "else", "if", "(", "b", "<=", "0xbf", ")", "{", "scale", "=", "(", "(", "b", "&", "0x3f", ")", "<<", "8", ")", "|", "(", "src", "[", "srcOffset", "++", "]", "&", "0xff", ")", ";", "}", "else", "if", "(", "b", "<=", "0xdf", ")", "{", "scale", "=", "(", "(", "b", "&", "0x1f", ")", "<<", "16", ")", "|", "(", "(", "src", "[", "srcOffset", "++", "]", "&", "0xff", ")", "<<", "8", ")", "|", "(", "src", "[", "srcOffset", "++", "]", "&", "0xff", ")", ";", "}", "else", "if", "(", "b", "<=", "0xef", ")", "{", "scale", "=", "(", "(", "b", "&", "0x0f", ")", "<<", "24", ")", "|", "(", "(", "src", "[", "srcOffset", "++", "]", "&", "0xff", ")", "<<", "16", ")", "|", "(", "(", "src", "[", "srcOffset", "++", "]", "&", "0xff", ")", "<<", "8", ")", "|", "(", "src", "[", "srcOffset", "++", "]", "&", "0xff", ")", ";", "}", "else", "{", "scale", "=", "(", "(", "src", "[", "srcOffset", "++", "]", "&", "0xff", ")", "<<", "24", ")", "|", "(", "(", "src", "[", "srcOffset", "++", "]", "&", "0xff", ")", "<<", "16", ")", "|", "(", "(", "src", "[", "srcOffset", "++", "]", "&", "0xff", ")", "<<", "8", ")", "|", "(", "src", "[", "srcOffset", "++", "]", "&", "0xff", ")", ";", "}", "if", "(", "(", "scale", "&", "1", ")", "!=", "0", ")", "{", "scale", "=", "(", "~", "(", "scale", ">>", "1", ")", ")", "|", "(", "1", "<<", "31", ")", ";", "}", "else", "{", "scale", ">>>=", "1", ";", "}", "BigInteger", "[", "]", "unscaledRef", "=", "new", "BigInteger", "[", "1", "]", ";", "int", "amt", "=", "decode", "(", "src", ",", "srcOffset", ",", "unscaledRef", ")", ";", "valueRef", "[", "0", "]", "=", "new", "BigDecimal", "(", "unscaledRef", "[", "0", "]", ",", "scale", ")", ";", "return", "(", "srcOffset", "+", "amt", ")", "-", "originalOffset", ";", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "throw", "new", "CorruptEncodingException", "(", "null", ",", "e", ")", ";", "}", "}" ]
Decodes a BigDecimal. @param src source of encoded data @param srcOffset offset into encoded data @param valueRef decoded BigDecimal is stored in element 0, which may be null @return amount of bytes read from source @throws CorruptEncodingException if source data is corrupt @since 1.2
[ "Decodes", "a", "BigDecimal", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L404-L448
8,228
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/DataDecoder.java
DataDecoder.decode
public static int decode(byte[] src, int srcOffset, byte[][] valueRef) throws CorruptEncodingException { try { final int originalOffset = srcOffset; int b = src[srcOffset++] & 0xff; if (b >= 0xf8) { valueRef[0] = null; return 1; } int valueLength; if (b <= 0x7f) { valueLength = b; } else if (b <= 0xbf) { valueLength = ((b & 0x3f) << 8) | (src[srcOffset++] & 0xff); } else if (b <= 0xdf) { valueLength = ((b & 0x1f) << 16) | ((src[srcOffset++] & 0xff) << 8) | (src[srcOffset++] & 0xff); } else if (b <= 0xef) { valueLength = ((b & 0x0f) << 24) | ((src[srcOffset++] & 0xff) << 16) | ((src[srcOffset++] & 0xff) << 8) | (src[srcOffset++] & 0xff); } else { valueLength = ((src[srcOffset++] & 0xff) << 24) | ((src[srcOffset++] & 0xff) << 16) | ((src[srcOffset++] & 0xff) << 8) | (src[srcOffset++] & 0xff); } if (valueLength == 0) { valueRef[0] = EMPTY_BYTE_ARRAY; } else { byte[] value = new byte[valueLength]; System.arraycopy(src, srcOffset, value, 0, valueLength); valueRef[0]= value; } return srcOffset - originalOffset + valueLength; } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
java
public static int decode(byte[] src, int srcOffset, byte[][] valueRef) throws CorruptEncodingException { try { final int originalOffset = srcOffset; int b = src[srcOffset++] & 0xff; if (b >= 0xf8) { valueRef[0] = null; return 1; } int valueLength; if (b <= 0x7f) { valueLength = b; } else if (b <= 0xbf) { valueLength = ((b & 0x3f) << 8) | (src[srcOffset++] & 0xff); } else if (b <= 0xdf) { valueLength = ((b & 0x1f) << 16) | ((src[srcOffset++] & 0xff) << 8) | (src[srcOffset++] & 0xff); } else if (b <= 0xef) { valueLength = ((b & 0x0f) << 24) | ((src[srcOffset++] & 0xff) << 16) | ((src[srcOffset++] & 0xff) << 8) | (src[srcOffset++] & 0xff); } else { valueLength = ((src[srcOffset++] & 0xff) << 24) | ((src[srcOffset++] & 0xff) << 16) | ((src[srcOffset++] & 0xff) << 8) | (src[srcOffset++] & 0xff); } if (valueLength == 0) { valueRef[0] = EMPTY_BYTE_ARRAY; } else { byte[] value = new byte[valueLength]; System.arraycopy(src, srcOffset, value, 0, valueLength); valueRef[0]= value; } return srcOffset - originalOffset + valueLength; } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
[ "public", "static", "int", "decode", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ",", "byte", "[", "]", "[", "]", "valueRef", ")", "throws", "CorruptEncodingException", "{", "try", "{", "final", "int", "originalOffset", "=", "srcOffset", ";", "int", "b", "=", "src", "[", "srcOffset", "++", "]", "&", "0xff", ";", "if", "(", "b", ">=", "0xf8", ")", "{", "valueRef", "[", "0", "]", "=", "null", ";", "return", "1", ";", "}", "int", "valueLength", ";", "if", "(", "b", "<=", "0x7f", ")", "{", "valueLength", "=", "b", ";", "}", "else", "if", "(", "b", "<=", "0xbf", ")", "{", "valueLength", "=", "(", "(", "b", "&", "0x3f", ")", "<<", "8", ")", "|", "(", "src", "[", "srcOffset", "++", "]", "&", "0xff", ")", ";", "}", "else", "if", "(", "b", "<=", "0xdf", ")", "{", "valueLength", "=", "(", "(", "b", "&", "0x1f", ")", "<<", "16", ")", "|", "(", "(", "src", "[", "srcOffset", "++", "]", "&", "0xff", ")", "<<", "8", ")", "|", "(", "src", "[", "srcOffset", "++", "]", "&", "0xff", ")", ";", "}", "else", "if", "(", "b", "<=", "0xef", ")", "{", "valueLength", "=", "(", "(", "b", "&", "0x0f", ")", "<<", "24", ")", "|", "(", "(", "src", "[", "srcOffset", "++", "]", "&", "0xff", ")", "<<", "16", ")", "|", "(", "(", "src", "[", "srcOffset", "++", "]", "&", "0xff", ")", "<<", "8", ")", "|", "(", "src", "[", "srcOffset", "++", "]", "&", "0xff", ")", ";", "}", "else", "{", "valueLength", "=", "(", "(", "src", "[", "srcOffset", "++", "]", "&", "0xff", ")", "<<", "24", ")", "|", "(", "(", "src", "[", "srcOffset", "++", "]", "&", "0xff", ")", "<<", "16", ")", "|", "(", "(", "src", "[", "srcOffset", "++", "]", "&", "0xff", ")", "<<", "8", ")", "|", "(", "src", "[", "srcOffset", "++", "]", "&", "0xff", ")", ";", "}", "if", "(", "valueLength", "==", "0", ")", "{", "valueRef", "[", "0", "]", "=", "EMPTY_BYTE_ARRAY", ";", "}", "else", "{", "byte", "[", "]", "value", "=", "new", "byte", "[", "valueLength", "]", ";", "System", ".", "arraycopy", "(", "src", ",", "srcOffset", ",", "value", ",", "0", ",", "valueLength", ")", ";", "valueRef", "[", "0", "]", "=", "value", ";", "}", "return", "srcOffset", "-", "originalOffset", "+", "valueLength", ";", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "throw", "new", "CorruptEncodingException", "(", "null", ",", "e", ")", ";", "}", "}" ]
Decodes the given byte array. @param src source of encoded data @param srcOffset offset into encoded data @param valueRef decoded byte array is stored in element 0, which may be null @return amount of bytes read from source @throws CorruptEncodingException if source data is corrupt
[ "Decodes", "the", "given", "byte", "array", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L459-L500
8,229
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/DataDecoder.java
DataDecoder.readFully
public static void readFully(InputStream in, byte[] b) throws IOException, EOFException { final int length = b.length; int total = 0; while (total < length) { int amt = in.read(b, total, length - total); if (amt < 0) { throw new EOFException(); } total += amt; } }
java
public static void readFully(InputStream in, byte[] b) throws IOException, EOFException { final int length = b.length; int total = 0; while (total < length) { int amt = in.read(b, total, length - total); if (amt < 0) { throw new EOFException(); } total += amt; } }
[ "public", "static", "void", "readFully", "(", "InputStream", "in", ",", "byte", "[", "]", "b", ")", "throws", "IOException", ",", "EOFException", "{", "final", "int", "length", "=", "b", ".", "length", ";", "int", "total", "=", "0", ";", "while", "(", "total", "<", "length", ")", "{", "int", "amt", "=", "in", ".", "read", "(", "b", ",", "total", ",", "length", "-", "total", ")", ";", "if", "(", "amt", "<", "0", ")", "{", "throw", "new", "EOFException", "(", ")", ";", "}", "total", "+=", "amt", ";", "}", "}" ]
Reads as many bytes from the stream as is necessary to fill the given byte array. An EOFException is thrown if the stream end is encountered. @since 1.2
[ "Reads", "as", "many", "bytes", "from", "the", "stream", "as", "is", "necessary", "to", "fill", "the", "given", "byte", "array", ".", "An", "EOFException", "is", "thrown", "if", "the", "stream", "end", "is", "encountered", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L647-L657
8,230
michael-rapp/AndroidMaterialValidation
library/src/main/java/de/mrapp/android/validation/Constraints.java
Constraints.conjunctive
@SafeVarargs public static <Type> Constraint<Type> conjunctive( @NonNull final Constraint<Type>... constraints) { return ConjunctiveConstraint.create(constraints); }
java
@SafeVarargs public static <Type> Constraint<Type> conjunctive( @NonNull final Constraint<Type>... constraints) { return ConjunctiveConstraint.create(constraints); }
[ "@", "SafeVarargs", "public", "static", "<", "Type", ">", "Constraint", "<", "Type", ">", "conjunctive", "(", "@", "NonNull", "final", "Constraint", "<", "Type", ">", "...", "constraints", ")", "{", "return", "ConjunctiveConstraint", ".", "create", "(", "constraints", ")", ";", "}" ]
Creates and returns a constraint, which allows to combine multiple constraints in a conjunctive manner. Only if all single constraints are satisfied, the resulting constraint will also be satisfied. @param <Type> The type of the values, which should be verified @param constraints The single constraints, the constraint should consist of, as an array of the type {@link Constraint}. The constraints may neither be null, nor empty @return The constraint, which has been created, as an instance of the type {@link Constraint}
[ "Creates", "and", "returns", "a", "constraint", "which", "allows", "to", "combine", "multiple", "constraints", "in", "a", "conjunctive", "manner", ".", "Only", "if", "all", "single", "constraints", "are", "satisfied", "the", "resulting", "constraint", "will", "also", "be", "satisfied", "." ]
ac8693baeac7abddf2e38a47da4c1849d4661a8b
https://github.com/michael-rapp/AndroidMaterialValidation/blob/ac8693baeac7abddf2e38a47da4c1849d4661a8b/library/src/main/java/de/mrapp/android/validation/Constraints.java#L71-L75
8,231
michael-rapp/AndroidMaterialValidation
library/src/main/java/de/mrapp/android/validation/Constraints.java
Constraints.disjunctive
@SafeVarargs public static <Type> Constraint<Type> disjunctive( @NonNull final Constraint<Type>... constraints) { return DisjunctiveConstraint.create(constraints); }
java
@SafeVarargs public static <Type> Constraint<Type> disjunctive( @NonNull final Constraint<Type>... constraints) { return DisjunctiveConstraint.create(constraints); }
[ "@", "SafeVarargs", "public", "static", "<", "Type", ">", "Constraint", "<", "Type", ">", "disjunctive", "(", "@", "NonNull", "final", "Constraint", "<", "Type", ">", "...", "constraints", ")", "{", "return", "DisjunctiveConstraint", ".", "create", "(", "constraints", ")", ";", "}" ]
Creates and returns a constraint, which allows to combine multiple constraints in a disjunctive manner. If at least one constraint is satisfied, the resulting constraint will also be satisfied. @param <Type> The type of the values, which should be verified @param constraints The single constraints, the constraint should consist of, as an array of the type {@link Constraint}. The constraints may neither be null, nor empty @return The constraint, which has been created, as an instance of the type {@link Constraint}
[ "Creates", "and", "returns", "a", "constraint", "which", "allows", "to", "combine", "multiple", "constraints", "in", "a", "disjunctive", "manner", ".", "If", "at", "least", "one", "constraint", "is", "satisfied", "the", "resulting", "constraint", "will", "also", "be", "satisfied", "." ]
ac8693baeac7abddf2e38a47da4c1849d4661a8b
https://github.com/michael-rapp/AndroidMaterialValidation/blob/ac8693baeac7abddf2e38a47da4c1849d4661a8b/library/src/main/java/de/mrapp/android/validation/Constraints.java#L89-L93
8,232
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/repo/indexed/IndexEntryGenerator.java
IndexEntryGenerator.getIndexAccess
public static <S extends Storable> SyntheticStorableReferenceAccess<S> getIndexAccess(StorableIndex<S> index) throws SupportException { // Strip out index property not related to its identity. index = index.clustered(false); synchronized (cCache) { SyntheticStorableReferenceAccess<S> access = cCache.get(index); if (access != null) { return access; } // Need to try to find the base type. This is an awkward way to do // it, but we have nothing better available to us Class<S> type = index.getProperty(0).getEnclosingType(); SyntheticStorableReferenceBuilder<S> builder = new SyntheticStorableReferenceBuilder<S>(type, index.isUnique()); for (int i=0; i<index.getPropertyCount(); i++) { StorableProperty<S> source = index.getProperty(i); builder.addKeyProperty(source.getName(), index.getPropertyDirection(i)); } builder.build(); access = builder.getReferenceAccess(); cCache.put(index, access); return access; } }
java
public static <S extends Storable> SyntheticStorableReferenceAccess<S> getIndexAccess(StorableIndex<S> index) throws SupportException { // Strip out index property not related to its identity. index = index.clustered(false); synchronized (cCache) { SyntheticStorableReferenceAccess<S> access = cCache.get(index); if (access != null) { return access; } // Need to try to find the base type. This is an awkward way to do // it, but we have nothing better available to us Class<S> type = index.getProperty(0).getEnclosingType(); SyntheticStorableReferenceBuilder<S> builder = new SyntheticStorableReferenceBuilder<S>(type, index.isUnique()); for (int i=0; i<index.getPropertyCount(); i++) { StorableProperty<S> source = index.getProperty(i); builder.addKeyProperty(source.getName(), index.getPropertyDirection(i)); } builder.build(); access = builder.getReferenceAccess(); cCache.put(index, access); return access; } }
[ "public", "static", "<", "S", "extends", "Storable", ">", "SyntheticStorableReferenceAccess", "<", "S", ">", "getIndexAccess", "(", "StorableIndex", "<", "S", ">", "index", ")", "throws", "SupportException", "{", "// Strip out index property not related to its identity.\r", "index", "=", "index", ".", "clustered", "(", "false", ")", ";", "synchronized", "(", "cCache", ")", "{", "SyntheticStorableReferenceAccess", "<", "S", ">", "access", "=", "cCache", ".", "get", "(", "index", ")", ";", "if", "(", "access", "!=", "null", ")", "{", "return", "access", ";", "}", "// Need to try to find the base type. This is an awkward way to do\r", "// it, but we have nothing better available to us\r", "Class", "<", "S", ">", "type", "=", "index", ".", "getProperty", "(", "0", ")", ".", "getEnclosingType", "(", ")", ";", "SyntheticStorableReferenceBuilder", "<", "S", ">", "builder", "=", "new", "SyntheticStorableReferenceBuilder", "<", "S", ">", "(", "type", ",", "index", ".", "isUnique", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "index", ".", "getPropertyCount", "(", ")", ";", "i", "++", ")", "{", "StorableProperty", "<", "S", ">", "source", "=", "index", ".", "getProperty", "(", "i", ")", ";", "builder", ".", "addKeyProperty", "(", "source", ".", "getName", "(", ")", ",", "index", ".", "getPropertyDirection", "(", "i", ")", ")", ";", "}", "builder", ".", "build", "(", ")", ";", "access", "=", "builder", ".", "getReferenceAccess", "(", ")", ";", "cCache", ".", "put", "(", "index", ",", "access", ")", ";", "return", "access", ";", "}", "}" ]
Returns a new or cached index access instance. The caching of accessors is soft, so if no references remain to a given instance it may be garbage collected. A subsequent call will return a newly created instance. <p>In addition to generating an index entry storable, the accessor contains methods to operate on it. Care must be taken to ensure that the index entry instances are of the same type that the accessor expects. Since the accessor may be garbage collected freely of the generated index entry class, it is possible for index entries to be passed to a accessor instance that does not understand it. For example: <pre> StorableIndex index = ... Class indexEntryClass = IndexEntryGenerator.getIndexAccess(index).getReferenceClass(); ... garbage collection ... Storable indexEntry = instance of indexEntryClass // Might fail because generator instance is new IndexEntryGenerator.getIndexAccess(index).copyFromMaster(indexEntry, master); </pre> The above code can be fixed by saving a local reference to the accessor: <pre> StorableIndex index = ... SyntheticStorableReferenceAccess access = IndexEntryGenerator.getIndexAccess(index); Class indexEntryClass = access.getReferenceClass(); ... Storable indexEntry = instance of indexEntryClass access.copyFromMaster(indexEntry, master); </pre> @throws SupportException if any non-primary key property doesn't have a public read method.
[ "Returns", "a", "new", "or", "cached", "index", "access", "instance", ".", "The", "caching", "of", "accessors", "is", "soft", "so", "if", "no", "references", "remain", "to", "a", "given", "instance", "it", "may", "be", "garbage", "collected", ".", "A", "subsequent", "call", "will", "return", "a", "newly", "created", "instance", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/repo/indexed/IndexEntryGenerator.java#L81-L113
8,233
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java
BDBRepository.forceCheckpoint
public void forceCheckpoint() throws PersistException { if (mCheckpointer != null) { mCheckpointer.forceCheckpoint(); } else { try { env_checkpoint(); } catch (Exception e) { throw toPersistException(e); } } }
java
public void forceCheckpoint() throws PersistException { if (mCheckpointer != null) { mCheckpointer.forceCheckpoint(); } else { try { env_checkpoint(); } catch (Exception e) { throw toPersistException(e); } } }
[ "public", "void", "forceCheckpoint", "(", ")", "throws", "PersistException", "{", "if", "(", "mCheckpointer", "!=", "null", ")", "{", "mCheckpointer", ".", "forceCheckpoint", "(", ")", ";", "}", "else", "{", "try", "{", "env_checkpoint", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "toPersistException", "(", "e", ")", ";", "}", "}", "}" ]
Forces a checkpoint to run now, even if checkpointer is suspended or disabled. If a checkpoint is in progress, then this method will block until it is finished, and then run another checkpoint. This method does not return until the requested checkpoint has finished.
[ "Forces", "a", "checkpoint", "to", "run", "now", "even", "if", "checkpointer", "is", "suspended", "or", "disabled", ".", "If", "a", "checkpoint", "is", "in", "progress", "then", "this", "method", "will", "block", "until", "it", "is", "finished", "and", "then", "run", "another", "checkpoint", ".", "This", "method", "does", "not", "return", "until", "the", "requested", "checkpoint", "has", "finished", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java#L327-L337
8,234
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java
BDBRepository.getDatabaseName
String getDatabaseName(String dbName) { if (mFileNameMap == null) { return null; } String name = mFileNameMap.get(dbName); if (name == null && dbName != null) { name = mFileNameMap.get(null); } if (name == null) { return null; } if (mDatabaseHook != null) { try { dbName = mDatabaseHook.databaseName(dbName); } catch (IncompatibleClassChangeError e) { // Method not implemented. } } return dbName; }
java
String getDatabaseName(String dbName) { if (mFileNameMap == null) { return null; } String name = mFileNameMap.get(dbName); if (name == null && dbName != null) { name = mFileNameMap.get(null); } if (name == null) { return null; } if (mDatabaseHook != null) { try { dbName = mDatabaseHook.databaseName(dbName); } catch (IncompatibleClassChangeError e) { // Method not implemented. } } return dbName; }
[ "String", "getDatabaseName", "(", "String", "dbName", ")", "{", "if", "(", "mFileNameMap", "==", "null", ")", "{", "return", "null", ";", "}", "String", "name", "=", "mFileNameMap", ".", "get", "(", "dbName", ")", ";", "if", "(", "name", "==", "null", "&&", "dbName", "!=", "null", ")", "{", "name", "=", "mFileNameMap", ".", "get", "(", "null", ")", ";", "}", "if", "(", "name", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "mDatabaseHook", "!=", "null", ")", "{", "try", "{", "dbName", "=", "mDatabaseHook", ".", "databaseName", "(", "dbName", ")", ";", "}", "catch", "(", "IncompatibleClassChangeError", "e", ")", "{", "// Method not implemented.", "}", "}", "return", "dbName", ";", "}" ]
Returns null if name should not be used.
[ "Returns", "null", "if", "name", "should", "not", "be", "used", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java#L514-L533
8,235
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java
BDBRepository.getDatabasePageSize
Integer getDatabasePageSize(Class<? extends Storable> type) { if (mDatabasePageSizes == null) { return null; } Integer size = mDatabasePageSizes.get(type); if (size == null && type != null) { size = mDatabasePageSizes.get(null); } return size; }
java
Integer getDatabasePageSize(Class<? extends Storable> type) { if (mDatabasePageSizes == null) { return null; } Integer size = mDatabasePageSizes.get(type); if (size == null && type != null) { size = mDatabasePageSizes.get(null); } return size; }
[ "Integer", "getDatabasePageSize", "(", "Class", "<", "?", "extends", "Storable", ">", "type", ")", "{", "if", "(", "mDatabasePageSizes", "==", "null", ")", "{", "return", "null", ";", "}", "Integer", "size", "=", "mDatabasePageSizes", ".", "get", "(", "type", ")", ";", "if", "(", "size", "==", "null", "&&", "type", "!=", "null", ")", "{", "size", "=", "mDatabasePageSizes", ".", "get", "(", "null", ")", ";", "}", "return", "size", ";", "}" ]
Returns the desired page size for the given type, or null for default.
[ "Returns", "the", "desired", "page", "size", "for", "the", "given", "type", "or", "null", "for", "default", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java#L564-L573
8,236
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java
BDBRepository.txn_begin
Txn txn_begin(Txn parent, IsolationLevel level, int timeout, TimeUnit unit) throws Exception { return txn_begin(parent, level); }
java
Txn txn_begin(Txn parent, IsolationLevel level, int timeout, TimeUnit unit) throws Exception { return txn_begin(parent, level); }
[ "Txn", "txn_begin", "(", "Txn", "parent", ",", "IsolationLevel", "level", ",", "int", "timeout", ",", "TimeUnit", "unit", ")", "throws", "Exception", "{", "return", "txn_begin", "(", "parent", ",", "level", ")", ";", "}" ]
Subclass should override this method to actually apply the timeout
[ "Subclass", "should", "override", "this", "method", "to", "actually", "apply", "the", "timeout" ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepository.java#L655-L657
8,237
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/info/ChainedProperty.java
ChainedProperty.get
@SuppressWarnings("unchecked") public static <S extends Storable> ChainedProperty<S> get(StorableProperty<S> prime) { return (ChainedProperty<S>) cCanonical.put(new ChainedProperty<S>(prime, null, null)); }
java
@SuppressWarnings("unchecked") public static <S extends Storable> ChainedProperty<S> get(StorableProperty<S> prime) { return (ChainedProperty<S>) cCanonical.put(new ChainedProperty<S>(prime, null, null)); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "S", "extends", "Storable", ">", "ChainedProperty", "<", "S", ">", "get", "(", "StorableProperty", "<", "S", ">", "prime", ")", "{", "return", "(", "ChainedProperty", "<", "S", ">", ")", "cCanonical", ".", "put", "(", "new", "ChainedProperty", "<", "S", ">", "(", "prime", ",", "null", ",", "null", ")", ")", ";", "}" ]
Returns a canonical instance which has no chain. @throws IllegalArgumentException if prime is null
[ "Returns", "a", "canonical", "instance", "which", "has", "no", "chain", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/info/ChainedProperty.java#L50-L53
8,238
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/info/ChainedProperty.java
ChainedProperty.isNullable
public boolean isNullable() { if (mPrime.isNullable()) { return true; } if (mChain != null) { for (StorableProperty<?> prop : mChain) { if (prop.isNullable()) { return true; } } } return false; }
java
public boolean isNullable() { if (mPrime.isNullable()) { return true; } if (mChain != null) { for (StorableProperty<?> prop : mChain) { if (prop.isNullable()) { return true; } } } return false; }
[ "public", "boolean", "isNullable", "(", ")", "{", "if", "(", "mPrime", ".", "isNullable", "(", ")", ")", "{", "return", "true", ";", "}", "if", "(", "mChain", "!=", "null", ")", "{", "for", "(", "StorableProperty", "<", "?", ">", "prop", ":", "mChain", ")", "{", "if", "(", "prop", ".", "isNullable", "(", ")", ")", "{", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}" ]
Returns true if any property in the chain can be null. @see com.amazon.carbonado.Nullable @since 1.2
[ "Returns", "true", "if", "any", "property", "in", "the", "chain", "can", "be", "null", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/info/ChainedProperty.java#L245-L257
8,239
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/info/ChainedProperty.java
ChainedProperty.isDerived
public boolean isDerived() { if (mPrime.isDerived()) { return true; } if (mChain != null) { for (StorableProperty<?> prop : mChain) { if (prop.isDerived()) { return true; } } } return false; }
java
public boolean isDerived() { if (mPrime.isDerived()) { return true; } if (mChain != null) { for (StorableProperty<?> prop : mChain) { if (prop.isDerived()) { return true; } } } return false; }
[ "public", "boolean", "isDerived", "(", ")", "{", "if", "(", "mPrime", ".", "isDerived", "(", ")", ")", "{", "return", "true", ";", "}", "if", "(", "mChain", "!=", "null", ")", "{", "for", "(", "StorableProperty", "<", "?", ">", "prop", ":", "mChain", ")", "{", "if", "(", "prop", ".", "isDerived", "(", ")", ")", "{", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}" ]
Returns true if any property in the chain is derived. @see com.amazon.carbonado.Derived @since 1.2
[ "Returns", "true", "if", "any", "property", "in", "the", "chain", "is", "derived", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/info/ChainedProperty.java#L265-L277
8,240
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/info/ChainedProperty.java
ChainedProperty.isOuterJoin
public boolean isOuterJoin(int index) throws IndexOutOfBoundsException { if (index < 0) { throw new IndexOutOfBoundsException(); } if (mOuterJoin == null) { if (index > getChainCount()) { throw new IndexOutOfBoundsException(); } return false; } return mOuterJoin[index]; }
java
public boolean isOuterJoin(int index) throws IndexOutOfBoundsException { if (index < 0) { throw new IndexOutOfBoundsException(); } if (mOuterJoin == null) { if (index > getChainCount()) { throw new IndexOutOfBoundsException(); } return false; } return mOuterJoin[index]; }
[ "public", "boolean", "isOuterJoin", "(", "int", "index", ")", "throws", "IndexOutOfBoundsException", "{", "if", "(", "index", "<", "0", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", ")", ";", "}", "if", "(", "mOuterJoin", "==", "null", ")", "{", "if", "(", "index", ">", "getChainCount", "(", ")", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", ")", ";", "}", "return", "false", ";", "}", "return", "mOuterJoin", "[", "index", "]", ";", "}" ]
Returns true if the property at the given index should be treated as an outer join. Index zero is the prime property. @param index valid range is 0 to chainCount @since 1.2
[ "Returns", "true", "if", "the", "property", "at", "the", "given", "index", "should", "be", "treated", "as", "an", "outer", "join", ".", "Index", "zero", "is", "the", "prime", "property", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/info/ChainedProperty.java#L313-L324
8,241
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/info/ChainedProperty.java
ChainedProperty.trim
public ChainedProperty<S> trim() { if (getChainCount() == 0) { throw new IllegalStateException(); } if (getChainCount() == 1) { if (!isOuterJoin(0)) { return get(mPrime); } else { return get(mPrime, null, new boolean[] {true}); } } StorableProperty<?>[] newChain = new StorableProperty[getChainCount() - 1]; System.arraycopy(mChain, 0, newChain, 0, newChain.length); boolean[] newOuterJoin = mOuterJoin; if (newOuterJoin != null && newOuterJoin.length > (newChain.length + 1)) { newOuterJoin = new boolean[newChain.length + 1]; System.arraycopy(mOuterJoin, 0, newOuterJoin, 0, newChain.length + 1); } return get(mPrime, newChain, newOuterJoin); }
java
public ChainedProperty<S> trim() { if (getChainCount() == 0) { throw new IllegalStateException(); } if (getChainCount() == 1) { if (!isOuterJoin(0)) { return get(mPrime); } else { return get(mPrime, null, new boolean[] {true}); } } StorableProperty<?>[] newChain = new StorableProperty[getChainCount() - 1]; System.arraycopy(mChain, 0, newChain, 0, newChain.length); boolean[] newOuterJoin = mOuterJoin; if (newOuterJoin != null && newOuterJoin.length > (newChain.length + 1)) { newOuterJoin = new boolean[newChain.length + 1]; System.arraycopy(mOuterJoin, 0, newOuterJoin, 0, newChain.length + 1); } return get(mPrime, newChain, newOuterJoin); }
[ "public", "ChainedProperty", "<", "S", ">", "trim", "(", ")", "{", "if", "(", "getChainCount", "(", ")", "==", "0", ")", "{", "throw", "new", "IllegalStateException", "(", ")", ";", "}", "if", "(", "getChainCount", "(", ")", "==", "1", ")", "{", "if", "(", "!", "isOuterJoin", "(", "0", ")", ")", "{", "return", "get", "(", "mPrime", ")", ";", "}", "else", "{", "return", "get", "(", "mPrime", ",", "null", ",", "new", "boolean", "[", "]", "{", "true", "}", ")", ";", "}", "}", "StorableProperty", "<", "?", ">", "[", "]", "newChain", "=", "new", "StorableProperty", "[", "getChainCount", "(", ")", "-", "1", "]", ";", "System", ".", "arraycopy", "(", "mChain", ",", "0", ",", "newChain", ",", "0", ",", "newChain", ".", "length", ")", ";", "boolean", "[", "]", "newOuterJoin", "=", "mOuterJoin", ";", "if", "(", "newOuterJoin", "!=", "null", "&&", "newOuterJoin", ".", "length", ">", "(", "newChain", ".", "length", "+", "1", ")", ")", "{", "newOuterJoin", "=", "new", "boolean", "[", "newChain", ".", "length", "+", "1", "]", ";", "System", ".", "arraycopy", "(", "mOuterJoin", ",", "0", ",", "newOuterJoin", ",", "0", ",", "newChain", ".", "length", "+", "1", ")", ";", "}", "return", "get", "(", "mPrime", ",", "newChain", ",", "newOuterJoin", ")", ";", "}" ]
Returns a new ChainedProperty with the last property in the chain removed. @throws IllegalStateException if chain count is zero
[ "Returns", "a", "new", "ChainedProperty", "with", "the", "last", "property", "in", "the", "chain", "removed", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/info/ChainedProperty.java#L410-L432
8,242
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/info/ChainedProperty.java
ChainedProperty.tail
public ChainedProperty<?> tail() { if (getChainCount() == 0) { throw new IllegalStateException(); } if (getChainCount() == 1) { if (!isOuterJoin(1)) { return get(mChain[0]); } else { return get(mChain[0], null, new boolean[] {true}); } } StorableProperty<?>[] newChain = new StorableProperty[getChainCount() - 1]; System.arraycopy(mChain, 1, newChain, 0, newChain.length); boolean[] newOuterJoin = mOuterJoin; if (newOuterJoin != null) { newOuterJoin = new boolean[newChain.length + 1]; System.arraycopy(mOuterJoin, 1, newOuterJoin, 0, mOuterJoin.length - 1); } return get(mChain[0], newChain, newOuterJoin); }
java
public ChainedProperty<?> tail() { if (getChainCount() == 0) { throw new IllegalStateException(); } if (getChainCount() == 1) { if (!isOuterJoin(1)) { return get(mChain[0]); } else { return get(mChain[0], null, new boolean[] {true}); } } StorableProperty<?>[] newChain = new StorableProperty[getChainCount() - 1]; System.arraycopy(mChain, 1, newChain, 0, newChain.length); boolean[] newOuterJoin = mOuterJoin; if (newOuterJoin != null) { newOuterJoin = new boolean[newChain.length + 1]; System.arraycopy(mOuterJoin, 1, newOuterJoin, 0, mOuterJoin.length - 1); } return get(mChain[0], newChain, newOuterJoin); }
[ "public", "ChainedProperty", "<", "?", ">", "tail", "(", ")", "{", "if", "(", "getChainCount", "(", ")", "==", "0", ")", "{", "throw", "new", "IllegalStateException", "(", ")", ";", "}", "if", "(", "getChainCount", "(", ")", "==", "1", ")", "{", "if", "(", "!", "isOuterJoin", "(", "1", ")", ")", "{", "return", "get", "(", "mChain", "[", "0", "]", ")", ";", "}", "else", "{", "return", "get", "(", "mChain", "[", "0", "]", ",", "null", ",", "new", "boolean", "[", "]", "{", "true", "}", ")", ";", "}", "}", "StorableProperty", "<", "?", ">", "[", "]", "newChain", "=", "new", "StorableProperty", "[", "getChainCount", "(", ")", "-", "1", "]", ";", "System", ".", "arraycopy", "(", "mChain", ",", "1", ",", "newChain", ",", "0", ",", "newChain", ".", "length", ")", ";", "boolean", "[", "]", "newOuterJoin", "=", "mOuterJoin", ";", "if", "(", "newOuterJoin", "!=", "null", ")", "{", "newOuterJoin", "=", "new", "boolean", "[", "newChain", ".", "length", "+", "1", "]", ";", "System", ".", "arraycopy", "(", "mOuterJoin", ",", "1", ",", "newOuterJoin", ",", "0", ",", "mOuterJoin", ".", "length", "-", "1", ")", ";", "}", "return", "get", "(", "mChain", "[", "0", "]", ",", "newChain", ",", "newOuterJoin", ")", ";", "}" ]
Returns a new ChainedProperty which contains everything that follows this ChainedProperty's prime property. @throws IllegalStateException if chain count is zero
[ "Returns", "a", "new", "ChainedProperty", "which", "contains", "everything", "that", "follows", "this", "ChainedProperty", "s", "prime", "property", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/info/ChainedProperty.java#L440-L462
8,243
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/info/ChainedProperty.java
ChainedProperty.identityEquals
private static boolean identityEquals(Object[] a, Object[] a2) { if (a == a2) { return true; } if (a == null || a2 == null) { return false; } int length = a.length; if (a2.length != length) { return false; } for (int i=0; i<length; i++) { if (a[i] != a2[i]) { return false; } } return true; }
java
private static boolean identityEquals(Object[] a, Object[] a2) { if (a == a2) { return true; } if (a == null || a2 == null) { return false; } int length = a.length; if (a2.length != length) { return false; } for (int i=0; i<length; i++) { if (a[i] != a2[i]) { return false; } } return true; }
[ "private", "static", "boolean", "identityEquals", "(", "Object", "[", "]", "a", ",", "Object", "[", "]", "a2", ")", "{", "if", "(", "a", "==", "a2", ")", "{", "return", "true", ";", "}", "if", "(", "a", "==", "null", "||", "a2", "==", "null", ")", "{", "return", "false", ";", "}", "int", "length", "=", "a", ".", "length", ";", "if", "(", "a2", ".", "length", "!=", "length", ")", "{", "return", "false", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "a", "[", "i", "]", "!=", "a2", "[", "i", "]", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Compares objects for equality using '==' operator instead of equals method.
[ "Compares", "objects", "for", "equality", "using", "==", "operator", "instead", "of", "equals", "method", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/info/ChainedProperty.java#L515-L535
8,244
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/info/ChainedProperty.java
ChainedProperty.appendTo
public void appendTo(Appendable app) throws IOException { appendPropTo(app, mPrime.getName(), isOuterJoin(0)); StorableProperty<?>[] chain = mChain; if (chain != null) { for (int i=0; i<chain.length; i++) { app.append('.'); appendPropTo(app, chain[i].getName(), isOuterJoin(i + 1)); } } }
java
public void appendTo(Appendable app) throws IOException { appendPropTo(app, mPrime.getName(), isOuterJoin(0)); StorableProperty<?>[] chain = mChain; if (chain != null) { for (int i=0; i<chain.length; i++) { app.append('.'); appendPropTo(app, chain[i].getName(), isOuterJoin(i + 1)); } } }
[ "public", "void", "appendTo", "(", "Appendable", "app", ")", "throws", "IOException", "{", "appendPropTo", "(", "app", ",", "mPrime", ".", "getName", "(", ")", ",", "isOuterJoin", "(", "0", ")", ")", ";", "StorableProperty", "<", "?", ">", "[", "]", "chain", "=", "mChain", ";", "if", "(", "chain", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "chain", ".", "length", ";", "i", "++", ")", "{", "app", ".", "append", "(", "'", "'", ")", ";", "appendPropTo", "(", "app", ",", "chain", "[", "i", "]", ".", "getName", "(", ")", ",", "isOuterJoin", "(", "i", "+", "1", ")", ")", ";", "}", "}", "}" ]
Appends the chained property formatted as "name.subname.subsubname". This format is parseable only if the chain is composed of valid many-to-one joins.
[ "Appends", "the", "chained", "property", "formatted", "as", "name", ".", "subname", ".", "subsubname", ".", "This", "format", "is", "parseable", "only", "if", "the", "chain", "is", "composed", "of", "valid", "many", "-", "to", "-", "one", "joins", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/info/ChainedProperty.java#L561-L570
8,245
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java
BDBRepositoryBuilder.verify
public boolean verify(PrintStream out) throws RepositoryException { final StorableCodecFactory codecFactory = mStorableCodecFactory; final String name = mName; final boolean readOnly = mReadOnly; final boolean runCheckpointer = mRunCheckpointer; final boolean runDeadlockDetector = mRunDeadlockDetector; final boolean lockConflictDeadlockDetect = mLockConflictDeadlockDetect; final boolean isPrivate = mPrivate; if (mName == null) { // Allow a dummy name for verification. mName = "BDB verification"; } if (mStorableCodecFactory == null) { mStorableCodecFactory = new CompressedStorableCodecFactory(mCompressionMap); } mReadOnly = true; mRunCheckpointer = false; mRunDeadlockDetector = false; mLockConflictDeadlockDetect = false; try { assertReady(); File homeFile = getEnvironmentHomeFile(); if (!homeFile.exists()) { throw new RepositoryException ("Environment home directory does not exist: " + homeFile); } AtomicReference<Repository> rootRef = new AtomicReference<Repository>(); BDBRepository repo; try { repo = getRepositoryConstructor().newInstance(rootRef, this); } catch (Exception e) { ThrowUnchecked.fireFirstDeclaredCause(e, RepositoryException.class); // Not reached. return false; } rootRef.set(repo); try { return repo.verify(out); } catch (Exception e) { throw repo.toRepositoryException(e); } finally { repo.close(); } } finally { mName = name; mStorableCodecFactory = codecFactory; mReadOnly = readOnly; mRunCheckpointer = runCheckpointer; mRunDeadlockDetector = runDeadlockDetector; mLockConflictDeadlockDetect = lockConflictDeadlockDetect; } }
java
public boolean verify(PrintStream out) throws RepositoryException { final StorableCodecFactory codecFactory = mStorableCodecFactory; final String name = mName; final boolean readOnly = mReadOnly; final boolean runCheckpointer = mRunCheckpointer; final boolean runDeadlockDetector = mRunDeadlockDetector; final boolean lockConflictDeadlockDetect = mLockConflictDeadlockDetect; final boolean isPrivate = mPrivate; if (mName == null) { // Allow a dummy name for verification. mName = "BDB verification"; } if (mStorableCodecFactory == null) { mStorableCodecFactory = new CompressedStorableCodecFactory(mCompressionMap); } mReadOnly = true; mRunCheckpointer = false; mRunDeadlockDetector = false; mLockConflictDeadlockDetect = false; try { assertReady(); File homeFile = getEnvironmentHomeFile(); if (!homeFile.exists()) { throw new RepositoryException ("Environment home directory does not exist: " + homeFile); } AtomicReference<Repository> rootRef = new AtomicReference<Repository>(); BDBRepository repo; try { repo = getRepositoryConstructor().newInstance(rootRef, this); } catch (Exception e) { ThrowUnchecked.fireFirstDeclaredCause(e, RepositoryException.class); // Not reached. return false; } rootRef.set(repo); try { return repo.verify(out); } catch (Exception e) { throw repo.toRepositoryException(e); } finally { repo.close(); } } finally { mName = name; mStorableCodecFactory = codecFactory; mReadOnly = readOnly; mRunCheckpointer = runCheckpointer; mRunDeadlockDetector = runDeadlockDetector; mLockConflictDeadlockDetect = lockConflictDeadlockDetect; } }
[ "public", "boolean", "verify", "(", "PrintStream", "out", ")", "throws", "RepositoryException", "{", "final", "StorableCodecFactory", "codecFactory", "=", "mStorableCodecFactory", ";", "final", "String", "name", "=", "mName", ";", "final", "boolean", "readOnly", "=", "mReadOnly", ";", "final", "boolean", "runCheckpointer", "=", "mRunCheckpointer", ";", "final", "boolean", "runDeadlockDetector", "=", "mRunDeadlockDetector", ";", "final", "boolean", "lockConflictDeadlockDetect", "=", "mLockConflictDeadlockDetect", ";", "final", "boolean", "isPrivate", "=", "mPrivate", ";", "if", "(", "mName", "==", "null", ")", "{", "// Allow a dummy name for verification.", "mName", "=", "\"BDB verification\"", ";", "}", "if", "(", "mStorableCodecFactory", "==", "null", ")", "{", "mStorableCodecFactory", "=", "new", "CompressedStorableCodecFactory", "(", "mCompressionMap", ")", ";", "}", "mReadOnly", "=", "true", ";", "mRunCheckpointer", "=", "false", ";", "mRunDeadlockDetector", "=", "false", ";", "mLockConflictDeadlockDetect", "=", "false", ";", "try", "{", "assertReady", "(", ")", ";", "File", "homeFile", "=", "getEnvironmentHomeFile", "(", ")", ";", "if", "(", "!", "homeFile", ".", "exists", "(", ")", ")", "{", "throw", "new", "RepositoryException", "(", "\"Environment home directory does not exist: \"", "+", "homeFile", ")", ";", "}", "AtomicReference", "<", "Repository", ">", "rootRef", "=", "new", "AtomicReference", "<", "Repository", ">", "(", ")", ";", "BDBRepository", "repo", ";", "try", "{", "repo", "=", "getRepositoryConstructor", "(", ")", ".", "newInstance", "(", "rootRef", ",", "this", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "ThrowUnchecked", ".", "fireFirstDeclaredCause", "(", "e", ",", "RepositoryException", ".", "class", ")", ";", "// Not reached.", "return", "false", ";", "}", "rootRef", ".", "set", "(", "repo", ")", ";", "try", "{", "return", "repo", ".", "verify", "(", "out", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "repo", ".", "toRepositoryException", "(", "e", ")", ";", "}", "finally", "{", "repo", ".", "close", "(", ")", ";", "}", "}", "finally", "{", "mName", "=", "name", ";", "mStorableCodecFactory", "=", "codecFactory", ";", "mReadOnly", "=", "readOnly", ";", "mRunCheckpointer", "=", "runCheckpointer", ";", "mRunDeadlockDetector", "=", "runDeadlockDetector", ";", "mLockConflictDeadlockDetect", "=", "lockConflictDeadlockDetect", ";", "}", "}" ]
Opens the BDB environment, checks if it is corrupt, and then closes it. Only one process should open the environment for verification. Expect it to take a long time. @param out optional stream to capture any verfication errors @return true if environment passes verification
[ "Opens", "the", "BDB", "environment", "checks", "if", "it", "is", "corrupt", "and", "then", "closes", "it", ".", "Only", "one", "process", "should", "open", "the", "environment", "for", "verification", ".", "Expect", "it", "to", "take", "a", "long", "time", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java#L189-L249
8,246
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java
BDBRepositoryBuilder.setProduct
public void setProduct(String product) { mProduct = product == null ? DEFAULT_PRODUCT : BDBProduct.forString(product); }
java
public void setProduct(String product) { mProduct = product == null ? DEFAULT_PRODUCT : BDBProduct.forString(product); }
[ "public", "void", "setProduct", "(", "String", "product", ")", "{", "mProduct", "=", "product", "==", "null", "?", "DEFAULT_PRODUCT", ":", "BDBProduct", ".", "forString", "(", "product", ")", ";", "}" ]
Sets the BDB product to use, which defaults to JE. Also supported is DB and DB_HA. If not supported, an IllegalArgumentException is thrown.
[ "Sets", "the", "BDB", "product", "to", "use", "which", "defaults", "to", "JE", ".", "Also", "supported", "is", "DB", "and", "DB_HA", ".", "If", "not", "supported", "an", "IllegalArgumentException", "is", "thrown", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java#L271-L273
8,247
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java
BDBRepositoryBuilder.setEnvironmentHomeFile
public void setEnvironmentHomeFile(File envHome) { try { // Switch to canonical for more detailed error messages. envHome = envHome.getCanonicalFile(); } catch (IOException e) { } mEnvHome = envHome; }
java
public void setEnvironmentHomeFile(File envHome) { try { // Switch to canonical for more detailed error messages. envHome = envHome.getCanonicalFile(); } catch (IOException e) { } mEnvHome = envHome; }
[ "public", "void", "setEnvironmentHomeFile", "(", "File", "envHome", ")", "{", "try", "{", "// Switch to canonical for more detailed error messages.", "envHome", "=", "envHome", ".", "getCanonicalFile", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "}", "mEnvHome", "=", "envHome", ";", "}" ]
Sets the repository environment home directory, which is required.
[ "Sets", "the", "repository", "environment", "home", "directory", "which", "is", "required", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java#L299-L306
8,248
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java
BDBRepositoryBuilder.setFileName
public void setFileName(String filename, String typeName) { mSingleFileName = null; if (mFileNames == null) { mFileNames = new HashMap<String, String>(); } mFileNames.put(typeName, filename); }
java
public void setFileName(String filename, String typeName) { mSingleFileName = null; if (mFileNames == null) { mFileNames = new HashMap<String, String>(); } mFileNames.put(typeName, filename); }
[ "public", "void", "setFileName", "(", "String", "filename", ",", "String", "typeName", ")", "{", "mSingleFileName", "=", "null", ";", "if", "(", "mFileNames", "==", "null", ")", "{", "mFileNames", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "}", "mFileNames", ".", "put", "(", "typeName", ",", "filename", ")", ";", "}" ]
Specify the file that a BDB database should reside in, except for log files and caches. The filename is relative to the environment home, unless data directories have been specified. For BDBRepositories that are log files only, this configuration is ignored. @param filename BDB database filename @param typeName type to store in file; if null, the file is used by default for all types
[ "Specify", "the", "file", "that", "a", "BDB", "database", "should", "reside", "in", "except", "for", "log", "files", "and", "caches", ".", "The", "filename", "is", "relative", "to", "the", "environment", "home", "unless", "data", "directories", "have", "been", "specified", ".", "For", "BDBRepositories", "that", "are", "log", "files", "only", "this", "configuration", "is", "ignored", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java#L412-L418
8,249
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java
BDBRepositoryBuilder.setDatabasePageSize
public void setDatabasePageSize(Integer bytes, Class<? extends Storable> type) { if (mDatabasePageSizes == null) { mDatabasePageSizes = new HashMap<Class<?>, Integer>(); } mDatabasePageSizes.put(type, bytes); }
java
public void setDatabasePageSize(Integer bytes, Class<? extends Storable> type) { if (mDatabasePageSizes == null) { mDatabasePageSizes = new HashMap<Class<?>, Integer>(); } mDatabasePageSizes.put(type, bytes); }
[ "public", "void", "setDatabasePageSize", "(", "Integer", "bytes", ",", "Class", "<", "?", "extends", "Storable", ">", "type", ")", "{", "if", "(", "mDatabasePageSizes", "==", "null", ")", "{", "mDatabasePageSizes", "=", "new", "HashMap", "<", "Class", "<", "?", ">", ",", "Integer", ">", "(", ")", ";", "}", "mDatabasePageSizes", ".", "put", "(", "type", ",", "bytes", ")", ";", "}" ]
Sets the desired page size for a given type. If not specified, the page size applies to all types.
[ "Sets", "the", "desired", "page", "size", "for", "a", "given", "type", ".", "If", "not", "specified", "the", "page", "size", "applies", "to", "all", "types", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java#L713-L718
8,250
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java
BDBRepositoryBuilder.setCompressor
public void setCompressor(String type, String compressionType) { mStorableCodecFactory = null; compressionType = compressionType.toUpperCase(); if (mCompressionMap == null) { mCompressionMap = new HashMap<String, CompressionType>(); } CompressionType compressionEnum = CompressionType.valueOf(compressionType); if (compressionEnum != null) { mCompressionMap.put(type, compressionEnum); } }
java
public void setCompressor(String type, String compressionType) { mStorableCodecFactory = null; compressionType = compressionType.toUpperCase(); if (mCompressionMap == null) { mCompressionMap = new HashMap<String, CompressionType>(); } CompressionType compressionEnum = CompressionType.valueOf(compressionType); if (compressionEnum != null) { mCompressionMap.put(type, compressionEnum); } }
[ "public", "void", "setCompressor", "(", "String", "type", ",", "String", "compressionType", ")", "{", "mStorableCodecFactory", "=", "null", ";", "compressionType", "=", "compressionType", ".", "toUpperCase", "(", ")", ";", "if", "(", "mCompressionMap", "==", "null", ")", "{", "mCompressionMap", "=", "new", "HashMap", "<", "String", ",", "CompressionType", ">", "(", ")", ";", "}", "CompressionType", "compressionEnum", "=", "CompressionType", ".", "valueOf", "(", "compressionType", ")", ";", "if", "(", "compressionEnum", "!=", "null", ")", "{", "mCompressionMap", ".", "put", "(", "type", ",", "compressionEnum", ")", ";", "}", "}" ]
Set the compressor for the given class, overriding a custom StorableCodecFactory. @param type Storable to compress. @param compressionType String representation of type of compression. Available options are "NONE" for no compression or "GZIP" for gzip compression
[ "Set", "the", "compressor", "for", "the", "given", "class", "overriding", "a", "custom", "StorableCodecFactory", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java#L1061-L1071
8,251
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java
BDBRepositoryBuilder.getCompressor
public String getCompressor(String type) { if (mCompressionMap == null) { return null; } return mCompressionMap.get(type).toString(); }
java
public String getCompressor(String type) { if (mCompressionMap == null) { return null; } return mCompressionMap.get(type).toString(); }
[ "public", "String", "getCompressor", "(", "String", "type", ")", "{", "if", "(", "mCompressionMap", "==", "null", ")", "{", "return", "null", ";", "}", "return", "mCompressionMap", ".", "get", "(", "type", ")", ".", "toString", "(", ")", ";", "}" ]
Return the compressor used for the given storable. @param type Storable to compress @return String representation of the type of compression used. Available options are "NONE" for no compression and "GZIP" for gzip compression.
[ "Return", "the", "compressor", "used", "for", "the", "given", "storable", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java#L1079-L1085
8,252
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java
BDBRepositoryBuilder.getRepositoryConstructor
@SuppressWarnings("unchecked") private Constructor<BDBRepository> getRepositoryConstructor() throws ClassCastException, ClassNotFoundException, NoSuchMethodException { String packageName; { String thisClassName = getClass().getName(); packageName = thisClassName.substring(0, thisClassName.lastIndexOf('.')); } String className = packageName + '.' + getBDBProduct().name() + "_Repository"; Class repoClass = Class.forName(className); if (BDBRepository.class.isAssignableFrom(repoClass)) { return repoClass.getDeclaredConstructor (AtomicReference.class, BDBRepositoryBuilder.class); } throw new ClassCastException("Not an instance of BDBRepository: " + repoClass.getName()); }
java
@SuppressWarnings("unchecked") private Constructor<BDBRepository> getRepositoryConstructor() throws ClassCastException, ClassNotFoundException, NoSuchMethodException { String packageName; { String thisClassName = getClass().getName(); packageName = thisClassName.substring(0, thisClassName.lastIndexOf('.')); } String className = packageName + '.' + getBDBProduct().name() + "_Repository"; Class repoClass = Class.forName(className); if (BDBRepository.class.isAssignableFrom(repoClass)) { return repoClass.getDeclaredConstructor (AtomicReference.class, BDBRepositoryBuilder.class); } throw new ClassCastException("Not an instance of BDBRepository: " + repoClass.getName()); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "Constructor", "<", "BDBRepository", ">", "getRepositoryConstructor", "(", ")", "throws", "ClassCastException", ",", "ClassNotFoundException", ",", "NoSuchMethodException", "{", "String", "packageName", ";", "{", "String", "thisClassName", "=", "getClass", "(", ")", ".", "getName", "(", ")", ";", "packageName", "=", "thisClassName", ".", "substring", "(", "0", ",", "thisClassName", ".", "lastIndexOf", "(", "'", "'", ")", ")", ";", "}", "String", "className", "=", "packageName", "+", "'", "'", "+", "getBDBProduct", "(", ")", ".", "name", "(", ")", "+", "\"_Repository\"", ";", "Class", "repoClass", "=", "Class", ".", "forName", "(", "className", ")", ";", "if", "(", "BDBRepository", ".", "class", ".", "isAssignableFrom", "(", "repoClass", ")", ")", "{", "return", "repoClass", ".", "getDeclaredConstructor", "(", "AtomicReference", ".", "class", ",", "BDBRepositoryBuilder", ".", "class", ")", ";", "}", "throw", "new", "ClassCastException", "(", "\"Not an instance of BDBRepository: \"", "+", "repoClass", ".", "getName", "(", ")", ")", ";", "}" ]
Looks up appropriate repository via reflection, whose name is derived from the BDB product string.
[ "Looks", "up", "appropriate", "repository", "via", "reflection", "whose", "name", "is", "derived", "from", "the", "BDB", "product", "string", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/repo/sleepycat/BDBRepositoryBuilder.java#L1148-L1164
8,253
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/qe/OrderingScore.java
OrderingScore.canMergeRemainderOrdering
public boolean canMergeRemainderOrdering(OrderingScore<S> other) { if (this == other || (getHandledCount() == 0 && other.getHandledCount() == 0)) { return true; } if (isIndexClustered() == other.isIndexClustered() && getIndexPropertyCount() == other.getIndexPropertyCount() && shouldReverseOrder() == other.shouldReverseOrder() && getHandledOrdering().equals(other.getHandledOrdering())) { // The remainder orderings cannot conflict. OrderingList<S> thisRemainderOrdering = getRemainderOrdering(); OrderingList<S> otherRemainderOrdering = other.getRemainderOrdering(); int size = Math.min(thisRemainderOrdering.size(), otherRemainderOrdering.size()); for (int i=0; i<size; i++) { if (!thisRemainderOrdering.get(i).equals(otherRemainderOrdering.get(i))) { return false; } } return true; } return false; }
java
public boolean canMergeRemainderOrdering(OrderingScore<S> other) { if (this == other || (getHandledCount() == 0 && other.getHandledCount() == 0)) { return true; } if (isIndexClustered() == other.isIndexClustered() && getIndexPropertyCount() == other.getIndexPropertyCount() && shouldReverseOrder() == other.shouldReverseOrder() && getHandledOrdering().equals(other.getHandledOrdering())) { // The remainder orderings cannot conflict. OrderingList<S> thisRemainderOrdering = getRemainderOrdering(); OrderingList<S> otherRemainderOrdering = other.getRemainderOrdering(); int size = Math.min(thisRemainderOrdering.size(), otherRemainderOrdering.size()); for (int i=0; i<size; i++) { if (!thisRemainderOrdering.get(i).equals(otherRemainderOrdering.get(i))) { return false; } } return true; } return false; }
[ "public", "boolean", "canMergeRemainderOrdering", "(", "OrderingScore", "<", "S", ">", "other", ")", "{", "if", "(", "this", "==", "other", "||", "(", "getHandledCount", "(", ")", "==", "0", "&&", "other", ".", "getHandledCount", "(", ")", "==", "0", ")", ")", "{", "return", "true", ";", "}", "if", "(", "isIndexClustered", "(", ")", "==", "other", ".", "isIndexClustered", "(", ")", "&&", "getIndexPropertyCount", "(", ")", "==", "other", ".", "getIndexPropertyCount", "(", ")", "&&", "shouldReverseOrder", "(", ")", "==", "other", ".", "shouldReverseOrder", "(", ")", "&&", "getHandledOrdering", "(", ")", ".", "equals", "(", "other", ".", "getHandledOrdering", "(", ")", ")", ")", "{", "// The remainder orderings cannot conflict.\r", "OrderingList", "<", "S", ">", "thisRemainderOrdering", "=", "getRemainderOrdering", "(", ")", ";", "OrderingList", "<", "S", ">", "otherRemainderOrdering", "=", "other", ".", "getRemainderOrdering", "(", ")", ";", "int", "size", "=", "Math", ".", "min", "(", "thisRemainderOrdering", ".", "size", "(", ")", ",", "otherRemainderOrdering", ".", "size", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "if", "(", "!", "thisRemainderOrdering", ".", "get", "(", "i", ")", ".", "equals", "(", "otherRemainderOrdering", ".", "get", "(", "i", ")", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}", "return", "false", ";", "}" ]
Returns true if the given score uses an index exactly the same as this one. The only allowed differences are in the count of remainder orderings.
[ "Returns", "true", "if", "the", "given", "score", "uses", "an", "index", "exactly", "the", "same", "as", "this", "one", ".", "The", "only", "allowed", "differences", "are", "in", "the", "count", "of", "remainder", "orderings", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/qe/OrderingScore.java#L421-L446
8,254
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/qe/OrderingScore.java
OrderingScore.mergeRemainderOrdering
public OrderingList<S> mergeRemainderOrdering(OrderingScore<S> other) { OrderingList<S> thisRemainderOrdering = getRemainderOrdering(); if (this == other) { return thisRemainderOrdering; } OrderingList<S> otherRemainderOrdering = other.getRemainderOrdering(); // Choose the longer list. if (thisRemainderOrdering.size() == 0) { return otherRemainderOrdering; } else { if (otherRemainderOrdering.size() == 0) { return thisRemainderOrdering; } else if (thisRemainderOrdering.size() >= otherRemainderOrdering.size()) { return thisRemainderOrdering; } else { return otherRemainderOrdering; } } }
java
public OrderingList<S> mergeRemainderOrdering(OrderingScore<S> other) { OrderingList<S> thisRemainderOrdering = getRemainderOrdering(); if (this == other) { return thisRemainderOrdering; } OrderingList<S> otherRemainderOrdering = other.getRemainderOrdering(); // Choose the longer list. if (thisRemainderOrdering.size() == 0) { return otherRemainderOrdering; } else { if (otherRemainderOrdering.size() == 0) { return thisRemainderOrdering; } else if (thisRemainderOrdering.size() >= otherRemainderOrdering.size()) { return thisRemainderOrdering; } else { return otherRemainderOrdering; } } }
[ "public", "OrderingList", "<", "S", ">", "mergeRemainderOrdering", "(", "OrderingScore", "<", "S", ">", "other", ")", "{", "OrderingList", "<", "S", ">", "thisRemainderOrdering", "=", "getRemainderOrdering", "(", ")", ";", "if", "(", "this", "==", "other", ")", "{", "return", "thisRemainderOrdering", ";", "}", "OrderingList", "<", "S", ">", "otherRemainderOrdering", "=", "other", ".", "getRemainderOrdering", "(", ")", ";", "// Choose the longer list.\r", "if", "(", "thisRemainderOrdering", ".", "size", "(", ")", "==", "0", ")", "{", "return", "otherRemainderOrdering", ";", "}", "else", "{", "if", "(", "otherRemainderOrdering", ".", "size", "(", ")", "==", "0", ")", "{", "return", "thisRemainderOrdering", ";", "}", "else", "if", "(", "thisRemainderOrdering", ".", "size", "(", ")", ">=", "otherRemainderOrdering", ".", "size", "(", ")", ")", "{", "return", "thisRemainderOrdering", ";", "}", "else", "{", "return", "otherRemainderOrdering", ";", "}", "}", "}" ]
Merges the remainder orderings of this score with the one given. Call canMergeRemainderOrdering first to verify if the merge makes any sense.
[ "Merges", "the", "remainder", "orderings", "of", "this", "score", "with", "the", "one", "given", ".", "Call", "canMergeRemainderOrdering", "first", "to", "verify", "if", "the", "merge", "makes", "any", "sense", "." ]
eee29b365a61c8f03e1a1dc6bed0692e6b04b1db
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/qe/OrderingScore.java#L452-L474
8,255
tomgibara/bits
src/main/java/com/tomgibara/bits/ByteBasedBitWriter.java
ByteBasedBitWriter.fillBytes
protected void fillBytes(int value, long count) throws BitStreamException { // if it's short, write bytes directly if (count < PAD_LIMIT) { for (int i = 0; i < count; i++) writeByte(value); return; } // obtain an array we can use to write the bytes efficiently byte b = (byte) value; byte[] buffer = getBuffer(b); int len; if (buffer == null) { //TODO should all buffers be cached? len = count > PAD_BUFFER ? PAD_BUFFER : (int) count; buffer = new byte[len]; Arrays.fill(buffer, b); } else { len = PAD_BUFFER; } // if we can, just do it with a single buffer if (count <= len) { writeBytes(buffer, 0, (int) count); return; } // write the buffer as many times as we need to long limit = count / len; for (long i = 0; i < limit; i++) { writeBytes(buffer, 0, len); } int r = (int) (count - limit * len); if (r != 0) writeBytes(buffer, 0, r); }
java
protected void fillBytes(int value, long count) throws BitStreamException { // if it's short, write bytes directly if (count < PAD_LIMIT) { for (int i = 0; i < count; i++) writeByte(value); return; } // obtain an array we can use to write the bytes efficiently byte b = (byte) value; byte[] buffer = getBuffer(b); int len; if (buffer == null) { //TODO should all buffers be cached? len = count > PAD_BUFFER ? PAD_BUFFER : (int) count; buffer = new byte[len]; Arrays.fill(buffer, b); } else { len = PAD_BUFFER; } // if we can, just do it with a single buffer if (count <= len) { writeBytes(buffer, 0, (int) count); return; } // write the buffer as many times as we need to long limit = count / len; for (long i = 0; i < limit; i++) { writeBytes(buffer, 0, len); } int r = (int) (count - limit * len); if (r != 0) writeBytes(buffer, 0, r); }
[ "protected", "void", "fillBytes", "(", "int", "value", ",", "long", "count", ")", "throws", "BitStreamException", "{", "// if it's short, write bytes directly", "if", "(", "count", "<", "PAD_LIMIT", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "writeByte", "(", "value", ")", ";", "return", ";", "}", "// obtain an array we can use to write the bytes efficiently", "byte", "b", "=", "(", "byte", ")", "value", ";", "byte", "[", "]", "buffer", "=", "getBuffer", "(", "b", ")", ";", "int", "len", ";", "if", "(", "buffer", "==", "null", ")", "{", "//TODO should all buffers be cached?", "len", "=", "count", ">", "PAD_BUFFER", "?", "PAD_BUFFER", ":", "(", "int", ")", "count", ";", "buffer", "=", "new", "byte", "[", "len", "]", ";", "Arrays", ".", "fill", "(", "buffer", ",", "b", ")", ";", "}", "else", "{", "len", "=", "PAD_BUFFER", ";", "}", "// if we can, just do it with a single buffer", "if", "(", "count", "<=", "len", ")", "{", "writeBytes", "(", "buffer", ",", "0", ",", "(", "int", ")", "count", ")", ";", "return", ";", "}", "// write the buffer as many times as we need to", "long", "limit", "=", "count", "/", "len", ";", "for", "(", "long", "i", "=", "0", ";", "i", "<", "limit", ";", "i", "++", ")", "{", "writeBytes", "(", "buffer", ",", "0", ",", "len", ")", ";", "}", "int", "r", "=", "(", "int", ")", "(", "count", "-", "limit", "*", "len", ")", ";", "if", "(", "r", "!=", "0", ")", "writeBytes", "(", "buffer", ",", "0", ",", "r", ")", ";", "}" ]
Writes a single value repeatedly into the sequence. @param value the value to be written @param count the number of bytes to write @throws BitStreamException if an exception occurs when writing
[ "Writes", "a", "single", "value", "repeatedly", "into", "the", "sequence", "." ]
56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97
https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/ByteBasedBitWriter.java#L91-L124
8,256
e-biz/spring-dbunit
spring-dbunit-core/src/main/java/com/excilys/ebi/spring/dbunit/DefaultDataLoader.java
DefaultDataLoader.executeOperation
private void executeOperation(DbUnitDatabasePopulator populator, DataSource dataSource) throws Exception { Connection connection = null; try { connection = getConnection(dataSource); populator.populate(connection); } finally { if (connection != null && !isConnectionTransactional(connection, dataSource)) { // if the connection is transactional, closing it. Otherwise, // expects that the framework will do it releaseConnection(connection, dataSource); } } }
java
private void executeOperation(DbUnitDatabasePopulator populator, DataSource dataSource) throws Exception { Connection connection = null; try { connection = getConnection(dataSource); populator.populate(connection); } finally { if (connection != null && !isConnectionTransactional(connection, dataSource)) { // if the connection is transactional, closing it. Otherwise, // expects that the framework will do it releaseConnection(connection, dataSource); } } }
[ "private", "void", "executeOperation", "(", "DbUnitDatabasePopulator", "populator", ",", "DataSource", "dataSource", ")", "throws", "Exception", "{", "Connection", "connection", "=", "null", ";", "try", "{", "connection", "=", "getConnection", "(", "dataSource", ")", ";", "populator", ".", "populate", "(", "connection", ")", ";", "}", "finally", "{", "if", "(", "connection", "!=", "null", "&&", "!", "isConnectionTransactional", "(", "connection", ",", "dataSource", ")", ")", "{", "// if the connection is transactional, closing it. Otherwise,", "// expects that the framework will do it", "releaseConnection", "(", "connection", ",", "dataSource", ")", ";", "}", "}", "}" ]
Execute a DBUbit operation
[ "Execute", "a", "DBUbit", "operation" ]
1ec51222ecdd5dbd6daa4bd6879c6eabe76dfb6b
https://github.com/e-biz/spring-dbunit/blob/1ec51222ecdd5dbd6daa4bd6879c6eabe76dfb6b/spring-dbunit-core/src/main/java/com/excilys/ebi/spring/dbunit/DefaultDataLoader.java#L52-L67
8,257
tomgibara/bits
src/main/java/com/tomgibara/bits/BitVector.java
BitVector.range
@Override public BitVector range(int from, int to) { if (from < 0) throw new IllegalArgumentException(); if (to < from) throw new IllegalArgumentException(); from += start; to += start; if (to > finish) throw new IllegalArgumentException(); return new BitVector(from, to, bits, mutable); }
java
@Override public BitVector range(int from, int to) { if (from < 0) throw new IllegalArgumentException(); if (to < from) throw new IllegalArgumentException(); from += start; to += start; if (to > finish) throw new IllegalArgumentException(); return new BitVector(from, to, bits, mutable); }
[ "@", "Override", "public", "BitVector", "range", "(", "int", "from", ",", "int", "to", ")", "{", "if", "(", "from", "<", "0", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "if", "(", "to", "<", "from", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "from", "+=", "start", ";", "to", "+=", "start", ";", "if", "(", "to", ">", "finish", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "return", "new", "BitVector", "(", "from", ",", "to", ",", "bits", ",", "mutable", ")", ";", "}" ]
bypasses duplicate for efficiency
[ "bypasses", "duplicate", "for", "efficiency" ]
56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97
https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/BitVector.java#L697-L705
8,258
tomgibara/bits
src/main/java/com/tomgibara/bits/BitVector.java
BitVector.perform
private void perform(int operation, int position, long bs, int length) { checkBitsLength(length); position = adjPosition(position); checkMutable(); performAdj(operation, position, bs, length); }
java
private void perform(int operation, int position, long bs, int length) { checkBitsLength(length); position = adjPosition(position); checkMutable(); performAdj(operation, position, bs, length); }
[ "private", "void", "perform", "(", "int", "operation", ",", "int", "position", ",", "long", "bs", ",", "int", "length", ")", "{", "checkBitsLength", "(", "length", ")", ";", "position", "=", "adjPosition", "(", "position", ")", ";", "checkMutable", "(", ")", ";", "performAdj", "(", "operation", ",", "position", ",", "bs", ",", "length", ")", ";", "}" ]
assumes address size is size of long
[ "assumes", "address", "size", "is", "size", "of", "long" ]
56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97
https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/BitVector.java#L1276-L1281
8,259
tomgibara/bits
src/main/java/com/tomgibara/bits/BitVector.java
BitVector.setBitsImpl
private void setBitsImpl(int position, long value, int length) { int i = position >> ADDRESS_BITS; int s = position & ADDRESS_MASK; long m = length == ADDRESS_SIZE ? -1L : (1L << length) - 1L; long v = value & m; performAdjSet(length, i, s, m, v); }
java
private void setBitsImpl(int position, long value, int length) { int i = position >> ADDRESS_BITS; int s = position & ADDRESS_MASK; long m = length == ADDRESS_SIZE ? -1L : (1L << length) - 1L; long v = value & m; performAdjSet(length, i, s, m, v); }
[ "private", "void", "setBitsImpl", "(", "int", "position", ",", "long", "value", ",", "int", "length", ")", "{", "int", "i", "=", "position", ">>", "ADDRESS_BITS", ";", "int", "s", "=", "position", "&", "ADDRESS_MASK", ";", "long", "m", "=", "length", "==", "ADDRESS_SIZE", "?", "-", "1L", ":", "(", "1L", "<<", "length", ")", "-", "1L", ";", "long", "v", "=", "value", "&", "m", ";", "performAdjSet", "(", "length", ",", "i", ",", "s", ",", "m", ",", "v", ")", ";", "}" ]
length guaranteed to be non-zero
[ "length", "guaranteed", "to", "be", "non", "-", "zero" ]
56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97
https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/BitVector.java#L1554-L1560
8,260
tomgibara/bits
src/main/java/com/tomgibara/bits/BitVector.java
BitVector.performSetAdj
private void performSetAdj(int position, boolean value) { checkMutable(); final int i = position >> ADDRESS_BITS; final long m = 1L << (position & ADDRESS_MASK); if (value) { bits[i] |= m; } else { bits[i] &= ~m; } }
java
private void performSetAdj(int position, boolean value) { checkMutable(); final int i = position >> ADDRESS_BITS; final long m = 1L << (position & ADDRESS_MASK); if (value) { bits[i] |= m; } else { bits[i] &= ~m; } }
[ "private", "void", "performSetAdj", "(", "int", "position", ",", "boolean", "value", ")", "{", "checkMutable", "(", ")", ";", "final", "int", "i", "=", "position", ">>", "ADDRESS_BITS", ";", "final", "long", "m", "=", "1L", "<<", "(", "position", "&", "ADDRESS_MASK", ")", ";", "if", "(", "value", ")", "{", "bits", "[", "i", "]", "|=", "m", ";", "}", "else", "{", "bits", "[", "i", "]", "&=", "~", "m", ";", "}", "}" ]
specialized implementation for the common case of setting an individual bit
[ "specialized", "implementation", "for", "the", "common", "case", "of", "setting", "an", "individual", "bit" ]
56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97
https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/BitVector.java#L1741-L1750
8,261
tomgibara/bits
src/main/java/com/tomgibara/bits/BitVector.java
BitVector.getThenPerformAdj
private boolean getThenPerformAdj(int operation, int position, boolean value) { checkMutable(); final int i = position >> ADDRESS_BITS; final long m = 1L << (position & ADDRESS_MASK); final long v = bits[i] & m; switch(operation) { case SET : if (value) { bits[i] |= m; } else { bits[i] &= ~m; } break; case AND : if (value) { /* no-op */ } else { bits[i] &= ~m; } break; case OR : if (value) { bits[i] |= m; } else { /* no-op */ } break; case XOR : if (value) { bits[i] ^= m; } else { /* no-op */ } break; } return v != 0; }
java
private boolean getThenPerformAdj(int operation, int position, boolean value) { checkMutable(); final int i = position >> ADDRESS_BITS; final long m = 1L << (position & ADDRESS_MASK); final long v = bits[i] & m; switch(operation) { case SET : if (value) { bits[i] |= m; } else { bits[i] &= ~m; } break; case AND : if (value) { /* no-op */ } else { bits[i] &= ~m; } break; case OR : if (value) { bits[i] |= m; } else { /* no-op */ } break; case XOR : if (value) { bits[i] ^= m; } else { /* no-op */ } break; } return v != 0; }
[ "private", "boolean", "getThenPerformAdj", "(", "int", "operation", ",", "int", "position", ",", "boolean", "value", ")", "{", "checkMutable", "(", ")", ";", "final", "int", "i", "=", "position", ">>", "ADDRESS_BITS", ";", "final", "long", "m", "=", "1L", "<<", "(", "position", "&", "ADDRESS_MASK", ")", ";", "final", "long", "v", "=", "bits", "[", "i", "]", "&", "m", ";", "switch", "(", "operation", ")", "{", "case", "SET", ":", "if", "(", "value", ")", "{", "bits", "[", "i", "]", "|=", "m", ";", "}", "else", "{", "bits", "[", "i", "]", "&=", "~", "m", ";", "}", "break", ";", "case", "AND", ":", "if", "(", "value", ")", "{", "/* no-op */", "}", "else", "{", "bits", "[", "i", "]", "&=", "~", "m", ";", "}", "break", ";", "case", "OR", ":", "if", "(", "value", ")", "{", "bits", "[", "i", "]", "|=", "m", ";", "}", "else", "{", "/* no-op */", "}", "break", ";", "case", "XOR", ":", "if", "(", "value", ")", "{", "bits", "[", "i", "]", "^=", "m", ";", "}", "else", "{", "/* no-op */", "}", "break", ";", "}", "return", "v", "!=", "0", ";", "}" ]
separate implementation from performAdj is an optimization
[ "separate", "implementation", "from", "performAdj", "is", "an", "optimization" ]
56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97
https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/BitVector.java#L1754-L1790
8,262
bitsoex/bitso-java
src/main/java/com/bitso/Bitso.java
Bitso.getWithdrawals
public BitsoWithdrawal[] getWithdrawals(String[] withdrawalsIds, String... queryParameters) throws BitsoAPIException, BitsoPayloadException, BitsoServerException { String request = "/api/v3/withdrawals"; if ((withdrawalsIds != null) && (queryParameters != null && queryParameters.length > 0)) { return null; } if (withdrawalsIds != null) { String withdrawalsIdsParameters = processQueryParameters("-", withdrawalsIds); request += ((withdrawalsIdsParameters != null) ? "/" + withdrawalsIdsParameters : ""); } if (queryParameters != null && queryParameters.length > 0) { String parsedQueryParametes = processQueryParameters("&", queryParameters); request += ((parsedQueryParametes != null) ? "?" + parsedQueryParametes : ""); } String getResponse = sendBitsoGet(request); JSONArray payloadJSON = (JSONArray) getJSONPayload(getResponse); int totalElements = payloadJSON.length(); BitsoWithdrawal[] withdrawals = new BitsoWithdrawal[totalElements]; for (int i = 0; i < totalElements; i++) { withdrawals[i] = new BitsoWithdrawal(payloadJSON.getJSONObject(i)); } return withdrawals; }
java
public BitsoWithdrawal[] getWithdrawals(String[] withdrawalsIds, String... queryParameters) throws BitsoAPIException, BitsoPayloadException, BitsoServerException { String request = "/api/v3/withdrawals"; if ((withdrawalsIds != null) && (queryParameters != null && queryParameters.length > 0)) { return null; } if (withdrawalsIds != null) { String withdrawalsIdsParameters = processQueryParameters("-", withdrawalsIds); request += ((withdrawalsIdsParameters != null) ? "/" + withdrawalsIdsParameters : ""); } if (queryParameters != null && queryParameters.length > 0) { String parsedQueryParametes = processQueryParameters("&", queryParameters); request += ((parsedQueryParametes != null) ? "?" + parsedQueryParametes : ""); } String getResponse = sendBitsoGet(request); JSONArray payloadJSON = (JSONArray) getJSONPayload(getResponse); int totalElements = payloadJSON.length(); BitsoWithdrawal[] withdrawals = new BitsoWithdrawal[totalElements]; for (int i = 0; i < totalElements; i++) { withdrawals[i] = new BitsoWithdrawal(payloadJSON.getJSONObject(i)); } return withdrawals; }
[ "public", "BitsoWithdrawal", "[", "]", "getWithdrawals", "(", "String", "[", "]", "withdrawalsIds", ",", "String", "...", "queryParameters", ")", "throws", "BitsoAPIException", ",", "BitsoPayloadException", ",", "BitsoServerException", "{", "String", "request", "=", "\"/api/v3/withdrawals\"", ";", "if", "(", "(", "withdrawalsIds", "!=", "null", ")", "&&", "(", "queryParameters", "!=", "null", "&&", "queryParameters", ".", "length", ">", "0", ")", ")", "{", "return", "null", ";", "}", "if", "(", "withdrawalsIds", "!=", "null", ")", "{", "String", "withdrawalsIdsParameters", "=", "processQueryParameters", "(", "\"-\"", ",", "withdrawalsIds", ")", ";", "request", "+=", "(", "(", "withdrawalsIdsParameters", "!=", "null", ")", "?", "\"/\"", "+", "withdrawalsIdsParameters", ":", "\"\"", ")", ";", "}", "if", "(", "queryParameters", "!=", "null", "&&", "queryParameters", ".", "length", ">", "0", ")", "{", "String", "parsedQueryParametes", "=", "processQueryParameters", "(", "\"&\"", ",", "queryParameters", ")", ";", "request", "+=", "(", "(", "parsedQueryParametes", "!=", "null", ")", "?", "\"?\"", "+", "parsedQueryParametes", ":", "\"\"", ")", ";", "}", "String", "getResponse", "=", "sendBitsoGet", "(", "request", ")", ";", "JSONArray", "payloadJSON", "=", "(", "JSONArray", ")", "getJSONPayload", "(", "getResponse", ")", ";", "int", "totalElements", "=", "payloadJSON", ".", "length", "(", ")", ";", "BitsoWithdrawal", "[", "]", "withdrawals", "=", "new", "BitsoWithdrawal", "[", "totalElements", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "totalElements", ";", "i", "++", ")", "{", "withdrawals", "[", "i", "]", "=", "new", "BitsoWithdrawal", "(", "payloadJSON", ".", "getJSONObject", "(", "i", ")", ")", ";", "}", "return", "withdrawals", ";", "}" ]
The request needs withdrawalsIds or queryParameters, not both. In case both parameters are provided null will be returned @param withdrawalsIds @param queryParameters @return BitsoWithdrawal[] @throws BitsoAPIException
[ "The", "request", "needs", "withdrawalsIds", "or", "queryParameters", "not", "both", ".", "In", "case", "both", "parameters", "are", "provided", "null", "will", "be", "returned" ]
a35eda77451166c0f0da7331df2255437cc40828
https://github.com/bitsoex/bitso-java/blob/a35eda77451166c0f0da7331df2255437cc40828/src/main/java/com/bitso/Bitso.java#L203-L229
8,263
bitsoex/bitso-java
src/main/java/com/bitso/Bitso.java
Bitso.getFundings
public BitsoFunding[] getFundings(String[] fundingssIds, String... queryParameters) throws BitsoAPIException, BitsoPayloadException, BitsoServerException { String request = "/api/v3/fundings"; if ((fundingssIds != null && (queryParameters != null && queryParameters.length > 0))) { return null; } if (fundingssIds != null) { String fundingssIdsParameters = processQueryParameters("-", fundingssIds); request += ((fundingssIdsParameters != null) ? "/" + fundingssIdsParameters : ""); } if (queryParameters != null && queryParameters.length > 0) { String parsedQueryParametes = processQueryParameters("&", queryParameters); request += ((parsedQueryParametes != null) ? "?" + parsedQueryParametes : ""); } String getResponse = sendBitsoGet(request); JSONArray payloadJSON = (JSONArray) getJSONPayload(getResponse); int totalElements = payloadJSON.length(); BitsoFunding[] fundings = new BitsoFunding[totalElements]; for (int i = 0; i < totalElements; i++) { fundings[i] = new BitsoFunding(payloadJSON.getJSONObject(i)); } return fundings; }
java
public BitsoFunding[] getFundings(String[] fundingssIds, String... queryParameters) throws BitsoAPIException, BitsoPayloadException, BitsoServerException { String request = "/api/v3/fundings"; if ((fundingssIds != null && (queryParameters != null && queryParameters.length > 0))) { return null; } if (fundingssIds != null) { String fundingssIdsParameters = processQueryParameters("-", fundingssIds); request += ((fundingssIdsParameters != null) ? "/" + fundingssIdsParameters : ""); } if (queryParameters != null && queryParameters.length > 0) { String parsedQueryParametes = processQueryParameters("&", queryParameters); request += ((parsedQueryParametes != null) ? "?" + parsedQueryParametes : ""); } String getResponse = sendBitsoGet(request); JSONArray payloadJSON = (JSONArray) getJSONPayload(getResponse); int totalElements = payloadJSON.length(); BitsoFunding[] fundings = new BitsoFunding[totalElements]; for (int i = 0; i < totalElements; i++) { fundings[i] = new BitsoFunding(payloadJSON.getJSONObject(i)); } return fundings; }
[ "public", "BitsoFunding", "[", "]", "getFundings", "(", "String", "[", "]", "fundingssIds", ",", "String", "...", "queryParameters", ")", "throws", "BitsoAPIException", ",", "BitsoPayloadException", ",", "BitsoServerException", "{", "String", "request", "=", "\"/api/v3/fundings\"", ";", "if", "(", "(", "fundingssIds", "!=", "null", "&&", "(", "queryParameters", "!=", "null", "&&", "queryParameters", ".", "length", ">", "0", ")", ")", ")", "{", "return", "null", ";", "}", "if", "(", "fundingssIds", "!=", "null", ")", "{", "String", "fundingssIdsParameters", "=", "processQueryParameters", "(", "\"-\"", ",", "fundingssIds", ")", ";", "request", "+=", "(", "(", "fundingssIdsParameters", "!=", "null", ")", "?", "\"/\"", "+", "fundingssIdsParameters", ":", "\"\"", ")", ";", "}", "if", "(", "queryParameters", "!=", "null", "&&", "queryParameters", ".", "length", ">", "0", ")", "{", "String", "parsedQueryParametes", "=", "processQueryParameters", "(", "\"&\"", ",", "queryParameters", ")", ";", "request", "+=", "(", "(", "parsedQueryParametes", "!=", "null", ")", "?", "\"?\"", "+", "parsedQueryParametes", ":", "\"\"", ")", ";", "}", "String", "getResponse", "=", "sendBitsoGet", "(", "request", ")", ";", "JSONArray", "payloadJSON", "=", "(", "JSONArray", ")", "getJSONPayload", "(", "getResponse", ")", ";", "int", "totalElements", "=", "payloadJSON", ".", "length", "(", ")", ";", "BitsoFunding", "[", "]", "fundings", "=", "new", "BitsoFunding", "[", "totalElements", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "totalElements", ";", "i", "++", ")", "{", "fundings", "[", "i", "]", "=", "new", "BitsoFunding", "(", "payloadJSON", ".", "getJSONObject", "(", "i", ")", ")", ";", "}", "return", "fundings", ";", "}" ]
The request needs fundingssIds or queryParameters, not both. In case both parameters are provided null will be returned @param fundingssIds @param queryParameters @return @throws BitsoAPIException
[ "The", "request", "needs", "fundingssIds", "or", "queryParameters", "not", "both", ".", "In", "case", "both", "parameters", "are", "provided", "null", "will", "be", "returned" ]
a35eda77451166c0f0da7331df2255437cc40828
https://github.com/bitsoex/bitso-java/blob/a35eda77451166c0f0da7331df2255437cc40828/src/main/java/com/bitso/Bitso.java#L240-L266
8,264
bitsoex/bitso-java
src/main/java/com/bitso/Bitso.java
Bitso.getUserTrades
public BitsoTrade[] getUserTrades(String[] tradesIds, String... queryParameters) throws BitsoAPIException, BitsoPayloadException, BitsoServerException { String request = "/api/v3/user_trades"; if ((tradesIds != null && (queryParameters != null && queryParameters.length > 0))) { return null; } if (tradesIds != null) { String fundingssIdsParameters = processQueryParameters("-", tradesIds); request += ((fundingssIdsParameters != null) ? "/" + fundingssIdsParameters : ""); } if (queryParameters != null && queryParameters.length > 0) { String parsedQueryParametes = processQueryParameters("&", queryParameters); request += ((parsedQueryParametes != null) ? "?" + parsedQueryParametes : ""); } String getResponse = sendBitsoGet(request); JSONArray payloadJSON = (JSONArray) getJSONPayload(getResponse); int totalElements = payloadJSON.length(); BitsoTrade[] trades = new BitsoTrade[totalElements]; for (int i = 0; i < totalElements; i++) { trades[i] = new BitsoTrade(payloadJSON.getJSONObject(i)); } return trades; }
java
public BitsoTrade[] getUserTrades(String[] tradesIds, String... queryParameters) throws BitsoAPIException, BitsoPayloadException, BitsoServerException { String request = "/api/v3/user_trades"; if ((tradesIds != null && (queryParameters != null && queryParameters.length > 0))) { return null; } if (tradesIds != null) { String fundingssIdsParameters = processQueryParameters("-", tradesIds); request += ((fundingssIdsParameters != null) ? "/" + fundingssIdsParameters : ""); } if (queryParameters != null && queryParameters.length > 0) { String parsedQueryParametes = processQueryParameters("&", queryParameters); request += ((parsedQueryParametes != null) ? "?" + parsedQueryParametes : ""); } String getResponse = sendBitsoGet(request); JSONArray payloadJSON = (JSONArray) getJSONPayload(getResponse); int totalElements = payloadJSON.length(); BitsoTrade[] trades = new BitsoTrade[totalElements]; for (int i = 0; i < totalElements; i++) { trades[i] = new BitsoTrade(payloadJSON.getJSONObject(i)); } return trades; }
[ "public", "BitsoTrade", "[", "]", "getUserTrades", "(", "String", "[", "]", "tradesIds", ",", "String", "...", "queryParameters", ")", "throws", "BitsoAPIException", ",", "BitsoPayloadException", ",", "BitsoServerException", "{", "String", "request", "=", "\"/api/v3/user_trades\"", ";", "if", "(", "(", "tradesIds", "!=", "null", "&&", "(", "queryParameters", "!=", "null", "&&", "queryParameters", ".", "length", ">", "0", ")", ")", ")", "{", "return", "null", ";", "}", "if", "(", "tradesIds", "!=", "null", ")", "{", "String", "fundingssIdsParameters", "=", "processQueryParameters", "(", "\"-\"", ",", "tradesIds", ")", ";", "request", "+=", "(", "(", "fundingssIdsParameters", "!=", "null", ")", "?", "\"/\"", "+", "fundingssIdsParameters", ":", "\"\"", ")", ";", "}", "if", "(", "queryParameters", "!=", "null", "&&", "queryParameters", ".", "length", ">", "0", ")", "{", "String", "parsedQueryParametes", "=", "processQueryParameters", "(", "\"&\"", ",", "queryParameters", ")", ";", "request", "+=", "(", "(", "parsedQueryParametes", "!=", "null", ")", "?", "\"?\"", "+", "parsedQueryParametes", ":", "\"\"", ")", ";", "}", "String", "getResponse", "=", "sendBitsoGet", "(", "request", ")", ";", "JSONArray", "payloadJSON", "=", "(", "JSONArray", ")", "getJSONPayload", "(", "getResponse", ")", ";", "int", "totalElements", "=", "payloadJSON", ".", "length", "(", ")", ";", "BitsoTrade", "[", "]", "trades", "=", "new", "BitsoTrade", "[", "totalElements", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "totalElements", ";", "i", "++", ")", "{", "trades", "[", "i", "]", "=", "new", "BitsoTrade", "(", "payloadJSON", ".", "getJSONObject", "(", "i", ")", ")", ";", "}", "return", "trades", ";", "}" ]
The request needs tradesIds or queryParameters, not both. In case both parameters are provided null will be returned @param tradesIds @param queryParameters @return @throws BitsoAPIException
[ "The", "request", "needs", "tradesIds", "or", "queryParameters", "not", "both", ".", "In", "case", "both", "parameters", "are", "provided", "null", "will", "be", "returned" ]
a35eda77451166c0f0da7331df2255437cc40828
https://github.com/bitsoex/bitso-java/blob/a35eda77451166c0f0da7331df2255437cc40828/src/main/java/com/bitso/Bitso.java#L277-L303
8,265
tomgibara/bits
src/main/java/com/tomgibara/bits/LongBitStore.java
LongBitStore.writeBits
static void writeBits(WriteStream writer, long bits, int count) { for (int i = (count - 1) & ~7; i >= 0; i -= 8) { writer.writeByte((byte) (bits >>> i)); } }
java
static void writeBits(WriteStream writer, long bits, int count) { for (int i = (count - 1) & ~7; i >= 0; i -= 8) { writer.writeByte((byte) (bits >>> i)); } }
[ "static", "void", "writeBits", "(", "WriteStream", "writer", ",", "long", "bits", ",", "int", "count", ")", "{", "for", "(", "int", "i", "=", "(", "count", "-", "1", ")", "&", "~", "7", ";", "i", ">=", "0", ";", "i", "-=", "8", ")", "{", "writer", ".", "writeByte", "(", "(", "byte", ")", "(", "bits", ">>>", "i", ")", ")", ";", "}", "}" ]
not does not mask off the supplied long - that is responsibility of caller
[ "not", "does", "not", "mask", "off", "the", "supplied", "long", "-", "that", "is", "responsibility", "of", "caller" ]
56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97
https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/LongBitStore.java#L58-L62
8,266
tomgibara/bits
src/main/java/com/tomgibara/bits/LongBitStore.java
LongBitStore.readBits
static long readBits(ReadStream reader, int count) { long bits = 0L; for (int i = (count - 1) >> 3; i >= 0; i --) { bits <<= 8; bits |= reader.readByte() & 0xff; } return bits; }
java
static long readBits(ReadStream reader, int count) { long bits = 0L; for (int i = (count - 1) >> 3; i >= 0; i --) { bits <<= 8; bits |= reader.readByte() & 0xff; } return bits; }
[ "static", "long", "readBits", "(", "ReadStream", "reader", ",", "int", "count", ")", "{", "long", "bits", "=", "0L", ";", "for", "(", "int", "i", "=", "(", "count", "-", "1", ")", ">>", "3", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "bits", "<<=", "8", ";", "bits", "|=", "reader", ".", "readByte", "(", ")", "&", "0xff", ";", "}", "return", "bits", ";", "}" ]
not does not mask off the returned long - that is responsibility of caller
[ "not", "does", "not", "mask", "off", "the", "returned", "long", "-", "that", "is", "responsibility", "of", "caller" ]
56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97
https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/LongBitStore.java#L65-L72
8,267
e-biz/spring-dbunit
spring-dbunit-core/src/main/java/com/excilys/ebi/spring/dbunit/dataset/xml/flyweight/FlyWeightFlatXmlProducer.java
FlyWeightFlatXmlProducer.mergeTableMetaData
private ITableMetaData mergeTableMetaData(List<Column> columnsToMerge, ITableMetaData originalMetaData) throws DataSetException { Column[] columns = new Column[originalMetaData.getColumns().length + columnsToMerge.size()]; System.arraycopy(originalMetaData.getColumns(), 0, columns, 0, originalMetaData.getColumns().length); for (int i = 0; i < columnsToMerge.size(); i++) { Column column = columnsToMerge.get(i); columns[columns.length - columnsToMerge.size() + i] = column; } return new DefaultTableMetaData(originalMetaData.getTableName(), columns); }
java
private ITableMetaData mergeTableMetaData(List<Column> columnsToMerge, ITableMetaData originalMetaData) throws DataSetException { Column[] columns = new Column[originalMetaData.getColumns().length + columnsToMerge.size()]; System.arraycopy(originalMetaData.getColumns(), 0, columns, 0, originalMetaData.getColumns().length); for (int i = 0; i < columnsToMerge.size(); i++) { Column column = columnsToMerge.get(i); columns[columns.length - columnsToMerge.size() + i] = column; } return new DefaultTableMetaData(originalMetaData.getTableName(), columns); }
[ "private", "ITableMetaData", "mergeTableMetaData", "(", "List", "<", "Column", ">", "columnsToMerge", ",", "ITableMetaData", "originalMetaData", ")", "throws", "DataSetException", "{", "Column", "[", "]", "columns", "=", "new", "Column", "[", "originalMetaData", ".", "getColumns", "(", ")", ".", "length", "+", "columnsToMerge", ".", "size", "(", ")", "]", ";", "System", ".", "arraycopy", "(", "originalMetaData", ".", "getColumns", "(", ")", ",", "0", ",", "columns", ",", "0", ",", "originalMetaData", ".", "getColumns", "(", ")", ".", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "columnsToMerge", ".", "size", "(", ")", ";", "i", "++", ")", "{", "Column", "column", "=", "columnsToMerge", ".", "get", "(", "i", ")", ";", "columns", "[", "columns", ".", "length", "-", "columnsToMerge", ".", "size", "(", ")", "+", "i", "]", "=", "column", ";", "}", "return", "new", "DefaultTableMetaData", "(", "originalMetaData", ".", "getTableName", "(", ")", ",", "columns", ")", ";", "}" ]
merges the existing columns with the potentially new ones. @param columnsToMerge List of extra columns found, which need to be merge back into the metadata. @return ITableMetaData The merged metadata object containing the new columns @throws DataSetException
[ "merges", "the", "existing", "columns", "with", "the", "potentially", "new", "ones", "." ]
1ec51222ecdd5dbd6daa4bd6879c6eabe76dfb6b
https://github.com/e-biz/spring-dbunit/blob/1ec51222ecdd5dbd6daa4bd6879c6eabe76dfb6b/spring-dbunit-core/src/main/java/com/excilys/ebi/spring/dbunit/dataset/xml/flyweight/FlyWeightFlatXmlProducer.java#L227-L237
8,268
e-biz/spring-dbunit
spring-dbunit-core/src/main/java/com/excilys/ebi/spring/dbunit/dataset/xml/flyweight/FlyWeightFlatXmlProducer.java
FlyWeightFlatXmlProducer.handleMissingColumns
protected void handleMissingColumns(Attributes attributes) throws DataSetException { List<Column> columnsToMerge = new ArrayList<Column>(); ITableMetaData activeMetaData = getActiveMetaData(); // Search all columns that do not yet exist and collect them int attributeLength = attributes.getLength(); for (int i = 0; i < attributeLength; i++) { try { activeMetaData.getColumnIndex(getAttributeNameFromCache(attributes.getQName(i))); } catch (NoSuchColumnException e) { columnsToMerge.add(new Column(getAttributeNameFromCache(attributes.getQName(i)), DataType.UNKNOWN)); } } if (!columnsToMerge.isEmpty()) { if (_columnSensing) { logger.debug("Column sensing enabled. Will create a new metaData with potentially new columns if needed"); activeMetaData = mergeTableMetaData(columnsToMerge, activeMetaData); _orderedTableNameMap.update(activeMetaData.getTableName(), activeMetaData); // We also need to recreate the table, copying the data already // collected from the old one to the new one _consumer.startTable(activeMetaData); } else { StringBuilder extraColumnNames = new StringBuilder(); for (Column col : columnsToMerge) { extraColumnNames.append(extraColumnNames.length() > 0 ? "," : "").append(col.getColumnName()); } if (logger.isWarnEnabled()) { StringBuilder msg = new StringBuilder(); msg.append("Extra columns ({}) on line {} for table {} (global line number is {}). Those columns will be ignored."); msg.append("\n\tPlease add the extra columns to line 1," + " or use a DTD to make sure the value of those columns are populated"); msg.append(" or specify 'columnSensing=true' for your FlatXmlProducer."); msg.append("\n\tSee FAQ for more details."); logger.warn(msg.toString(), new Object[] { extraColumnNames.toString(), _lineNumber + 1, activeMetaData.getTableName(), _lineNumberGlobal }); } } } }
java
protected void handleMissingColumns(Attributes attributes) throws DataSetException { List<Column> columnsToMerge = new ArrayList<Column>(); ITableMetaData activeMetaData = getActiveMetaData(); // Search all columns that do not yet exist and collect them int attributeLength = attributes.getLength(); for (int i = 0; i < attributeLength; i++) { try { activeMetaData.getColumnIndex(getAttributeNameFromCache(attributes.getQName(i))); } catch (NoSuchColumnException e) { columnsToMerge.add(new Column(getAttributeNameFromCache(attributes.getQName(i)), DataType.UNKNOWN)); } } if (!columnsToMerge.isEmpty()) { if (_columnSensing) { logger.debug("Column sensing enabled. Will create a new metaData with potentially new columns if needed"); activeMetaData = mergeTableMetaData(columnsToMerge, activeMetaData); _orderedTableNameMap.update(activeMetaData.getTableName(), activeMetaData); // We also need to recreate the table, copying the data already // collected from the old one to the new one _consumer.startTable(activeMetaData); } else { StringBuilder extraColumnNames = new StringBuilder(); for (Column col : columnsToMerge) { extraColumnNames.append(extraColumnNames.length() > 0 ? "," : "").append(col.getColumnName()); } if (logger.isWarnEnabled()) { StringBuilder msg = new StringBuilder(); msg.append("Extra columns ({}) on line {} for table {} (global line number is {}). Those columns will be ignored."); msg.append("\n\tPlease add the extra columns to line 1," + " or use a DTD to make sure the value of those columns are populated"); msg.append(" or specify 'columnSensing=true' for your FlatXmlProducer."); msg.append("\n\tSee FAQ for more details."); logger.warn(msg.toString(), new Object[] { extraColumnNames.toString(), _lineNumber + 1, activeMetaData.getTableName(), _lineNumberGlobal }); } } } }
[ "protected", "void", "handleMissingColumns", "(", "Attributes", "attributes", ")", "throws", "DataSetException", "{", "List", "<", "Column", ">", "columnsToMerge", "=", "new", "ArrayList", "<", "Column", ">", "(", ")", ";", "ITableMetaData", "activeMetaData", "=", "getActiveMetaData", "(", ")", ";", "// Search all columns that do not yet exist and collect them", "int", "attributeLength", "=", "attributes", ".", "getLength", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "attributeLength", ";", "i", "++", ")", "{", "try", "{", "activeMetaData", ".", "getColumnIndex", "(", "getAttributeNameFromCache", "(", "attributes", ".", "getQName", "(", "i", ")", ")", ")", ";", "}", "catch", "(", "NoSuchColumnException", "e", ")", "{", "columnsToMerge", ".", "add", "(", "new", "Column", "(", "getAttributeNameFromCache", "(", "attributes", ".", "getQName", "(", "i", ")", ")", ",", "DataType", ".", "UNKNOWN", ")", ")", ";", "}", "}", "if", "(", "!", "columnsToMerge", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "_columnSensing", ")", "{", "logger", ".", "debug", "(", "\"Column sensing enabled. Will create a new metaData with potentially new columns if needed\"", ")", ";", "activeMetaData", "=", "mergeTableMetaData", "(", "columnsToMerge", ",", "activeMetaData", ")", ";", "_orderedTableNameMap", ".", "update", "(", "activeMetaData", ".", "getTableName", "(", ")", ",", "activeMetaData", ")", ";", "// We also need to recreate the table, copying the data already", "// collected from the old one to the new one", "_consumer", ".", "startTable", "(", "activeMetaData", ")", ";", "}", "else", "{", "StringBuilder", "extraColumnNames", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Column", "col", ":", "columnsToMerge", ")", "{", "extraColumnNames", ".", "append", "(", "extraColumnNames", ".", "length", "(", ")", ">", "0", "?", "\",\"", ":", "\"\"", ")", ".", "append", "(", "col", ".", "getColumnName", "(", ")", ")", ";", "}", "if", "(", "logger", ".", "isWarnEnabled", "(", ")", ")", "{", "StringBuilder", "msg", "=", "new", "StringBuilder", "(", ")", ";", "msg", ".", "append", "(", "\"Extra columns ({}) on line {} for table {} (global line number is {}). Those columns will be ignored.\"", ")", ";", "msg", ".", "append", "(", "\"\\n\\tPlease add the extra columns to line 1,\"", "+", "\" or use a DTD to make sure the value of those columns are populated\"", ")", ";", "msg", ".", "append", "(", "\" or specify 'columnSensing=true' for your FlatXmlProducer.\"", ")", ";", "msg", ".", "append", "(", "\"\\n\\tSee FAQ for more details.\"", ")", ";", "logger", ".", "warn", "(", "msg", ".", "toString", "(", ")", ",", "new", "Object", "[", "]", "{", "extraColumnNames", ".", "toString", "(", ")", ",", "_lineNumber", "+", "1", ",", "activeMetaData", ".", "getTableName", "(", ")", ",", "_lineNumberGlobal", "}", ")", ";", "}", "}", "}", "}" ]
parses the attributes in the current row, and checks whether a new column is found. <p> Depending on the value of the <code>columnSensing</code> flag, the appropriate action is taken: </p> <ul> <li>If it is true, the new column is merged back into the metadata;</li> <li>If not, a warning message is displayed.</li> </ul> @param attributes Attributed for the current row. @throws DataSetException
[ "parses", "the", "attributes", "in", "the", "current", "row", "and", "checks", "whether", "a", "new", "column", "is", "found", "." ]
1ec51222ecdd5dbd6daa4bd6879c6eabe76dfb6b
https://github.com/e-biz/spring-dbunit/blob/1ec51222ecdd5dbd6daa4bd6879c6eabe76dfb6b/spring-dbunit-core/src/main/java/com/excilys/ebi/spring/dbunit/dataset/xml/flyweight/FlyWeightFlatXmlProducer.java#L280-L317
8,269
titorenko/quick-csv-streamer
src/main/java/uk/elementarysoftware/quickcsv/api/CSVParserBuilder.java
CSVParserBuilder.aParser
public static <T, K extends Enum<K>> CSVParserBuilder<T, K> aParser(Function<CSVRecord, T> mapper) { CSVParserBuilder<T, K> builder = new CSVParserBuilder<T, K>(); builder.recordMapper = mapper; return builder; }
java
public static <T, K extends Enum<K>> CSVParserBuilder<T, K> aParser(Function<CSVRecord, T> mapper) { CSVParserBuilder<T, K> builder = new CSVParserBuilder<T, K>(); builder.recordMapper = mapper; return builder; }
[ "public", "static", "<", "T", ",", "K", "extends", "Enum", "<", "K", ">", ">", "CSVParserBuilder", "<", "T", ",", "K", ">", "aParser", "(", "Function", "<", "CSVRecord", ",", "T", ">", "mapper", ")", "{", "CSVParserBuilder", "<", "T", ",", "K", ">", "builder", "=", "new", "CSVParserBuilder", "<", "T", ",", "K", ">", "(", ")", ";", "builder", ".", "recordMapper", "=", "mapper", ";", "return", "builder", ";", "}" ]
Create new parser using supplied mapping function. Mapping function can not store reference to {@link CSVRecord} object, it needs to be a pure function that creates new instance of T. CSVRecord could be mutated by the parser when next field or record are processed. @param mapper - mapping function from CSVRecord to T @param <T> - type of object that each record of the CSV data will be mapped to @param <K> - ignored @return this parser builder
[ "Create", "new", "parser", "using", "supplied", "mapping", "function", "." ]
cc11f6e9db6df4f3aac57ca72c4176501667f41d
https://github.com/titorenko/quick-csv-streamer/blob/cc11f6e9db6df4f3aac57ca72c4176501667f41d/src/main/java/uk/elementarysoftware/quickcsv/api/CSVParserBuilder.java#L45-L49
8,270
titorenko/quick-csv-streamer
src/main/java/uk/elementarysoftware/quickcsv/api/CSVParserBuilder.java
CSVParserBuilder.aParser
public static <T, K extends Enum<K>> CSVParserBuilder<T, K> aParser(Function<CSVRecordWithHeader<K>, T> mapper, Class<K> fields) { CSVParserBuilder<T, K> builder = new CSVParserBuilder<T, K>(); builder.recordWithHeaderMapper = mapper; builder.subsetView = FieldSubsetView.forSourceSuppliedHeader(fields); return builder; }
java
public static <T, K extends Enum<K>> CSVParserBuilder<T, K> aParser(Function<CSVRecordWithHeader<K>, T> mapper, Class<K> fields) { CSVParserBuilder<T, K> builder = new CSVParserBuilder<T, K>(); builder.recordWithHeaderMapper = mapper; builder.subsetView = FieldSubsetView.forSourceSuppliedHeader(fields); return builder; }
[ "public", "static", "<", "T", ",", "K", "extends", "Enum", "<", "K", ">", ">", "CSVParserBuilder", "<", "T", ",", "K", ">", "aParser", "(", "Function", "<", "CSVRecordWithHeader", "<", "K", ">", ",", "T", ">", "mapper", ",", "Class", "<", "K", ">", "fields", ")", "{", "CSVParserBuilder", "<", "T", ",", "K", ">", "builder", "=", "new", "CSVParserBuilder", "<", "T", ",", "K", ">", "(", ")", ";", "builder", ".", "recordWithHeaderMapper", "=", "mapper", ";", "builder", ".", "subsetView", "=", "FieldSubsetView", ".", "forSourceSuppliedHeader", "(", "fields", ")", ";", "return", "builder", ";", "}" ]
Create new header-aware parser using supplied mapping function. Mapping function can not store reference to {@link CSVRecordWithHeader} object, it needs to be a pure function that create new instance of T. CSVRecordWithHeader could be mutated by the parser when next record is processed. @param mapper - mapping function from CSVRecordWithHeader to T @param fields - enumeration specifying fields that should be parsed @param <T> - type of object that each record of the CSV data will be mapped to @param <K> - type of enumeration that is used to specify fields to be parsed @return this parser builder
[ "Create", "new", "header", "-", "aware", "parser", "using", "supplied", "mapping", "function", "." ]
cc11f6e9db6df4f3aac57ca72c4176501667f41d
https://github.com/titorenko/quick-csv-streamer/blob/cc11f6e9db6df4f3aac57ca72c4176501667f41d/src/main/java/uk/elementarysoftware/quickcsv/api/CSVParserBuilder.java#L67-L72
8,271
titorenko/quick-csv-streamer
src/main/java/uk/elementarysoftware/quickcsv/api/CSVParserBuilder.java
CSVParserBuilder.usingExplicitHeader
public CSVParserBuilder<T, K> usingExplicitHeader(String... header) { Objects.requireNonNull(subsetView); this.subsetView = FieldSubsetView.forExplicitHeader(subsetView.getFieldSubset(), header); return this; }
java
public CSVParserBuilder<T, K> usingExplicitHeader(String... header) { Objects.requireNonNull(subsetView); this.subsetView = FieldSubsetView.forExplicitHeader(subsetView.getFieldSubset(), header); return this; }
[ "public", "CSVParserBuilder", "<", "T", ",", "K", ">", "usingExplicitHeader", "(", "String", "...", "header", ")", "{", "Objects", ".", "requireNonNull", "(", "subsetView", ")", ";", "this", ".", "subsetView", "=", "FieldSubsetView", ".", "forExplicitHeader", "(", "subsetView", ".", "getFieldSubset", "(", ")", ",", "header", ")", ";", "return", "this", ";", "}" ]
Use supplied header and do not take header from the source. @param header - header fields @return this parser builder
[ "Use", "supplied", "header", "and", "do", "not", "take", "header", "from", "the", "source", "." ]
cc11f6e9db6df4f3aac57ca72c4176501667f41d
https://github.com/titorenko/quick-csv-streamer/blob/cc11f6e9db6df4f3aac57ca72c4176501667f41d/src/main/java/uk/elementarysoftware/quickcsv/api/CSVParserBuilder.java#L79-L83
8,272
titorenko/quick-csv-streamer
src/main/java/uk/elementarysoftware/quickcsv/api/CSVParserBuilder.java
CSVParserBuilder.usingSeparatorWithNoQuotes
public CSVParserBuilder<T, K> usingSeparatorWithNoQuotes(char separator) { this.metadata = new CSVFileMetadata(separator, Optional.empty()); return this; }
java
public CSVParserBuilder<T, K> usingSeparatorWithNoQuotes(char separator) { this.metadata = new CSVFileMetadata(separator, Optional.empty()); return this; }
[ "public", "CSVParserBuilder", "<", "T", ",", "K", ">", "usingSeparatorWithNoQuotes", "(", "char", "separator", ")", "{", "this", ".", "metadata", "=", "new", "CSVFileMetadata", "(", "separator", ",", "Optional", ".", "empty", "(", ")", ")", ";", "return", "this", ";", "}" ]
Use specified character as field separator. @param separator - field separator character @return this parser builder
[ "Use", "specified", "character", "as", "field", "separator", "." ]
cc11f6e9db6df4f3aac57ca72c4176501667f41d
https://github.com/titorenko/quick-csv-streamer/blob/cc11f6e9db6df4f3aac57ca72c4176501667f41d/src/main/java/uk/elementarysoftware/quickcsv/api/CSVParserBuilder.java#L108-L111
8,273
titorenko/quick-csv-streamer
src/main/java/uk/elementarysoftware/quickcsv/api/CSVParserBuilder.java
CSVParserBuilder.usingSeparatorWithQuote
public CSVParserBuilder<T, K> usingSeparatorWithQuote(char separator, char quote) { this.metadata = new CSVFileMetadata(separator, Optional.of(quote)); return this; }
java
public CSVParserBuilder<T, K> usingSeparatorWithQuote(char separator, char quote) { this.metadata = new CSVFileMetadata(separator, Optional.of(quote)); return this; }
[ "public", "CSVParserBuilder", "<", "T", ",", "K", ">", "usingSeparatorWithQuote", "(", "char", "separator", ",", "char", "quote", ")", "{", "this", ".", "metadata", "=", "new", "CSVFileMetadata", "(", "separator", ",", "Optional", ".", "of", "(", "quote", ")", ")", ";", "return", "this", ";", "}" ]
Use specified characters as field separator and quote character. Quote character can be escaped by preceding it with another quote character. @param separator - field separator character @param quote - quote character @return this parser builder
[ "Use", "specified", "characters", "as", "field", "separator", "and", "quote", "character", ".", "Quote", "character", "can", "be", "escaped", "by", "preceding", "it", "with", "another", "quote", "character", "." ]
cc11f6e9db6df4f3aac57ca72c4176501667f41d
https://github.com/titorenko/quick-csv-streamer/blob/cc11f6e9db6df4f3aac57ca72c4176501667f41d/src/main/java/uk/elementarysoftware/quickcsv/api/CSVParserBuilder.java#L120-L123
8,274
titorenko/quick-csv-streamer
src/main/java/uk/elementarysoftware/quickcsv/api/CSVParserBuilder.java
CSVParserBuilder.build
public CSVParser<T> build() { return subsetView == null ? new QuickCSVParser<T,K>(bufferSize, metadata, recordMapper, charset) : new QuickCSVParser<T,K>(bufferSize, metadata, recordWithHeaderMapper, subsetView, charset); }
java
public CSVParser<T> build() { return subsetView == null ? new QuickCSVParser<T,K>(bufferSize, metadata, recordMapper, charset) : new QuickCSVParser<T,K>(bufferSize, metadata, recordWithHeaderMapper, subsetView, charset); }
[ "public", "CSVParser", "<", "T", ">", "build", "(", ")", "{", "return", "subsetView", "==", "null", "?", "new", "QuickCSVParser", "<", "T", ",", "K", ">", "(", "bufferSize", ",", "metadata", ",", "recordMapper", ",", "charset", ")", ":", "new", "QuickCSVParser", "<", "T", ",", "K", ">", "(", "bufferSize", ",", "metadata", ",", "recordWithHeaderMapper", ",", "subsetView", ",", "charset", ")", ";", "}" ]
Construct parser using current setting @return CSV Parser
[ "Construct", "parser", "using", "current", "setting" ]
cc11f6e9db6df4f3aac57ca72c4176501667f41d
https://github.com/titorenko/quick-csv-streamer/blob/cc11f6e9db6df4f3aac57ca72c4176501667f41d/src/main/java/uk/elementarysoftware/quickcsv/api/CSVParserBuilder.java#L161-L165
8,275
tomgibara/bits
src/main/java/com/tomgibara/bits/OutputStreamBitWriter.java
OutputStreamBitWriter.writeByte
@Override protected void writeByte(int value) throws BitStreamException { try { out.write(value); } catch (IOException e) { throw new BitStreamException(e); } }
java
@Override protected void writeByte(int value) throws BitStreamException { try { out.write(value); } catch (IOException e) { throw new BitStreamException(e); } }
[ "@", "Override", "protected", "void", "writeByte", "(", "int", "value", ")", "throws", "BitStreamException", "{", "try", "{", "out", ".", "write", "(", "value", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "BitStreamException", "(", "e", ")", ";", "}", "}" ]
byte based methods
[ "byte", "based", "methods" ]
56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97
https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/OutputStreamBitWriter.java#L42-L49
8,276
bitsoex/bitso-java
src/main/java/com/bitso/BitsoFeeStructure.java
BitsoFeeStructure.getFeeInPercentage
public static BigDecimal getFeeInPercentage(BigDecimal thirtyDayVolume) { if (thirtyDayVolume.compareTo(new BigDecimal("1")) <= 0) { return new BigDecimal("1"); } else if (thirtyDayVolume.compareTo(new BigDecimal("2.5")) <= 0) { return new BigDecimal("0.95"); } else if (thirtyDayVolume.compareTo(new BigDecimal("4")) <= 0) { return new BigDecimal("0.9"); } else if (thirtyDayVolume.compareTo(new BigDecimal("6.5")) <= 0) { return new BigDecimal("0.85"); } else if (thirtyDayVolume.compareTo(new BigDecimal("9")) <= 0) { return new BigDecimal("0.8"); } else if (thirtyDayVolume.compareTo(new BigDecimal("12")) <= 0) { return new BigDecimal("0.75"); } else if (thirtyDayVolume.compareTo(new BigDecimal("18")) <= 0) { return new BigDecimal("0.7"); } else if (thirtyDayVolume.compareTo(new BigDecimal("25")) <= 0) { return new BigDecimal("0.65"); } else if (thirtyDayVolume.compareTo(new BigDecimal("32")) <= 0) { return new BigDecimal("0.60"); } else if (thirtyDayVolume.compareTo(new BigDecimal("40")) <= 0) { return new BigDecimal("0.55"); } else if (thirtyDayVolume.compareTo(new BigDecimal("55")) <= 0) { return new BigDecimal("0.5"); } else if (thirtyDayVolume.compareTo(new BigDecimal("75")) <= 0) { return new BigDecimal("0.45"); } else if (thirtyDayVolume.compareTo(new BigDecimal("100")) <= 0) { return new BigDecimal("0.4"); } else if (thirtyDayVolume.compareTo(new BigDecimal("125")) <= 0) { return new BigDecimal("0.35"); } else if (thirtyDayVolume.compareTo(new BigDecimal("160")) <= 0) { return new BigDecimal("0.3"); } else if (thirtyDayVolume.compareTo(new BigDecimal("200")) <= 0) { return new BigDecimal("0.25"); } else if (thirtyDayVolume.compareTo(new BigDecimal("250")) <= 0) { return new BigDecimal("0.2"); } else if (thirtyDayVolume.compareTo(new BigDecimal("320")) <= 0) { return new BigDecimal("0.15"); } else { return new BigDecimal("0.10"); } }
java
public static BigDecimal getFeeInPercentage(BigDecimal thirtyDayVolume) { if (thirtyDayVolume.compareTo(new BigDecimal("1")) <= 0) { return new BigDecimal("1"); } else if (thirtyDayVolume.compareTo(new BigDecimal("2.5")) <= 0) { return new BigDecimal("0.95"); } else if (thirtyDayVolume.compareTo(new BigDecimal("4")) <= 0) { return new BigDecimal("0.9"); } else if (thirtyDayVolume.compareTo(new BigDecimal("6.5")) <= 0) { return new BigDecimal("0.85"); } else if (thirtyDayVolume.compareTo(new BigDecimal("9")) <= 0) { return new BigDecimal("0.8"); } else if (thirtyDayVolume.compareTo(new BigDecimal("12")) <= 0) { return new BigDecimal("0.75"); } else if (thirtyDayVolume.compareTo(new BigDecimal("18")) <= 0) { return new BigDecimal("0.7"); } else if (thirtyDayVolume.compareTo(new BigDecimal("25")) <= 0) { return new BigDecimal("0.65"); } else if (thirtyDayVolume.compareTo(new BigDecimal("32")) <= 0) { return new BigDecimal("0.60"); } else if (thirtyDayVolume.compareTo(new BigDecimal("40")) <= 0) { return new BigDecimal("0.55"); } else if (thirtyDayVolume.compareTo(new BigDecimal("55")) <= 0) { return new BigDecimal("0.5"); } else if (thirtyDayVolume.compareTo(new BigDecimal("75")) <= 0) { return new BigDecimal("0.45"); } else if (thirtyDayVolume.compareTo(new BigDecimal("100")) <= 0) { return new BigDecimal("0.4"); } else if (thirtyDayVolume.compareTo(new BigDecimal("125")) <= 0) { return new BigDecimal("0.35"); } else if (thirtyDayVolume.compareTo(new BigDecimal("160")) <= 0) { return new BigDecimal("0.3"); } else if (thirtyDayVolume.compareTo(new BigDecimal("200")) <= 0) { return new BigDecimal("0.25"); } else if (thirtyDayVolume.compareTo(new BigDecimal("250")) <= 0) { return new BigDecimal("0.2"); } else if (thirtyDayVolume.compareTo(new BigDecimal("320")) <= 0) { return new BigDecimal("0.15"); } else { return new BigDecimal("0.10"); } }
[ "public", "static", "BigDecimal", "getFeeInPercentage", "(", "BigDecimal", "thirtyDayVolume", ")", "{", "if", "(", "thirtyDayVolume", ".", "compareTo", "(", "new", "BigDecimal", "(", "\"1\"", ")", ")", "<=", "0", ")", "{", "return", "new", "BigDecimal", "(", "\"1\"", ")", ";", "}", "else", "if", "(", "thirtyDayVolume", ".", "compareTo", "(", "new", "BigDecimal", "(", "\"2.5\"", ")", ")", "<=", "0", ")", "{", "return", "new", "BigDecimal", "(", "\"0.95\"", ")", ";", "}", "else", "if", "(", "thirtyDayVolume", ".", "compareTo", "(", "new", "BigDecimal", "(", "\"4\"", ")", ")", "<=", "0", ")", "{", "return", "new", "BigDecimal", "(", "\"0.9\"", ")", ";", "}", "else", "if", "(", "thirtyDayVolume", ".", "compareTo", "(", "new", "BigDecimal", "(", "\"6.5\"", ")", ")", "<=", "0", ")", "{", "return", "new", "BigDecimal", "(", "\"0.85\"", ")", ";", "}", "else", "if", "(", "thirtyDayVolume", ".", "compareTo", "(", "new", "BigDecimal", "(", "\"9\"", ")", ")", "<=", "0", ")", "{", "return", "new", "BigDecimal", "(", "\"0.8\"", ")", ";", "}", "else", "if", "(", "thirtyDayVolume", ".", "compareTo", "(", "new", "BigDecimal", "(", "\"12\"", ")", ")", "<=", "0", ")", "{", "return", "new", "BigDecimal", "(", "\"0.75\"", ")", ";", "}", "else", "if", "(", "thirtyDayVolume", ".", "compareTo", "(", "new", "BigDecimal", "(", "\"18\"", ")", ")", "<=", "0", ")", "{", "return", "new", "BigDecimal", "(", "\"0.7\"", ")", ";", "}", "else", "if", "(", "thirtyDayVolume", ".", "compareTo", "(", "new", "BigDecimal", "(", "\"25\"", ")", ")", "<=", "0", ")", "{", "return", "new", "BigDecimal", "(", "\"0.65\"", ")", ";", "}", "else", "if", "(", "thirtyDayVolume", ".", "compareTo", "(", "new", "BigDecimal", "(", "\"32\"", ")", ")", "<=", "0", ")", "{", "return", "new", "BigDecimal", "(", "\"0.60\"", ")", ";", "}", "else", "if", "(", "thirtyDayVolume", ".", "compareTo", "(", "new", "BigDecimal", "(", "\"40\"", ")", ")", "<=", "0", ")", "{", "return", "new", "BigDecimal", "(", "\"0.55\"", ")", ";", "}", "else", "if", "(", "thirtyDayVolume", ".", "compareTo", "(", "new", "BigDecimal", "(", "\"55\"", ")", ")", "<=", "0", ")", "{", "return", "new", "BigDecimal", "(", "\"0.5\"", ")", ";", "}", "else", "if", "(", "thirtyDayVolume", ".", "compareTo", "(", "new", "BigDecimal", "(", "\"75\"", ")", ")", "<=", "0", ")", "{", "return", "new", "BigDecimal", "(", "\"0.45\"", ")", ";", "}", "else", "if", "(", "thirtyDayVolume", ".", "compareTo", "(", "new", "BigDecimal", "(", "\"100\"", ")", ")", "<=", "0", ")", "{", "return", "new", "BigDecimal", "(", "\"0.4\"", ")", ";", "}", "else", "if", "(", "thirtyDayVolume", ".", "compareTo", "(", "new", "BigDecimal", "(", "\"125\"", ")", ")", "<=", "0", ")", "{", "return", "new", "BigDecimal", "(", "\"0.35\"", ")", ";", "}", "else", "if", "(", "thirtyDayVolume", ".", "compareTo", "(", "new", "BigDecimal", "(", "\"160\"", ")", ")", "<=", "0", ")", "{", "return", "new", "BigDecimal", "(", "\"0.3\"", ")", ";", "}", "else", "if", "(", "thirtyDayVolume", ".", "compareTo", "(", "new", "BigDecimal", "(", "\"200\"", ")", ")", "<=", "0", ")", "{", "return", "new", "BigDecimal", "(", "\"0.25\"", ")", ";", "}", "else", "if", "(", "thirtyDayVolume", ".", "compareTo", "(", "new", "BigDecimal", "(", "\"250\"", ")", ")", "<=", "0", ")", "{", "return", "new", "BigDecimal", "(", "\"0.2\"", ")", ";", "}", "else", "if", "(", "thirtyDayVolume", ".", "compareTo", "(", "new", "BigDecimal", "(", "\"320\"", ")", ")", "<=", "0", ")", "{", "return", "new", "BigDecimal", "(", "\"0.15\"", ")", ";", "}", "else", "{", "return", "new", "BigDecimal", "(", "\"0.10\"", ")", ";", "}", "}" ]
Accessed July 28, 2015
[ "Accessed", "July", "28", "2015" ]
a35eda77451166c0f0da7331df2255437cc40828
https://github.com/bitsoex/bitso-java/blob/a35eda77451166c0f0da7331df2255437cc40828/src/main/java/com/bitso/BitsoFeeStructure.java#L9-L49
8,277
tomgibara/bits
src/main/java/com/tomgibara/bits/Bits.java
Bits.writerTo
public static BitWriter writerTo(int[] ints, long size) { if (ints == null) throw new IllegalArgumentException("null ints"); if (size < 0) throw new IllegalArgumentException("negative size"); long maxSize = ((long) ints.length) << 5; if (size > maxSize) throw new IllegalArgumentException("size exceeds maximum permitted by array length"); return new IntArrayBitWriter(ints); }
java
public static BitWriter writerTo(int[] ints, long size) { if (ints == null) throw new IllegalArgumentException("null ints"); if (size < 0) throw new IllegalArgumentException("negative size"); long maxSize = ((long) ints.length) << 5; if (size > maxSize) throw new IllegalArgumentException("size exceeds maximum permitted by array length"); return new IntArrayBitWriter(ints); }
[ "public", "static", "BitWriter", "writerTo", "(", "int", "[", "]", "ints", ",", "long", "size", ")", "{", "if", "(", "ints", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"null ints\"", ")", ";", "if", "(", "size", "<", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"negative size\"", ")", ";", "long", "maxSize", "=", "(", "(", "long", ")", "ints", ".", "length", ")", "<<", "5", ";", "if", "(", "size", ">", "maxSize", ")", "throw", "new", "IllegalArgumentException", "(", "\"size exceeds maximum permitted by array length\"", ")", ";", "return", "new", "IntArrayBitWriter", "(", "ints", ")", ";", "}" ]
Writes bits to an array of ints up-to a specified limit. @param ints the array of ints @param size the greatest number of bits the writer will write to the array @return a writer that writes bits to the supplied array
[ "Writes", "bits", "to", "an", "array", "of", "ints", "up", "-", "to", "a", "specified", "limit", "." ]
56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97
https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/Bits.java#L872-L878
8,278
tomgibara/bits
src/main/java/com/tomgibara/bits/Bits.java
Bits.compareLexical
static int compareLexical(BitStore a, BitStore b) { int aSize = a.size(); int bSize = b.size(); int diff = a.size() - b.size(); ListIterator<Integer> as = a.ones().positions(aSize); ListIterator<Integer> bs = b.ones().positions(bSize); while (true) { boolean ap = as.hasPrevious(); boolean bp = bs.hasPrevious(); if (ap && bp) { int ai = as.previous(); int bi = bs.previous() + diff; if (ai == bi) continue; return ai > bi ? 1 : -1; } else { return bp ? -1 : 1; } } }
java
static int compareLexical(BitStore a, BitStore b) { int aSize = a.size(); int bSize = b.size(); int diff = a.size() - b.size(); ListIterator<Integer> as = a.ones().positions(aSize); ListIterator<Integer> bs = b.ones().positions(bSize); while (true) { boolean ap = as.hasPrevious(); boolean bp = bs.hasPrevious(); if (ap && bp) { int ai = as.previous(); int bi = bs.previous() + diff; if (ai == bi) continue; return ai > bi ? 1 : -1; } else { return bp ? -1 : 1; } } }
[ "static", "int", "compareLexical", "(", "BitStore", "a", ",", "BitStore", "b", ")", "{", "int", "aSize", "=", "a", ".", "size", "(", ")", ";", "int", "bSize", "=", "b", ".", "size", "(", ")", ";", "int", "diff", "=", "a", ".", "size", "(", ")", "-", "b", ".", "size", "(", ")", ";", "ListIterator", "<", "Integer", ">", "as", "=", "a", ".", "ones", "(", ")", ".", "positions", "(", "aSize", ")", ";", "ListIterator", "<", "Integer", ">", "bs", "=", "b", ".", "ones", "(", ")", ".", "positions", "(", "bSize", ")", ";", "while", "(", "true", ")", "{", "boolean", "ap", "=", "as", ".", "hasPrevious", "(", ")", ";", "boolean", "bp", "=", "bs", ".", "hasPrevious", "(", ")", ";", "if", "(", "ap", "&&", "bp", ")", "{", "int", "ai", "=", "as", ".", "previous", "(", ")", ";", "int", "bi", "=", "bs", ".", "previous", "(", ")", "+", "diff", ";", "if", "(", "ai", "==", "bi", ")", "continue", ";", "return", "ai", ">", "bi", "?", "1", ":", "-", "1", ";", "}", "else", "{", "return", "bp", "?", "-", "1", ":", "1", ";", "}", "}", "}" ]
expects a strictly longer than b
[ "expects", "a", "strictly", "longer", "than", "b" ]
56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97
https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/Bits.java#L1408-L1427
8,279
tomgibara/bits
src/main/java/com/tomgibara/bits/Bits.java
Bits.gcd
static int gcd(int a, int b) { while (a != b) { if (a > b) { int na = a % b; if (na == 0) return b; a = na; } else { int nb = b % a; if (nb == 0) return a; b = nb; } } return a; }
java
static int gcd(int a, int b) { while (a != b) { if (a > b) { int na = a % b; if (na == 0) return b; a = na; } else { int nb = b % a; if (nb == 0) return a; b = nb; } } return a; }
[ "static", "int", "gcd", "(", "int", "a", ",", "int", "b", ")", "{", "while", "(", "a", "!=", "b", ")", "{", "if", "(", "a", ">", "b", ")", "{", "int", "na", "=", "a", "%", "b", ";", "if", "(", "na", "==", "0", ")", "return", "b", ";", "a", "=", "na", ";", "}", "else", "{", "int", "nb", "=", "b", "%", "a", ";", "if", "(", "nb", "==", "0", ")", "return", "a", ";", "b", "=", "nb", ";", "}", "}", "return", "a", ";", "}" ]
duplicated here to avoid dependencies
[ "duplicated", "here", "to", "avoid", "dependencies" ]
56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97
https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/Bits.java#L1448-L1461
8,280
tomgibara/bits
src/main/java/com/tomgibara/bits/Bits.java
Bits.transferImpl
private static void transferImpl(BitReader reader, BitWriter writer, long count) { while (count >= 64) { //TODO could benefit from reading into a larger buffer here - eg bytes? long bits = reader.readLong(64); writer.write(bits, 64); count -= 64; } if (count != 0L) { long bits = reader.readLong((int) count); writer.write(bits, (int) count); } }
java
private static void transferImpl(BitReader reader, BitWriter writer, long count) { while (count >= 64) { //TODO could benefit from reading into a larger buffer here - eg bytes? long bits = reader.readLong(64); writer.write(bits, 64); count -= 64; } if (count != 0L) { long bits = reader.readLong((int) count); writer.write(bits, (int) count); } }
[ "private", "static", "void", "transferImpl", "(", "BitReader", "reader", ",", "BitWriter", "writer", ",", "long", "count", ")", "{", "while", "(", "count", ">=", "64", ")", "{", "//TODO could benefit from reading into a larger buffer here - eg bytes?", "long", "bits", "=", "reader", ".", "readLong", "(", "64", ")", ";", "writer", ".", "write", "(", "bits", ",", "64", ")", ";", "count", "-=", "64", ";", "}", "if", "(", "count", "!=", "0L", ")", "{", "long", "bits", "=", "reader", ".", "readLong", "(", "(", "int", ")", "count", ")", ";", "writer", ".", "write", "(", "bits", ",", "(", "int", ")", "count", ")", ";", "}", "}" ]
private static methods
[ "private", "static", "methods" ]
56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97
https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/Bits.java#L1508-L1519
8,281
tomgibara/bits
src/main/java/com/tomgibara/bits/IntArrayBitWriter.java
IntArrayBitWriter.doWrite
private void doWrite(int bits, int count) { int frontBits = ((int) position) & 31; int firstInt = (int) (position >> 5); int sumBits = count + frontBits; if (sumBits <= 32) { int i = ints[firstInt]; int mask = frontMask(frontBits) | backMask(sumBits); i &= mask; i |= (bits << (32 - sumBits)) & ~mask; ints[firstInt] = i; } else { int i = ints[firstInt]; int mask = frontMask(frontBits); i &= mask; int lostBits = sumBits - 32; i |= (bits >> lostBits) & ~mask; ints[firstInt] = i; i = ints[firstInt + 1]; mask = backMask(lostBits); i &= mask; i |= (bits << (32 - lostBits)) & ~mask; ints[firstInt + 1] = i; } }
java
private void doWrite(int bits, int count) { int frontBits = ((int) position) & 31; int firstInt = (int) (position >> 5); int sumBits = count + frontBits; if (sumBits <= 32) { int i = ints[firstInt]; int mask = frontMask(frontBits) | backMask(sumBits); i &= mask; i |= (bits << (32 - sumBits)) & ~mask; ints[firstInt] = i; } else { int i = ints[firstInt]; int mask = frontMask(frontBits); i &= mask; int lostBits = sumBits - 32; i |= (bits >> lostBits) & ~mask; ints[firstInt] = i; i = ints[firstInt + 1]; mask = backMask(lostBits); i &= mask; i |= (bits << (32 - lostBits)) & ~mask; ints[firstInt + 1] = i; } }
[ "private", "void", "doWrite", "(", "int", "bits", ",", "int", "count", ")", "{", "int", "frontBits", "=", "(", "(", "int", ")", "position", ")", "&", "31", ";", "int", "firstInt", "=", "(", "int", ")", "(", "position", ">>", "5", ")", ";", "int", "sumBits", "=", "count", "+", "frontBits", ";", "if", "(", "sumBits", "<=", "32", ")", "{", "int", "i", "=", "ints", "[", "firstInt", "]", ";", "int", "mask", "=", "frontMask", "(", "frontBits", ")", "|", "backMask", "(", "sumBits", ")", ";", "i", "&=", "mask", ";", "i", "|=", "(", "bits", "<<", "(", "32", "-", "sumBits", ")", ")", "&", "~", "mask", ";", "ints", "[", "firstInt", "]", "=", "i", ";", "}", "else", "{", "int", "i", "=", "ints", "[", "firstInt", "]", ";", "int", "mask", "=", "frontMask", "(", "frontBits", ")", ";", "i", "&=", "mask", ";", "int", "lostBits", "=", "sumBits", "-", "32", ";", "i", "|=", "(", "bits", ">>", "lostBits", ")", "&", "~", "mask", ";", "ints", "[", "firstInt", "]", "=", "i", ";", "i", "=", "ints", "[", "firstInt", "+", "1", "]", ";", "mask", "=", "backMask", "(", "lostBits", ")", ";", "i", "&=", "mask", ";", "i", "|=", "(", "bits", "<<", "(", "32", "-", "lostBits", ")", ")", "&", "~", "mask", ";", "ints", "[", "firstInt", "+", "1", "]", "=", "i", ";", "}", "}" ]
assumes count is non-zero
[ "assumes", "count", "is", "non", "-", "zero" ]
56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97
https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/IntArrayBitWriter.java#L237-L263
8,282
e-biz/spring-dbunit
spring-dbunit-core/src/main/java/com/excilys/ebi/spring/dbunit/dataset/xml/flyweight/FlyWeightFlatXmlDataSet.java
FlyWeightFlatXmlDataSet.write
public static void write(IDataSet dataSet, OutputStream out) throws IOException, DataSetException { logger.debug("write(dataSet={}, out={}) - start", dataSet, out); FlatXmlWriter datasetWriter = new FlatXmlWriter(out); datasetWriter.setIncludeEmptyTable(true); datasetWriter.write(dataSet); }
java
public static void write(IDataSet dataSet, OutputStream out) throws IOException, DataSetException { logger.debug("write(dataSet={}, out={}) - start", dataSet, out); FlatXmlWriter datasetWriter = new FlatXmlWriter(out); datasetWriter.setIncludeEmptyTable(true); datasetWriter.write(dataSet); }
[ "public", "static", "void", "write", "(", "IDataSet", "dataSet", ",", "OutputStream", "out", ")", "throws", "IOException", ",", "DataSetException", "{", "logger", ".", "debug", "(", "\"write(dataSet={}, out={}) - start\"", ",", "dataSet", ",", "out", ")", ";", "FlatXmlWriter", "datasetWriter", "=", "new", "FlatXmlWriter", "(", "out", ")", ";", "datasetWriter", ".", "setIncludeEmptyTable", "(", "true", ")", ";", "datasetWriter", ".", "write", "(", "dataSet", ")", ";", "}" ]
Write the specified dataset to the specified output stream as xml.
[ "Write", "the", "specified", "dataset", "to", "the", "specified", "output", "stream", "as", "xml", "." ]
1ec51222ecdd5dbd6daa4bd6879c6eabe76dfb6b
https://github.com/e-biz/spring-dbunit/blob/1ec51222ecdd5dbd6daa4bd6879c6eabe76dfb6b/spring-dbunit-core/src/main/java/com/excilys/ebi/spring/dbunit/dataset/xml/flyweight/FlyWeightFlatXmlDataSet.java#L114-L120
8,283
JRebirth/JRebirth
org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/base/AbstractSlideModel.java
AbstractSlideModel.hasStep
private boolean hasStep(final SlideContent slideContent) { boolean res = false; for (final S step : getStepList()) { if (step.name().equalsIgnoreCase(slideContent.getName())) { res = true; } } return res; }
java
private boolean hasStep(final SlideContent slideContent) { boolean res = false; for (final S step : getStepList()) { if (step.name().equalsIgnoreCase(slideContent.getName())) { res = true; } } return res; }
[ "private", "boolean", "hasStep", "(", "final", "SlideContent", "slideContent", ")", "{", "boolean", "res", "=", "false", ";", "for", "(", "final", "S", "step", ":", "getStepList", "(", ")", ")", "{", "if", "(", "step", ".", "name", "(", ")", ".", "equalsIgnoreCase", "(", "slideContent", ".", "getName", "(", ")", ")", ")", "{", "res", "=", "true", ";", "}", "}", "return", "res", ";", "}" ]
Check if step defined in xml exist into current step list. @param slideContent the content to check @return true if the slide content is mapped to a programmatic slidestep
[ "Check", "if", "step", "defined", "in", "xml", "exist", "into", "current", "step", "list", "." ]
93f4fc087b83c73db540333b9686e97b4cec694d
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/base/AbstractSlideModel.java#L257-L265
8,284
JRebirth/JRebirth
org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/base/AbstractSlideModel.java
AbstractSlideModel.getDefaultContent
public SlideContent getDefaultContent() { SlideContent res = null; if (getSlide().getContent() != null && !getSlide().getContent().isEmpty()) { res = getSlide().getContent().get(0); } return res; }
java
public SlideContent getDefaultContent() { SlideContent res = null; if (getSlide().getContent() != null && !getSlide().getContent().isEmpty()) { res = getSlide().getContent().get(0); } return res; }
[ "public", "SlideContent", "getDefaultContent", "(", ")", "{", "SlideContent", "res", "=", "null", ";", "if", "(", "getSlide", "(", ")", ".", "getContent", "(", ")", "!=", "null", "&&", "!", "getSlide", "(", ")", ".", "getContent", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "res", "=", "getSlide", "(", ")", ".", "getContent", "(", ")", ".", "get", "(", "0", ")", ";", "}", "return", "res", ";", "}" ]
Return the default content or null. @return the default SlideContent
[ "Return", "the", "default", "content", "or", "null", "." ]
93f4fc087b83c73db540333b9686e97b4cec694d
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/base/AbstractSlideModel.java#L315-L321
8,285
JRebirth/JRebirth
org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/base/AbstractSlideModel.java
AbstractSlideModel.getContent
public SlideContent getContent(final SlideStep slideStep) { SlideContent res = null; if (getSlide().getContent() != null && !getSlide().getContent().isEmpty()) { for (final SlideContent sc : getSlide().getContent()) { if (sc.getName() != null && !sc.getName().isEmpty() && sc.getName().equals(slideStep.name())) { res = sc; } } } return res == null ? getDefaultContent() : res; }
java
public SlideContent getContent(final SlideStep slideStep) { SlideContent res = null; if (getSlide().getContent() != null && !getSlide().getContent().isEmpty()) { for (final SlideContent sc : getSlide().getContent()) { if (sc.getName() != null && !sc.getName().isEmpty() && sc.getName().equals(slideStep.name())) { res = sc; } } } return res == null ? getDefaultContent() : res; }
[ "public", "SlideContent", "getContent", "(", "final", "SlideStep", "slideStep", ")", "{", "SlideContent", "res", "=", "null", ";", "if", "(", "getSlide", "(", ")", ".", "getContent", "(", ")", "!=", "null", "&&", "!", "getSlide", "(", ")", ".", "getContent", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "for", "(", "final", "SlideContent", "sc", ":", "getSlide", "(", ")", ".", "getContent", "(", ")", ")", "{", "if", "(", "sc", ".", "getName", "(", ")", "!=", "null", "&&", "!", "sc", ".", "getName", "(", ")", ".", "isEmpty", "(", ")", "&&", "sc", ".", "getName", "(", ")", ".", "equals", "(", "slideStep", ".", "name", "(", ")", ")", ")", "{", "res", "=", "sc", ";", "}", "}", "}", "return", "res", "==", "null", "?", "getDefaultContent", "(", ")", ":", "res", ";", "}" ]
Return the default content or null for the given step. @param slideStep the step to build @return the SlideContent
[ "Return", "the", "default", "content", "or", "null", "for", "the", "given", "step", "." ]
93f4fc087b83c73db540333b9686e97b4cec694d
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/base/AbstractSlideModel.java#L330-L340
8,286
JRebirth/JRebirth
org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/base/AbstractSlideModel.java
AbstractSlideModel.buildAnimation
private Animation buildAnimation(final AnimationType animationType) { Animation animation = null; switch (animationType) { case MOVE_TO_RIGHT: animation = buildHorizontalAnimation(0, 2000, 0, 0); break; case MOVE_TO_LEFT: animation = buildHorizontalAnimation(0, -2000, 0, 0); break; case MOVE_TO_TOP: animation = buildHorizontalAnimation(0, 0, 0, -1000); break; case MOVE_TO_BOTTOM: animation = buildHorizontalAnimation(0, 0, 0, 1000); break; case MOVE_FROM_RIGHT: animation = buildHorizontalAnimation(2000, 0, 0, 0); break; case MOVE_FROM_LEFT: animation = buildHorizontalAnimation(-2000, 0, 0, 0); break; case MOVE_FROM_TOP: animation = buildHorizontalAnimation(0, 0, -1000, 0); break; case MOVE_FROM_BOTTOM: animation = buildHorizontalAnimation(0, 0, 1000, 0); break; case FADE_IN: animation = FadeTransitionBuilder.create().node(node()).fromValue(0).toValue(1.0).duration(Duration.seconds(1)).build(); break; case FADE_OUT: animation = FadeTransitionBuilder.create().node(node()).fromValue(1.0).toValue(0.0).duration(Duration.seconds(1)).build(); break; case SCALE_FROM_MAX: animation = buildScaleAnimation(20.0, 1.0, true); break; case SCALE_FROM_MIN: animation = buildScaleAnimation(0.0, 1.0, true); break; case SCALE_TO_MAX: animation = buildScaleAnimation(1.0, 20.0, false); break; case SCALE_TO_MIN: animation = buildScaleAnimation(1.0, 0.0, false); break; case SLIDING_TOP_BOTTOM_PROGRESSIVE: animation = buildSliding(); break; case TILE_IN: break; case TILE_OUT: break; case TILE_IN_60_K: break; case TILE_OUT_60_K: break; default: // animation = PauseTransitionBuilder.create().duration(Duration.seconds(1)).build(); } return animation; }
java
private Animation buildAnimation(final AnimationType animationType) { Animation animation = null; switch (animationType) { case MOVE_TO_RIGHT: animation = buildHorizontalAnimation(0, 2000, 0, 0); break; case MOVE_TO_LEFT: animation = buildHorizontalAnimation(0, -2000, 0, 0); break; case MOVE_TO_TOP: animation = buildHorizontalAnimation(0, 0, 0, -1000); break; case MOVE_TO_BOTTOM: animation = buildHorizontalAnimation(0, 0, 0, 1000); break; case MOVE_FROM_RIGHT: animation = buildHorizontalAnimation(2000, 0, 0, 0); break; case MOVE_FROM_LEFT: animation = buildHorizontalAnimation(-2000, 0, 0, 0); break; case MOVE_FROM_TOP: animation = buildHorizontalAnimation(0, 0, -1000, 0); break; case MOVE_FROM_BOTTOM: animation = buildHorizontalAnimation(0, 0, 1000, 0); break; case FADE_IN: animation = FadeTransitionBuilder.create().node(node()).fromValue(0).toValue(1.0).duration(Duration.seconds(1)).build(); break; case FADE_OUT: animation = FadeTransitionBuilder.create().node(node()).fromValue(1.0).toValue(0.0).duration(Duration.seconds(1)).build(); break; case SCALE_FROM_MAX: animation = buildScaleAnimation(20.0, 1.0, true); break; case SCALE_FROM_MIN: animation = buildScaleAnimation(0.0, 1.0, true); break; case SCALE_TO_MAX: animation = buildScaleAnimation(1.0, 20.0, false); break; case SCALE_TO_MIN: animation = buildScaleAnimation(1.0, 0.0, false); break; case SLIDING_TOP_BOTTOM_PROGRESSIVE: animation = buildSliding(); break; case TILE_IN: break; case TILE_OUT: break; case TILE_IN_60_K: break; case TILE_OUT_60_K: break; default: // animation = PauseTransitionBuilder.create().duration(Duration.seconds(1)).build(); } return animation; }
[ "private", "Animation", "buildAnimation", "(", "final", "AnimationType", "animationType", ")", "{", "Animation", "animation", "=", "null", ";", "switch", "(", "animationType", ")", "{", "case", "MOVE_TO_RIGHT", ":", "animation", "=", "buildHorizontalAnimation", "(", "0", ",", "2000", ",", "0", ",", "0", ")", ";", "break", ";", "case", "MOVE_TO_LEFT", ":", "animation", "=", "buildHorizontalAnimation", "(", "0", ",", "-", "2000", ",", "0", ",", "0", ")", ";", "break", ";", "case", "MOVE_TO_TOP", ":", "animation", "=", "buildHorizontalAnimation", "(", "0", ",", "0", ",", "0", ",", "-", "1000", ")", ";", "break", ";", "case", "MOVE_TO_BOTTOM", ":", "animation", "=", "buildHorizontalAnimation", "(", "0", ",", "0", ",", "0", ",", "1000", ")", ";", "break", ";", "case", "MOVE_FROM_RIGHT", ":", "animation", "=", "buildHorizontalAnimation", "(", "2000", ",", "0", ",", "0", ",", "0", ")", ";", "break", ";", "case", "MOVE_FROM_LEFT", ":", "animation", "=", "buildHorizontalAnimation", "(", "-", "2000", ",", "0", ",", "0", ",", "0", ")", ";", "break", ";", "case", "MOVE_FROM_TOP", ":", "animation", "=", "buildHorizontalAnimation", "(", "0", ",", "0", ",", "-", "1000", ",", "0", ")", ";", "break", ";", "case", "MOVE_FROM_BOTTOM", ":", "animation", "=", "buildHorizontalAnimation", "(", "0", ",", "0", ",", "1000", ",", "0", ")", ";", "break", ";", "case", "FADE_IN", ":", "animation", "=", "FadeTransitionBuilder", ".", "create", "(", ")", ".", "node", "(", "node", "(", ")", ")", ".", "fromValue", "(", "0", ")", ".", "toValue", "(", "1.0", ")", ".", "duration", "(", "Duration", ".", "seconds", "(", "1", ")", ")", ".", "build", "(", ")", ";", "break", ";", "case", "FADE_OUT", ":", "animation", "=", "FadeTransitionBuilder", ".", "create", "(", ")", ".", "node", "(", "node", "(", ")", ")", ".", "fromValue", "(", "1.0", ")", ".", "toValue", "(", "0.0", ")", ".", "duration", "(", "Duration", ".", "seconds", "(", "1", ")", ")", ".", "build", "(", ")", ";", "break", ";", "case", "SCALE_FROM_MAX", ":", "animation", "=", "buildScaleAnimation", "(", "20.0", ",", "1.0", ",", "true", ")", ";", "break", ";", "case", "SCALE_FROM_MIN", ":", "animation", "=", "buildScaleAnimation", "(", "0.0", ",", "1.0", ",", "true", ")", ";", "break", ";", "case", "SCALE_TO_MAX", ":", "animation", "=", "buildScaleAnimation", "(", "1.0", ",", "20.0", ",", "false", ")", ";", "break", ";", "case", "SCALE_TO_MIN", ":", "animation", "=", "buildScaleAnimation", "(", "1.0", ",", "0.0", ",", "false", ")", ";", "break", ";", "case", "SLIDING_TOP_BOTTOM_PROGRESSIVE", ":", "animation", "=", "buildSliding", "(", ")", ";", "break", ";", "case", "TILE_IN", ":", "break", ";", "case", "TILE_OUT", ":", "break", ";", "case", "TILE_IN_60_K", ":", "break", ";", "case", "TILE_OUT_60_K", ":", "break", ";", "default", ":", "// animation = PauseTransitionBuilder.create().duration(Duration.seconds(1)).build();", "}", "return", "animation", ";", "}" ]
Build an animation. @param animationType the type of the animation to build @return the animation
[ "Build", "an", "animation", "." ]
93f4fc087b83c73db540333b9686e97b4cec694d
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/base/AbstractSlideModel.java#L377-L443
8,287
JRebirth/JRebirth
org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/base/AbstractSlideModel.java
AbstractSlideModel.findAngle
private double findAngle(final double fromX, final double fromY, final double toX, final double toY) { final double yDelta = toY - fromY; final double y = Math.sin(yDelta) * Math.cos(toX); final double x = Math.cos(fromX) * Math.sin(toX) - Math.sin(fromX) * Math.cos(toX) * Math.cos(yDelta); double angle = Math.toDegrees(Math.atan2(y, x)); // Keep a positive angle while (angle < 0) { angle += 360; } return (float) angle % 360; }
java
private double findAngle(final double fromX, final double fromY, final double toX, final double toY) { final double yDelta = toY - fromY; final double y = Math.sin(yDelta) * Math.cos(toX); final double x = Math.cos(fromX) * Math.sin(toX) - Math.sin(fromX) * Math.cos(toX) * Math.cos(yDelta); double angle = Math.toDegrees(Math.atan2(y, x)); // Keep a positive angle while (angle < 0) { angle += 360; } return (float) angle % 360; }
[ "private", "double", "findAngle", "(", "final", "double", "fromX", ",", "final", "double", "fromY", ",", "final", "double", "toX", ",", "final", "double", "toY", ")", "{", "final", "double", "yDelta", "=", "toY", "-", "fromY", ";", "final", "double", "y", "=", "Math", ".", "sin", "(", "yDelta", ")", "*", "Math", ".", "cos", "(", "toX", ")", ";", "final", "double", "x", "=", "Math", ".", "cos", "(", "fromX", ")", "*", "Math", ".", "sin", "(", "toX", ")", "-", "Math", ".", "sin", "(", "fromX", ")", "*", "Math", ".", "cos", "(", "toX", ")", "*", "Math", ".", "cos", "(", "yDelta", ")", ";", "double", "angle", "=", "Math", ".", "toDegrees", "(", "Math", ".", "atan2", "(", "y", ",", "x", ")", ")", ";", "// Keep a positive angle", "while", "(", "angle", "<", "0", ")", "{", "angle", "+=", "360", ";", "}", "return", "(", "float", ")", "angle", "%", "360", ";", "}" ]
Return the right angle for the given coordinate. @param fromX the x starting point coordinate @param toX the x arrival point coordinate @param fromY the y starting point coordinate @param toY the y arrival point coordinate @return the right angle
[ "Return", "the", "right", "angle", "for", "the", "given", "coordinate", "." ]
93f4fc087b83c73db540333b9686e97b4cec694d
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/base/AbstractSlideModel.java#L534-L546
8,288
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/link/NotifierBase.java
NotifierBase.callCommand
@SuppressWarnings("unchecked") private void callCommand(final Wave wave) { // Use the Wave UID to guarantee that a new fresh command is built and used ! final Command command = wave.contains(JRebirthWaves.REUSE_COMMAND) && wave.get(JRebirthWaves.REUSE_COMMAND) ? globalFacade().commandFacade().retrieve((Class<Command>) wave.componentClass()) : globalFacade().commandFacade().retrieve((Class<Command>) wave.componentClass(), wave.wUID()); if (command == null) { LOGGER.error(COMMAND_NOT_FOUND_ERROR, wave.toString()); // When developer mode is activated an error will be thrown by logger // Otherwise the wave will be managed by UnprocessedWaveHandler this.unprocessedWaveHandler.manageUnprocessedWave(COMMAND_NOT_FOUND_MESSAGE.getText(), wave); } else { // Run the command into the predefined thread command.run(wave); } }
java
@SuppressWarnings("unchecked") private void callCommand(final Wave wave) { // Use the Wave UID to guarantee that a new fresh command is built and used ! final Command command = wave.contains(JRebirthWaves.REUSE_COMMAND) && wave.get(JRebirthWaves.REUSE_COMMAND) ? globalFacade().commandFacade().retrieve((Class<Command>) wave.componentClass()) : globalFacade().commandFacade().retrieve((Class<Command>) wave.componentClass(), wave.wUID()); if (command == null) { LOGGER.error(COMMAND_NOT_FOUND_ERROR, wave.toString()); // When developer mode is activated an error will be thrown by logger // Otherwise the wave will be managed by UnprocessedWaveHandler this.unprocessedWaveHandler.manageUnprocessedWave(COMMAND_NOT_FOUND_MESSAGE.getText(), wave); } else { // Run the command into the predefined thread command.run(wave); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "void", "callCommand", "(", "final", "Wave", "wave", ")", "{", "// Use the Wave UID to guarantee that a new fresh command is built and used !", "final", "Command", "command", "=", "wave", ".", "contains", "(", "JRebirthWaves", ".", "REUSE_COMMAND", ")", "&&", "wave", ".", "get", "(", "JRebirthWaves", ".", "REUSE_COMMAND", ")", "?", "globalFacade", "(", ")", ".", "commandFacade", "(", ")", ".", "retrieve", "(", "(", "Class", "<", "Command", ">", ")", "wave", ".", "componentClass", "(", ")", ")", ":", "globalFacade", "(", ")", ".", "commandFacade", "(", ")", ".", "retrieve", "(", "(", "Class", "<", "Command", ">", ")", "wave", ".", "componentClass", "(", ")", ",", "wave", ".", "wUID", "(", ")", ")", ";", "if", "(", "command", "==", "null", ")", "{", "LOGGER", ".", "error", "(", "COMMAND_NOT_FOUND_ERROR", ",", "wave", ".", "toString", "(", ")", ")", ";", "// When developer mode is activated an error will be thrown by logger", "// Otherwise the wave will be managed by UnprocessedWaveHandler", "this", ".", "unprocessedWaveHandler", ".", "manageUnprocessedWave", "(", "COMMAND_NOT_FOUND_MESSAGE", ".", "getText", "(", ")", ",", "wave", ")", ";", "}", "else", "{", "// Run the command into the predefined thread", "command", ".", "run", "(", "wave", ")", ";", "}", "}" ]
Call dynamically a command. According to its runIntoType the command will be run into JAT, JIT or a Thread Pool Each time a new fresh command will be retrieved. This method is called from the JIT (JRebirth Internal Thread)<br> @param wave the wave that contains all informations
[ "Call", "dynamically", "a", "command", "." ]
93f4fc087b83c73db540333b9686e97b4cec694d
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/link/NotifierBase.java#L132-L150
8,289
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/link/NotifierBase.java
NotifierBase.returnData
@SuppressWarnings("unchecked") private void returnData(final Wave wave) { // Use only the Service class to retrieve the same instance each time final Service service = globalFacade().serviceFacade().retrieve((Class<Service>) wave.componentClass()); if (service == null) { LOGGER.error(SERVICE_NOT_FOUND_ERROR, wave.toString()); // When developer mode is activated an error will be thrown by logger // Otherwise the wave will be managed by UnprocessedWaveHandler this.unprocessedWaveHandler.manageUnprocessedWave(SERVICE_NOT_FOUND_MESSAGE.getText(), wave); } else { // The inner task will be run into the JRebirth Thread Pool final ServiceTaskBase<?> task = (ServiceTaskBase<?>) service.returnData(wave); if (task != null && CoreParameters.FOLLOW_UP_SERVICE_TASKS.get()) { globalFacade().serviceFacade().retrieve(TaskTrackerService.class).trackTask(task); } } }
java
@SuppressWarnings("unchecked") private void returnData(final Wave wave) { // Use only the Service class to retrieve the same instance each time final Service service = globalFacade().serviceFacade().retrieve((Class<Service>) wave.componentClass()); if (service == null) { LOGGER.error(SERVICE_NOT_FOUND_ERROR, wave.toString()); // When developer mode is activated an error will be thrown by logger // Otherwise the wave will be managed by UnprocessedWaveHandler this.unprocessedWaveHandler.manageUnprocessedWave(SERVICE_NOT_FOUND_MESSAGE.getText(), wave); } else { // The inner task will be run into the JRebirth Thread Pool final ServiceTaskBase<?> task = (ServiceTaskBase<?>) service.returnData(wave); if (task != null && CoreParameters.FOLLOW_UP_SERVICE_TASKS.get()) { globalFacade().serviceFacade().retrieve(TaskTrackerService.class).trackTask(task); } } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "void", "returnData", "(", "final", "Wave", "wave", ")", "{", "// Use only the Service class to retrieve the same instance each time", "final", "Service", "service", "=", "globalFacade", "(", ")", ".", "serviceFacade", "(", ")", ".", "retrieve", "(", "(", "Class", "<", "Service", ">", ")", "wave", ".", "componentClass", "(", ")", ")", ";", "if", "(", "service", "==", "null", ")", "{", "LOGGER", ".", "error", "(", "SERVICE_NOT_FOUND_ERROR", ",", "wave", ".", "toString", "(", ")", ")", ";", "// When developer mode is activated an error will be thrown by logger", "// Otherwise the wave will be managed by UnprocessedWaveHandler", "this", ".", "unprocessedWaveHandler", ".", "manageUnprocessedWave", "(", "SERVICE_NOT_FOUND_MESSAGE", ".", "getText", "(", ")", ",", "wave", ")", ";", "}", "else", "{", "// The inner task will be run into the JRebirth Thread Pool", "final", "ServiceTaskBase", "<", "?", ">", "task", "=", "(", "ServiceTaskBase", "<", "?", ">", ")", "service", ".", "returnData", "(", "wave", ")", ";", "if", "(", "task", "!=", "null", "&&", "CoreParameters", ".", "FOLLOW_UP_SERVICE_TASKS", ".", "get", "(", ")", ")", "{", "globalFacade", "(", ")", ".", "serviceFacade", "(", ")", ".", "retrieve", "(", "TaskTrackerService", ".", "class", ")", ".", "trackTask", "(", "task", ")", ";", "}", "}", "}" ]
Call a service method by using a task worker. The same service will be retrieved each time this method is called. This method is called from the JIT (JRebirth Internal Thread)<br /> @param wave the wave that contains all informations
[ "Call", "a", "service", "method", "by", "using", "a", "task", "worker", "." ]
93f4fc087b83c73db540333b9686e97b4cec694d
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/link/NotifierBase.java#L161-L181
8,290
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/link/NotifierBase.java
NotifierBase.processUndefinedWave
private void processUndefinedWave(final Wave wave) throws WaveException { LOGGER.info(NOTIFIER_CONSUMES, wave.toString()); wave.status(Status.Consumed); // Retrieve all interested object from the map if (this.notifierMap.containsKey(wave.waveType())) { final WaveSubscription ws = this.notifierMap.get(wave.waveType()); // Filter and store all Wave handlers into the wave // They will be removed from the list when they are handled in order to know if there is any handler left before wave.setWaveHandlers(ws.getWaveHandlers().stream().filter(wh -> wh.check(wave)).collect(Collectors.toList())); // For each object interested in that wave type, process the action // Make a defensive copy to protect from concurrent modification exception when the wavehandler will be removed from list for (final WaveHandler waveHandler : new ArrayList<>(wave.getWaveHandlers())) { // The handler will be performed in the right thread according to RunType annotation waveHandler.handle(wave); } } else { LOGGER.warn(NO_WAVE_LISTENER, wave.waveType().toString()); if (CoreParameters.DEVELOPER_MODE.get()) { this.unprocessedWaveHandler.manageUnprocessedWave(NO_WAVE_LISTENER.getText(wave.waveType().toString()), wave); } } // The current wave will be marked as Handled when all Wave Handlers will be terminated // if(!wave.isRelated()){ // LOGGER.info(NOTIFIER_HANDLES, wave.toString()); // wave.status(Status.Handled); // } }
java
private void processUndefinedWave(final Wave wave) throws WaveException { LOGGER.info(NOTIFIER_CONSUMES, wave.toString()); wave.status(Status.Consumed); // Retrieve all interested object from the map if (this.notifierMap.containsKey(wave.waveType())) { final WaveSubscription ws = this.notifierMap.get(wave.waveType()); // Filter and store all Wave handlers into the wave // They will be removed from the list when they are handled in order to know if there is any handler left before wave.setWaveHandlers(ws.getWaveHandlers().stream().filter(wh -> wh.check(wave)).collect(Collectors.toList())); // For each object interested in that wave type, process the action // Make a defensive copy to protect from concurrent modification exception when the wavehandler will be removed from list for (final WaveHandler waveHandler : new ArrayList<>(wave.getWaveHandlers())) { // The handler will be performed in the right thread according to RunType annotation waveHandler.handle(wave); } } else { LOGGER.warn(NO_WAVE_LISTENER, wave.waveType().toString()); if (CoreParameters.DEVELOPER_MODE.get()) { this.unprocessedWaveHandler.manageUnprocessedWave(NO_WAVE_LISTENER.getText(wave.waveType().toString()), wave); } } // The current wave will be marked as Handled when all Wave Handlers will be terminated // if(!wave.isRelated()){ // LOGGER.info(NOTIFIER_HANDLES, wave.toString()); // wave.status(Status.Handled); // } }
[ "private", "void", "processUndefinedWave", "(", "final", "Wave", "wave", ")", "throws", "WaveException", "{", "LOGGER", ".", "info", "(", "NOTIFIER_CONSUMES", ",", "wave", ".", "toString", "(", ")", ")", ";", "wave", ".", "status", "(", "Status", ".", "Consumed", ")", ";", "// Retrieve all interested object from the map", "if", "(", "this", ".", "notifierMap", ".", "containsKey", "(", "wave", ".", "waveType", "(", ")", ")", ")", "{", "final", "WaveSubscription", "ws", "=", "this", ".", "notifierMap", ".", "get", "(", "wave", ".", "waveType", "(", ")", ")", ";", "// Filter and store all Wave handlers into the wave", "// They will be removed from the list when they are handled in order to know if there is any handler left before", "wave", ".", "setWaveHandlers", "(", "ws", ".", "getWaveHandlers", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "wh", "->", "wh", ".", "check", "(", "wave", ")", ")", ".", "collect", "(", "Collectors", ".", "toList", "(", ")", ")", ")", ";", "// For each object interested in that wave type, process the action ", "// Make a defensive copy to protect from concurrent modification exception when the wavehandler will be removed from list", "for", "(", "final", "WaveHandler", "waveHandler", ":", "new", "ArrayList", "<>", "(", "wave", ".", "getWaveHandlers", "(", ")", ")", ")", "{", "// The handler will be performed in the right thread according to RunType annotation", "waveHandler", ".", "handle", "(", "wave", ")", ";", "}", "}", "else", "{", "LOGGER", ".", "warn", "(", "NO_WAVE_LISTENER", ",", "wave", ".", "waveType", "(", ")", ".", "toString", "(", ")", ")", ";", "if", "(", "CoreParameters", ".", "DEVELOPER_MODE", ".", "get", "(", ")", ")", "{", "this", ".", "unprocessedWaveHandler", ".", "manageUnprocessedWave", "(", "NO_WAVE_LISTENER", ".", "getText", "(", "wave", ".", "waveType", "(", ")", ".", "toString", "(", ")", ")", ",", "wave", ")", ";", "}", "}", "// The current wave will be marked as Handled when all Wave Handlers will be terminated", "// if(!wave.isRelated()){", "// LOGGER.info(NOTIFIER_HANDLES, wave.toString());", "// wave.status(Status.Handled);", "// }", "}" ]
Dispatch a standard wave which could be handled by a custom method of the component. This method is called from the JIT (JRebirth Internal Thread)<br> @param wave the wave that contains all information @throws WaveException if wave dispatching fails
[ "Dispatch", "a", "standard", "wave", "which", "could", "be", "handled", "by", "a", "custom", "method", "of", "the", "component", "." ]
93f4fc087b83c73db540333b9686e97b4cec694d
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/link/NotifierBase.java#L253-L286
8,291
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/CheckerUtility.java
CheckerUtility.checkMethodSignature
public static boolean checkMethodSignature(final Method method, final List<WaveItem<?>> wParams) { boolean isCompliant = false; final Type[] mParams = method.getGenericParameterTypes(); if (wParams.isEmpty() && Wave.class.isAssignableFrom(ClassUtility.getClassFromType(mParams[0]))) { isCompliant = true; } else if (mParams.length - 1 == wParams.size()) { // Flag used to skip a method not compliant boolean skipMethod = false; // Check each parameter for (int i = 0; !skipMethod && i < mParams.length - 1 && !isCompliant; i++) { if (!ClassUtility.getClassFromType(mParams[i]).isAssignableFrom(ClassUtility.getClassFromType(wParams.get(i).type()))) { // This method has not the right parameters skipMethod = true; } if (i == mParams.length - 2 && Wave.class.isAssignableFrom(ClassUtility.getClassFromType(mParams[i + 1]))) { // This method is compliant with wave type isCompliant = true; } } } return isCompliant; }
java
public static boolean checkMethodSignature(final Method method, final List<WaveItem<?>> wParams) { boolean isCompliant = false; final Type[] mParams = method.getGenericParameterTypes(); if (wParams.isEmpty() && Wave.class.isAssignableFrom(ClassUtility.getClassFromType(mParams[0]))) { isCompliant = true; } else if (mParams.length - 1 == wParams.size()) { // Flag used to skip a method not compliant boolean skipMethod = false; // Check each parameter for (int i = 0; !skipMethod && i < mParams.length - 1 && !isCompliant; i++) { if (!ClassUtility.getClassFromType(mParams[i]).isAssignableFrom(ClassUtility.getClassFromType(wParams.get(i).type()))) { // This method has not the right parameters skipMethod = true; } if (i == mParams.length - 2 && Wave.class.isAssignableFrom(ClassUtility.getClassFromType(mParams[i + 1]))) { // This method is compliant with wave type isCompliant = true; } } } return isCompliant; }
[ "public", "static", "boolean", "checkMethodSignature", "(", "final", "Method", "method", ",", "final", "List", "<", "WaveItem", "<", "?", ">", ">", "wParams", ")", "{", "boolean", "isCompliant", "=", "false", ";", "final", "Type", "[", "]", "mParams", "=", "method", ".", "getGenericParameterTypes", "(", ")", ";", "if", "(", "wParams", ".", "isEmpty", "(", ")", "&&", "Wave", ".", "class", ".", "isAssignableFrom", "(", "ClassUtility", ".", "getClassFromType", "(", "mParams", "[", "0", "]", ")", ")", ")", "{", "isCompliant", "=", "true", ";", "}", "else", "if", "(", "mParams", ".", "length", "-", "1", "==", "wParams", ".", "size", "(", ")", ")", "{", "// Flag used to skip a method not compliant", "boolean", "skipMethod", "=", "false", ";", "// Check each parameter", "for", "(", "int", "i", "=", "0", ";", "!", "skipMethod", "&&", "i", "<", "mParams", ".", "length", "-", "1", "&&", "!", "isCompliant", ";", "i", "++", ")", "{", "if", "(", "!", "ClassUtility", ".", "getClassFromType", "(", "mParams", "[", "i", "]", ")", ".", "isAssignableFrom", "(", "ClassUtility", ".", "getClassFromType", "(", "wParams", ".", "get", "(", "i", ")", ".", "type", "(", ")", ")", ")", ")", "{", "// This method has not the right parameters", "skipMethod", "=", "true", ";", "}", "if", "(", "i", "==", "mParams", ".", "length", "-", "2", "&&", "Wave", ".", "class", ".", "isAssignableFrom", "(", "ClassUtility", ".", "getClassFromType", "(", "mParams", "[", "i", "+", "1", "]", ")", ")", ")", "{", "// This method is compliant with wave type", "isCompliant", "=", "true", ";", "}", "}", "}", "return", "isCompliant", ";", "}" ]
Compare method parameters with wave parameters. @param method the method to check @param wParams the wave parameters taht define the contract @return true if the method has the right signature
[ "Compare", "method", "parameters", "with", "wave", "parameters", "." ]
93f4fc087b83c73db540333b9686e97b4cec694d
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/CheckerUtility.java#L110-L135
8,292
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/Resources.java
Resources.create
public static ColorItem create(final ColorParams colorParams) { return ColorItemImpl.create().uid(colorIdGenerator.incrementAndGet()).set(colorParams); }
java
public static ColorItem create(final ColorParams colorParams) { return ColorItemImpl.create().uid(colorIdGenerator.incrementAndGet()).set(colorParams); }
[ "public", "static", "ColorItem", "create", "(", "final", "ColorParams", "colorParams", ")", "{", "return", "ColorItemImpl", ".", "create", "(", ")", ".", "uid", "(", "colorIdGenerator", ".", "incrementAndGet", "(", ")", ")", ".", "set", "(", "colorParams", ")", ";", "}" ]
Build a color item. @param colorParams the primitive values for the color @return a new fresh color item object
[ "Build", "a", "color", "item", "." ]
93f4fc087b83c73db540333b9686e97b4cec694d
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/Resources.java#L127-L129
8,293
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/Resources.java
Resources.create
public static FontItem create(final FontParams fontParams) { // Ensure that the uid will be unique at runtime return FontItemImpl.create().uid(fontIdGenerator.incrementAndGet()).set(fontParams); }
java
public static FontItem create(final FontParams fontParams) { // Ensure that the uid will be unique at runtime return FontItemImpl.create().uid(fontIdGenerator.incrementAndGet()).set(fontParams); }
[ "public", "static", "FontItem", "create", "(", "final", "FontParams", "fontParams", ")", "{", "// Ensure that the uid will be unique at runtime", "return", "FontItemImpl", ".", "create", "(", ")", ".", "uid", "(", "fontIdGenerator", ".", "incrementAndGet", "(", ")", ")", ".", "set", "(", "fontParams", ")", ";", "}" ]
Build a font item. Take care of the value used for ({@link CoreParameters#FONT_FOLDER}) which will be prepend to the font path. @param fontParams the primitive values for the font @return a new fresh font item object
[ "Build", "a", "font", "item", "." ]
93f4fc087b83c73db540333b9686e97b4cec694d
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/Resources.java#L144-L147
8,294
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/Resources.java
Resources.create
public static ImageItem create(final ImageParams imageParams) { // Ensure that the uid will be unique at runtime return ImageItemImpl.create().uid(imageIdGenerator.incrementAndGet()).set(imageParams); }
java
public static ImageItem create(final ImageParams imageParams) { // Ensure that the uid will be unique at runtime return ImageItemImpl.create().uid(imageIdGenerator.incrementAndGet()).set(imageParams); }
[ "public", "static", "ImageItem", "create", "(", "final", "ImageParams", "imageParams", ")", "{", "// Ensure that the uid will be unique at runtime", "return", "ImageItemImpl", ".", "create", "(", ")", ".", "uid", "(", "imageIdGenerator", ".", "incrementAndGet", "(", ")", ")", ".", "set", "(", "imageParams", ")", ";", "}" ]
Build an image item. Take care of the value used for ({@link CoreParameters#IMAGE_FOLDER}) which will be prepend to the image path. @param imageParams the primitive values for the image @return a new fresh image item object
[ "Build", "an", "image", "item", "." ]
93f4fc087b83c73db540333b9686e97b4cec694d
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/Resources.java#L162-L165
8,295
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/Resources.java
Resources.create
public static StyleSheetItem create(final StyleSheetParams styleSheetParams) { // Ensure that the uid will be unique at runtime return StyleSheetItemImpl.create().uid(styleSheetIdGenerator.incrementAndGet()).set(styleSheetParams); }
java
public static StyleSheetItem create(final StyleSheetParams styleSheetParams) { // Ensure that the uid will be unique at runtime return StyleSheetItemImpl.create().uid(styleSheetIdGenerator.incrementAndGet()).set(styleSheetParams); }
[ "public", "static", "StyleSheetItem", "create", "(", "final", "StyleSheetParams", "styleSheetParams", ")", "{", "// Ensure that the uid will be unique at runtime", "return", "StyleSheetItemImpl", ".", "create", "(", ")", ".", "uid", "(", "styleSheetIdGenerator", ".", "incrementAndGet", "(", ")", ")", ".", "set", "(", "styleSheetParams", ")", ";", "}" ]
Build a style sheet item. Take care of the value used for ({@link CoreParameters#STYLE_FOLDER}) which will be prepend to the style sheet path. @param styleSheetParams the primitive values for the style sheet @return a new fresh file
[ "Build", "a", "style", "sheet", "item", "." ]
93f4fc087b83c73db540333b9686e97b4cec694d
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/Resources.java#L180-L183
8,296
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/Resources.java
Resources.create
public static FXMLItem create(final FXMLParams fxmlParams) { // Ensure that the uid will be unique at runtime return FXMLItemImpl.create(true).uid(fxmlIdGenerator.incrementAndGet()).set(fxmlParams); }
java
public static FXMLItem create(final FXMLParams fxmlParams) { // Ensure that the uid will be unique at runtime return FXMLItemImpl.create(true).uid(fxmlIdGenerator.incrementAndGet()).set(fxmlParams); }
[ "public", "static", "FXMLItem", "create", "(", "final", "FXMLParams", "fxmlParams", ")", "{", "// Ensure that the uid will be unique at runtime", "return", "FXMLItemImpl", ".", "create", "(", "true", ")", ".", "uid", "(", "fxmlIdGenerator", ".", "incrementAndGet", "(", ")", ")", ".", "set", "(", "fxmlParams", ")", ";", "}" ]
Build a Singleton FXML item. Each call to FXMLItem.get() will return the same FXML Component instance @param fxmlParams the primitive values for the fxml resource @return a new fresh FXML item
[ "Build", "a", "Singleton", "FXML", "item", "." ]
93f4fc087b83c73db540333b9686e97b4cec694d
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/Resources.java#L198-L201
8,297
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/Resources.java
Resources.create
public static MessageItem create(final Message messageParams) { // Ensure that the uid will be unique at runtime return MessageItemImpl.create().uid(messageIdGenerator.incrementAndGet()).set(messageParams); }
java
public static MessageItem create(final Message messageParams) { // Ensure that the uid will be unique at runtime return MessageItemImpl.create().uid(messageIdGenerator.incrementAndGet()).set(messageParams); }
[ "public", "static", "MessageItem", "create", "(", "final", "Message", "messageParams", ")", "{", "// Ensure that the uid will be unique at runtime", "return", "MessageItemImpl", ".", "create", "(", ")", ".", "uid", "(", "messageIdGenerator", ".", "incrementAndGet", "(", ")", ")", ".", "set", "(", "messageParams", ")", ";", "}" ]
Build a Message item. @param messageParams the key of the i18n message @return a new fresh Message item
[ "Build", "a", "Message", "item", "." ]
93f4fc087b83c73db540333b9686e97b4cec694d
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/Resources.java#L227-L230
8,298
JRebirth/JRebirth
org.jrebirth.af/component/src/main/java/org/jrebirth/af/component/ui/tab/TabbedPaneController.java
TabbedPaneController.initTabEventHandler
void initTabEventHandler(final ToggleButton tabButton) { try { tabButton.setOnDragDetected(getHandler(MouseEvent.DRAG_DETECTED)); tabButton.setOnAction(getHandler(ActionEvent.ACTION)); } catch (final CoreException ce) { LOGGER.error("Error while attaching event handler", ce); } }
java
void initTabEventHandler(final ToggleButton tabButton) { try { tabButton.setOnDragDetected(getHandler(MouseEvent.DRAG_DETECTED)); tabButton.setOnAction(getHandler(ActionEvent.ACTION)); } catch (final CoreException ce) { LOGGER.error("Error while attaching event handler", ce); } }
[ "void", "initTabEventHandler", "(", "final", "ToggleButton", "tabButton", ")", "{", "try", "{", "tabButton", ".", "setOnDragDetected", "(", "getHandler", "(", "MouseEvent", ".", "DRAG_DETECTED", ")", ")", ";", "tabButton", ".", "setOnAction", "(", "getHandler", "(", "ActionEvent", ".", "ACTION", ")", ")", ";", "}", "catch", "(", "final", "CoreException", "ce", ")", "{", "LOGGER", ".", "error", "(", "\"Error while attaching event handler\"", ",", "ce", ")", ";", "}", "}" ]
Inits the tab event handler. @param tabButton the tab button
[ "Inits", "the", "tab", "event", "handler", "." ]
93f4fc087b83c73db540333b9686e97b4cec694d
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/component/src/main/java/org/jrebirth/af/component/ui/tab/TabbedPaneController.java#L80-L89
8,299
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ParameterUtility.java
ParameterUtility.buildCustomizableClass
public static <D extends Object> Object buildCustomizableClass(final ParameterItem<Class<?>> parameter, final Class<D> defaultObject, final Class<?> interfaceClass) { Object object = null; try { object = parameter.get().newInstance(); } catch (InstantiationException | IllegalAccessException e) { LOGGER.error(CUSTOM_CLASS_LOADING_ERROR, e, interfaceClass.getSimpleName()); try { object = defaultObject.newInstance(); } catch (InstantiationException | IllegalAccessException e2) { throw new CoreRuntimeException("Impossible to build Default " + interfaceClass.getSimpleName(), e2); } } return object; }
java
public static <D extends Object> Object buildCustomizableClass(final ParameterItem<Class<?>> parameter, final Class<D> defaultObject, final Class<?> interfaceClass) { Object object = null; try { object = parameter.get().newInstance(); } catch (InstantiationException | IllegalAccessException e) { LOGGER.error(CUSTOM_CLASS_LOADING_ERROR, e, interfaceClass.getSimpleName()); try { object = defaultObject.newInstance(); } catch (InstantiationException | IllegalAccessException e2) { throw new CoreRuntimeException("Impossible to build Default " + interfaceClass.getSimpleName(), e2); } } return object; }
[ "public", "static", "<", "D", "extends", "Object", ">", "Object", "buildCustomizableClass", "(", "final", "ParameterItem", "<", "Class", "<", "?", ">", ">", "parameter", ",", "final", "Class", "<", "D", ">", "defaultObject", ",", "final", "Class", "<", "?", ">", "interfaceClass", ")", "{", "Object", "object", "=", "null", ";", "try", "{", "object", "=", "parameter", ".", "get", "(", ")", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "InstantiationException", "|", "IllegalAccessException", "e", ")", "{", "LOGGER", ".", "error", "(", "CUSTOM_CLASS_LOADING_ERROR", ",", "e", ",", "interfaceClass", ".", "getSimpleName", "(", ")", ")", ";", "try", "{", "object", "=", "defaultObject", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "InstantiationException", "|", "IllegalAccessException", "e2", ")", "{", "throw", "new", "CoreRuntimeException", "(", "\"Impossible to build Default \"", "+", "interfaceClass", ".", "getSimpleName", "(", ")", ",", "e2", ")", ";", "}", "}", "return", "object", ";", "}" ]
Build a customizable class. @param parameter The parameter class to load @param defaultObject the default object class to use as fallback @param interfaceClass the interface that the wanted type shall implement (for log purpose) @param <D> the type wanted @return a new instance of the generic type
[ "Build", "a", "customizable", "class", "." ]
93f4fc087b83c73db540333b9686e97b4cec694d
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ParameterUtility.java#L55-L68