Search in sources :

Example 6 with Integer

use of java.lang.Integer in project LoganSquare by bluelinelabs.

the class SimpleCollectionModel$$JsonObjectMapper method parseField.

@Override
public void parseField(SimpleCollectionModel instance, String fieldName, JsonParser jsonParser) throws IOException {
    if ("model_array".equals(fieldName)) {
        if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
            List<SimpleCollectionModel.ModelForCollection> collection1 = new ArrayList<SimpleCollectionModel.ModelForCollection>();
            while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
                SimpleCollectionModel.ModelForCollection value1;
                value1 = COM_BLUELINELABS_LOGANSQUARE_PROCESSOR_SIMPLECOLLECTIONMODEL_MODELFORCOLLECTION__JSONOBJECTMAPPER.parse(jsonParser);
                collection1.add(value1);
            }
            SimpleCollectionModel.ModelForCollection[] array = collection1.toArray(new SimpleCollectionModel.ModelForCollection[collection1.size()]);
            instance.modelForCollectionArray = array;
        } else {
            instance.modelForCollectionArray = null;
        }
    } else if ("model_array_list".equals(fieldName)) {
        if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
            ArrayList<SimpleCollectionModel.ModelForCollection> collection1 = new ArrayList<SimpleCollectionModel.ModelForCollection>();
            while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
                SimpleCollectionModel.ModelForCollection value1;
                value1 = COM_BLUELINELABS_LOGANSQUARE_PROCESSOR_SIMPLECOLLECTIONMODEL_MODELFORCOLLECTION__JSONOBJECTMAPPER.parse(jsonParser);
                collection1.add(value1);
            }
            instance.modelForCollectionArrayList = collection1;
        } else {
            instance.modelForCollectionArrayList = null;
        }
    } else if ("model_deque".equals(fieldName)) {
        if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
            ArrayDeque<SimpleCollectionModel.ModelForCollection> collection1 = new ArrayDeque<SimpleCollectionModel.ModelForCollection>();
            while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
                SimpleCollectionModel.ModelForCollection value1;
                value1 = COM_BLUELINELABS_LOGANSQUARE_PROCESSOR_SIMPLECOLLECTIONMODEL_MODELFORCOLLECTION__JSONOBJECTMAPPER.parse(jsonParser);
                collection1.add(value1);
            }
            instance.modelForCollectionDeque = collection1;
        } else {
            instance.modelForCollectionDeque = null;
        }
    } else if ("model_hash_map".equals(fieldName)) {
        if (jsonParser.getCurrentToken() == JsonToken.START_OBJECT) {
            HashMap<String, SimpleCollectionModel.ModelForCollection> map1 = new HashMap<String, SimpleCollectionModel.ModelForCollection>();
            while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
                String key1 = jsonParser.getText();
                jsonParser.nextToken();
                if (jsonParser.getCurrentToken() == JsonToken.VALUE_NULL) {
                    map1.put(key1, null);
                } else {
                    map1.put(key1, COM_BLUELINELABS_LOGANSQUARE_PROCESSOR_SIMPLECOLLECTIONMODEL_MODELFORCOLLECTION__JSONOBJECTMAPPER.parse(jsonParser));
                }
            }
            instance.modelForCollectionHashMap = map1;
        } else {
            instance.modelForCollectionHashMap = null;
        }
    } else if ("model_linked_hash_map".equals(fieldName)) {
        if (jsonParser.getCurrentToken() == JsonToken.START_OBJECT) {
            LinkedHashMap<String, SimpleCollectionModel.ModelForCollection> map1 = new LinkedHashMap<String, SimpleCollectionModel.ModelForCollection>();
            while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
                String key1 = jsonParser.getText();
                jsonParser.nextToken();
                if (jsonParser.getCurrentToken() == JsonToken.VALUE_NULL) {
                    map1.put(key1, null);
                } else {
                    map1.put(key1, COM_BLUELINELABS_LOGANSQUARE_PROCESSOR_SIMPLECOLLECTIONMODEL_MODELFORCOLLECTION__JSONOBJECTMAPPER.parse(jsonParser));
                }
            }
            instance.modelForCollectionLinkedHashMap = map1;
        } else {
            instance.modelForCollectionLinkedHashMap = null;
        }
    } else if ("model_linked_list".equals(fieldName)) {
        if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
            LinkedList<SimpleCollectionModel.ModelForCollection> collection1 = new LinkedList<SimpleCollectionModel.ModelForCollection>();
            while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
                SimpleCollectionModel.ModelForCollection value1;
                value1 = COM_BLUELINELABS_LOGANSQUARE_PROCESSOR_SIMPLECOLLECTIONMODEL_MODELFORCOLLECTION__JSONOBJECTMAPPER.parse(jsonParser);
                collection1.add(value1);
            }
            instance.modelForCollectionLinkedList = collection1;
        } else {
            instance.modelForCollectionLinkedList = null;
        }
    } else if ("model_list".equals(fieldName)) {
        if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
            ArrayList<SimpleCollectionModel.ModelForCollection> collection1 = new ArrayList<SimpleCollectionModel.ModelForCollection>();
            while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
                SimpleCollectionModel.ModelForCollection value1;
                value1 = COM_BLUELINELABS_LOGANSQUARE_PROCESSOR_SIMPLECOLLECTIONMODEL_MODELFORCOLLECTION__JSONOBJECTMAPPER.parse(jsonParser);
                collection1.add(value1);
            }
            instance.modelForCollectionList = collection1;
        } else {
            instance.modelForCollectionList = null;
        }
    } else if ("model_map".equals(fieldName)) {
        if (jsonParser.getCurrentToken() == JsonToken.START_OBJECT) {
            HashMap<String, SimpleCollectionModel.ModelForCollection> map1 = new HashMap<String, SimpleCollectionModel.ModelForCollection>();
            while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
                String key1 = jsonParser.getText();
                jsonParser.nextToken();
                if (jsonParser.getCurrentToken() == JsonToken.VALUE_NULL) {
                    map1.put(key1, null);
                } else {
                    map1.put(key1, COM_BLUELINELABS_LOGANSQUARE_PROCESSOR_SIMPLECOLLECTIONMODEL_MODELFORCOLLECTION__JSONOBJECTMAPPER.parse(jsonParser));
                }
            }
            instance.modelForCollectionMap = map1;
        } else {
            instance.modelForCollectionMap = null;
        }
    } else if ("model_queue".equals(fieldName)) {
        if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
            ArrayDeque<SimpleCollectionModel.ModelForCollection> collection1 = new ArrayDeque<SimpleCollectionModel.ModelForCollection>();
            while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
                SimpleCollectionModel.ModelForCollection value1;
                value1 = COM_BLUELINELABS_LOGANSQUARE_PROCESSOR_SIMPLECOLLECTIONMODEL_MODELFORCOLLECTION__JSONOBJECTMAPPER.parse(jsonParser);
                collection1.add(value1);
            }
            instance.modelForCollectionQueue = collection1;
        } else {
            instance.modelForCollectionQueue = null;
        }
    } else if ("model_set".equals(fieldName)) {
        if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
            HashSet<SimpleCollectionModel.ModelForCollection> collection1 = new HashSet<SimpleCollectionModel.ModelForCollection>();
            while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
                SimpleCollectionModel.ModelForCollection value1;
                value1 = COM_BLUELINELABS_LOGANSQUARE_PROCESSOR_SIMPLECOLLECTIONMODEL_MODELFORCOLLECTION__JSONOBJECTMAPPER.parse(jsonParser);
                collection1.add(value1);
            }
            instance.modelForCollectionSet = collection1;
        } else {
            instance.modelForCollectionSet = null;
        }
    } else if ("model_tree_map".equals(fieldName)) {
        if (jsonParser.getCurrentToken() == JsonToken.START_OBJECT) {
            TreeMap<String, SimpleCollectionModel.ModelForCollection> map1 = new TreeMap<String, SimpleCollectionModel.ModelForCollection>();
            while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
                String key1 = jsonParser.getText();
                jsonParser.nextToken();
                if (jsonParser.getCurrentToken() == JsonToken.VALUE_NULL) {
                    map1.put(key1, null);
                } else {
                    map1.put(key1, COM_BLUELINELABS_LOGANSQUARE_PROCESSOR_SIMPLECOLLECTIONMODEL_MODELFORCOLLECTION__JSONOBJECTMAPPER.parse(jsonParser));
                }
            }
            instance.modelForCollectionTreeMap = map1;
        } else {
            instance.modelForCollectionTreeMap = null;
        }
    } else if ("primitive_array".equals(fieldName)) {
        if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
            List<Integer> collection1 = new ArrayList<Integer>();
            while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
                collection1.add(jsonParser.getValueAsInt());
            }
            int[] array = new int[collection1.size()];
            int i = 0;
            for (int value : collection1) {
                array[i++] = value;
            }
            instance.primitiveArray = array;
        } else {
            instance.primitiveArray = null;
        }
    }
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ArrayList(java.util.ArrayList) String(java.lang.String) TreeMap(java.util.TreeMap) ArrayDeque(java.util.ArrayDeque) LinkedList(java.util.LinkedList) LinkedHashMap(java.util.LinkedHashMap) Integer(java.lang.Integer) ArrayList(java.util.ArrayList) List(java.util.List) LinkedList(java.util.LinkedList) HashSet(java.util.HashSet) Override(java.lang.Override)

Example 7 with Integer

use of java.lang.Integer in project geode by apache.

the class PRQueryProcessor method buildCallableTaskList.

private List buildCallableTaskList(Collection<Collection> resultsColl) {
    List callableTasks = new ArrayList();
    for (Iterator itr = _bucketsToQuery.iterator(); itr.hasNext(); ) {
        Integer bId = (Integer) itr.next();
        callableTasks.add(new QueryTask(this.query, this.parameters, _prds, bId, resultsColl));
    }
    return callableTasks;
}
Also used : Integer(java.lang.Integer) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List)

Example 8 with Integer

use of java.lang.Integer in project geode by apache.

the class PRQueryProcessor method executeSequentially.

private void executeSequentially(Collection<Collection> resultCollector, List buckets) throws QueryException, InterruptedException, ForceReattemptException {
    /*
     * for (Iterator itr = _bucketsToQuery.iterator(); itr.hasNext(); ) { Integer bId =
     * (Integer)itr.next(); doBucketQuery(bId, this._prds, this.query, this.parameters,
     * resultCollector); }
     */
    ExecutionContext context = new QueryExecutionContext(this.parameters, this.pr.getCache(), this.query);
    CompiledSelect cs = this.query.getSimpleSelect();
    int limit = this.query.getLimit(parameters);
    if (cs != null && cs.isOrderBy()) {
        for (Integer bucketID : this._bucketsToQuery) {
            List<Integer> singleBucket = Collections.singletonList(bucketID);
            context.setBucketList(singleBucket);
            executeQueryOnBuckets(resultCollector, context);
        }
        Collection mergedResults = coalesceOrderedResults(resultCollector, context, cs, limit);
        resultCollector.clear();
        resultCollector.add(mergedResults);
    } else {
        context.setBucketList(buckets);
        executeQueryOnBuckets(resultCollector, context);
    }
}
Also used : Integer(java.lang.Integer) ExecutionContext(org.apache.geode.cache.query.internal.ExecutionContext) QueryExecutionContext(org.apache.geode.cache.query.internal.QueryExecutionContext) QueryExecutionContext(org.apache.geode.cache.query.internal.QueryExecutionContext) CompiledSelect(org.apache.geode.cache.query.internal.CompiledSelect) Collection(java.util.Collection)

Example 9 with Integer

use of java.lang.Integer in project geode by apache.

the class TypeRegistry method defineEnum.

public int defineEnum(EnumInfo newInfo) {
    Integer existingId = this.enumInfoToId.get(newInfo);
    if (existingId != null) {
        return existingId;
    }
    int id = this.distributedTypeRegistry.defineEnum(newInfo);
    EnumInfo oldInfo = this.idToEnum.get(id);
    if (oldInfo == null) {
        this.idToEnum.put(id, newInfo);
        this.enumInfoToId.put(newInfo, id);
        if (logger.isInfoEnabled()) {
            logger.info("Caching PDX Enum: {}, dsid={} typenum={}", newInfo, id >> 24, id & 0xFFFFFF);
        }
    } else if (!oldInfo.equals(newInfo)) {
        Assert.fail("Old enum does not equal new enum for the same id. oldEnum=" + oldInfo + " newEnum=" + newInfo);
    }
    return id;
}
Also used : Integer(java.lang.Integer)

Example 10 with Integer

use of java.lang.Integer in project geode by apache.

the class TypeRegistry method getEnumId.

/**
   * Given an enum compute and return a code for it.
   */
public int getEnumId(Enum<?> v) {
    int result = 0;
    if (v != null) {
        Integer id = this.localEnumIds.get(v);
        if (id != null) {
            result = id;
        } else {
            result = this.distributedTypeRegistry.getEnumId(v);
            id = valueOf(result);
            this.localEnumIds.put(v, id);
            EnumInfo ei = new EnumInfo(v);
            this.idToEnum.put(id, ei);
            this.enumInfoToId.put(ei, id);
        }
    }
    return result;
}
Also used : Integer(java.lang.Integer)

Aggregations

Integer (java.lang.Integer)19 Double (java.lang.Double)9 Float (java.lang.Float)9 Override (java.lang.Override)9 Short (java.lang.Short)9 NonNull (android.support.annotation.NonNull)8 Boolean (java.lang.Boolean)8 Long (java.lang.Long)8 ArrayList (java.util.ArrayList)2 List (java.util.List)2 IllegalArgumentException (java.lang.IllegalArgumentException)1 String (java.lang.String)1 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayDeque (java.util.ArrayDeque)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 LinkedHashMap (java.util.LinkedHashMap)1 LinkedList (java.util.LinkedList)1