Java Code Examples for org.eclipse.collections.impl.list.mutable.FastList#newList()
The following examples show how to use
org.eclipse.collections.impl.list.mutable.FastList#newList() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MithraTestResource.java From reladomo with Apache License 2.0 | 6 votes |
private void setUpPortals() { Map<String, MithraObjectPortal> allPortals = UnifiedMap.newMap(); for (MithraRuntimeConfig config : this.mithraRuntimeList) { for (MithraObjectPortal portal : config.getObjectPortals()) { String key = portal.getFinder().getFinderClassName(); MithraObjectPortal existingPortal = allPortals.get(key); if (this.validateConnectionManagers && (existingPortal != null && !portalsHaveSameConnectionManager(portal, existingPortal))) { throw new IllegalStateException(key + " must use same connection managers in all configurations"); } allPortals.put(key, portal); } } this.portals = FastList.newList(allPortals.values()); }
Example 2
Source File: CacheReplicationTestCase.java From reladomo with Apache License 2.0 | 6 votes |
public void serverTestDeleteInsert() { forceGC(); List<BitemporalOrderData> insertList = FastList.newList(11111); for(int i=0;i<11111;i++) { insertList.add(createBigOrder(i + 300000)); } List<BitemporalOrderData> deleteList = FastList.newList(11111); for(int i=1503;i<102000;i+=2048) { BitemporalOrderData order = createBigOrder(i); deleteList.add(order); } MithraRuntimeCacheController cc = new MithraRuntimeCacheController(BitemporalOrderFinder.class); cc.getMithraObjectPortal().getCache().updateCache(insertList, Collections.EMPTY_LIST, deleteList); System.out.println("deleted/inserted objects on master"); }
Example 3
Source File: AsOfEqualityChecker.java From reladomo with Apache License 2.0 | 6 votes |
public TupleTempContext getOrCreateMultiInTempContext(MultiInOperation op) { if (this.multiInTempContexts == null) { this.multiInTempContexts = FastList.newList(2); return createAndAddTempContext(op); } for(int i=0;i<multiInTempContexts.size();i++) { Pair<MultiInOperation, TupleTempContext> tupleTempContextPair = multiInTempContexts.get(i); if (tupleTempContextPair.getOne() == op) { return tupleTempContextPair.getTwo(); } } return createAndAddTempContext(op); }
Example 4
Source File: CacheReplicationTestCase.java From reladomo with Apache License 2.0 | 6 votes |
public void serverTestUpdate() { List<BitemporalOrderData> updateList = FastList.newList(11111); for(int i=1500;i<102000;i+=2048) { BitemporalOrderData order = createBigOrder(i); order.setUserId(i + 20000000); updateList.add(order); } MithraRuntimeCacheController cc = new MithraRuntimeCacheController(BitemporalOrderFinder.class); cc.getMithraObjectPortal().getCache().updateCache(Collections.EMPTY_LIST, updateList, Collections.EMPTY_LIST); BitemporalOrderStatusFinder.getMithraObjectPortal().setLatestRefreshTime(7890); BitemporalOrderItemFinder.getMithraObjectPortal().setLatestRefreshTime(44455566); BitemporalOrderFinder.getMithraObjectPortal().setLatestRefreshTime(999000111); System.out.println("updated objects on master"); }
Example 5
Source File: ReladomoDeserializer.java From reladomo with Apache License 2.0 | 6 votes |
protected void addSingleObjectToResolve() throws DeserializationException { AsOfAttribute businessDateAttribute = this.data.metaData.getBusinessDateAttribute(); if (businessDateAttribute != null && this.data.partial.businessDate == null && businessDateAttribute.getDefaultDate() == null) { throw new DeserializationException("Business date must be supplied for "+this.data.partial.dataObject.zGetPrintablePrimaryKey()); } DeserializationClassMetaData key = this.data.metaData; List<PartialDeserialized> partialDeserializeds = objectsToResolve.get(key); if (partialDeserializeds == null) { partialDeserializeds = FastList.newList(); objectsToResolve.put(this.data.metaData, partialDeserializeds); } partialDeserializeds.add(this.data.partial); }
Example 6
Source File: AbstractLoaderFactory.java From reladomo with Apache License 2.0 | 6 votes |
public List<String> getParamValuesNamed(String name) { List list = FastList.newList(); if (this.params != null) { for (ConfigParameter each : this.params) { if (name.equals(each.getKey())) { list.add(each.getValue()); } } } return list; }
Example 7
Source File: PartialSemiUniqueDatedIndex.java From reladomo with Apache License 2.0 | 5 votes |
@Override public List<Object> collectMilestoningOverlaps() { List<Object> duplicateData = FastList.newList(); for (SemiUniqueEntry obj : nonDatedTable) { collectMilestoningOverlaps(duplicateData, obj); } return duplicateData; }
Example 8
Source File: DeepFetchNode.java From reladomo with Apache License 2.0 | 5 votes |
private List filterParentWithNullsOrFilters(Attribute[] arrayAttributes, List parentList) { List result = null; for(int i=0;i<parentList.size();i++) { Object o = parentList.get(i); boolean mustFilter = false; for (Attribute a : arrayAttributes) { mustFilter = a.isAttributeNull(o); if (mustFilter) { if (result == null) { result = FastList.newList(parentList.size()); result.addAll(parentList.subList(0, i)); } break; } } if (!mustFilter && result != null) { result.add(o); } } return result == null ? parentList : result; }
Example 9
Source File: TestDeDupedDualMessagingAdapter.java From reladomo with Apache License 2.0 | 5 votes |
@Test public void testDeDupe() { UnifiedSet<String> messageSet1 = UnifiedSet.newSetWith("msg1", "msg2", "msg3"); UnifiedSet<String> messageSet2 = UnifiedSet.newSetWith("msg4"); UnifiedSet<String> messageSet3 = UnifiedSet.newSetWith("msg5"); //simulate message consumption by injecting messages into the adapter //set1 is consumed by both the the adapters factory1.getAdapter().inject(messageSet1); factory2.getAdapter().inject(messageSet1); //set2 is consumed just by adapter1 factory1.getAdapter().inject(messageSet2); //set3 is consumed just by adapter2 factory2.getAdapter().inject(messageSet3); //the actual event handler gets a unique set FastList<String> expectedMessages = FastList.newList(); expectedMessages.addAll(messageSet1); expectedMessages.addAll(messageSet2); expectedMessages.addAll(messageSet3); List<MessageWithSubject> receivedMessages = recordingHandler.getMessages(); UnifiedSet<String> receivedMessageSubjects = UnifiedSet.newSet(); UnifiedSet<String> receivedMessageBodies = UnifiedSet.newSet(); for (MessageWithSubject pair : receivedMessages) { receivedMessageSubjects.add(pair.getSubject()); receivedMessageBodies.add(new String(pair.getMessage())); } assertTrue(receivedMessageBodies.containsAll(expectedMessages)); assertEquals(1, receivedMessageSubjects.size()); assertEquals(TEST_SUBJECT, receivedMessageSubjects.getFirst()); }
Example 10
Source File: TopLevelMergeOptions.java From reladomo with Apache License 2.0 | 5 votes |
private void ensureDependent(AbstractRelatedFinder arf) { DeepRelationshipAttribute parentAttribute = arf.getParentDeepRelationshipAttribute(); RelatedFinder finderInstance = this.getMetaData().getFinderInstance(); if (parentAttribute == null) { if (!finderInstance.getDependentRelationshipFinders().contains(arf)) { throw new MithraBusinessException("Can only navigate to dependent relationships! "+arf.getRelationshipName()+" is not a dependent"); } } FastList<AbstractRelatedFinder> list = FastList.newList(4); list.add(arf); while(parentAttribute != null) { list.add((AbstractRelatedFinder) parentAttribute); parentAttribute = parentAttribute.getParentDeepRelationshipAttribute(); } for(int i=list.size() - 1; i >=0; i--) { AbstractRelatedFinder child = list.get(i); if (!finderInstance.getDependentRelationshipFinders().contains(child)) { throw new MithraBusinessException("Can only navigate to dependent relationships! "+ child.getRelationshipName()+" is not a dependent"); } finderInstance = child; } }
Example 11
Source File: XAConnectionPoolingDataSource.java From reladomo with Apache License 2.0 | 5 votes |
@Override public void addPostTransactionAction(PostTransactionAction action) { if (postTransactionActions == null) { postTransactionActions = FastList.newList(); } postTransactionActions.add(action); }
Example 12
Source File: ReladomoDeserializer.java From reladomo with Apache License 2.0 | 5 votes |
protected void wireRelationshipsForList(DeserializationClassMetaData metaData, List<PartialDeserialized> list) throws DeserializationException { if (list.size() > 0) { List<PartialDeserialized> detached = FastList.newList(list.size()); for (int i = 0; i < list.size(); i++) { PartialDeserialized partialDeserialized = list.get(i); switch (partialDeserialized.deserializedState) { case ReladomoSerializationContext.DELETED_OR_TERMINATED_STATE: case ReladomoSerializationContext.READ_ONLY_STATE: //do nothing for these break; case ReladomoSerializationContext.IN_MEMORY_STATE: wireRelationshipsForInMemory(metaData, partialDeserialized); break; case ReladomoSerializationContext.DETACHED_STATE: if (partialDeserialized.partialRelationships != EMPTY_MAP) { detached.add(partialDeserialized); } break; } } if (!detached.isEmpty()) { wireRelationshipsForDetached(metaData, detached); } } }
Example 13
Source File: SerializationNode.java From reladomo with Apache License 2.0 | 5 votes |
private static FastList<Attribute> unwrapAttributes(Attribute[] persistentAttributes) { FastList<Attribute> list = FastList.newList(persistentAttributes.length); for(Attribute a: persistentAttributes) { list.add(unwrapAttribute(a)); } return list; }
Example 14
Source File: CacheReplicationTestCase.java From reladomo with Apache License 2.0 | 5 votes |
public void serverCreateObjectsInNewPages() { MithraRuntimeCacheController cc = new MithraRuntimeCacheController(BitemporalOrderStatusFinder.class); // Create a medium amount of data using brand new IDs. Provided the data created by serverMakeNewEmptyPages() has not yet been evicted, our data should be added at the end in a brand new page. List<BitemporalOrderStatusData> newOrders = FastList.newList(); for(int i=2000000;i<2050000;i++) { BitemporalOrderStatusData order = createOrderStatus(i + 1000); newOrders.add(order); } cc.getMithraObjectPortal().getCache().updateCache(FastList.newList(newOrders), Collections.EMPTY_LIST, Collections.EMPTY_LIST); // wrap the list as it may get modified System.out.println("Created objects in brand new pages at the end of the storage buffer"); System.out.flush(); }
Example 15
Source File: MilestoneRectangle.java From reladomo with Apache License 2.0 | 5 votes |
public static List<MithraDatedObject> mergeObjects(List<? extends MithraDatedObject> newObjectList, List<? extends MithraDatedObject> existingObjectList, RelatedFinder finder) { List<MilestoneRectangle> dataToMerge = FastList.newList(); addRectanglesFromObjects(newObjectList, finder, dataToMerge); addRectanglesFromObjects(existingObjectList, finder, dataToMerge); return toMithraObjects(finder, merge(dataToMerge)); }
Example 16
Source File: MilestoneRectangle.java From reladomo with Apache License 2.0 | 5 votes |
public static void merge(Object newObjectOrList, Object existingObjectOrList, RelatedFinder finder, List<MithraDataObject> mergedData) { List<MilestoneRectangle> dataToMerge = FastList.newList(); addRectangles(newObjectOrList, finder, dataToMerge); addRectangles(existingObjectOrList, finder, dataToMerge); mergedData.addAll(toMithraData(finder, merge(dataToMerge))); }
Example 17
Source File: FileUtilsCobra.java From obevo with Apache License 2.0 | 5 votes |
public static MutableList<String> readLines(File file) { try { return FastList.newList(FileUtils.readLines(file)); } catch (IOException e) { throw new IllegalArgumentException(e); } }
Example 18
Source File: OffHeapSemiUniqueDatedIndex.java From reladomo with Apache License 2.0 | 4 votes |
public DetectDuplicateTask(ArrayBasedQueue queue) { this.queue = queue; this.duplicates = FastList.newList(); }
Example 19
Source File: ReladomoDeserializer.java From reladomo with Apache License 2.0 | 4 votes |
protected void resolveList(DeserializationClassMetaData metaData, List<PartialDeserialized> listToResolve) throws DeserializationException { List<PartialDeserialized> dbLookUp = FastList.newList(listToResolve.size()); for(PartialDeserialized partDes: listToResolve) { switch (partDes.state) { case 0: // not set case ReladomoSerializationContext.READ_ONLY_STATE: case ReladomoSerializationContext.DETACHED_STATE: case ReladomoSerializationContext.DELETED_OR_TERMINATED_STATE: dbLookUp.add(partDes); break; case ReladomoSerializationContext.IN_MEMORY_STATE: handleInMemoryObject(partDes, metaData); break; } } if (!dbLookUp.isEmpty()) { RelatedFinder finder = metaData.getRelatedFinder(); Attribute[] pkAttributesNoSource = metaData.getPrimaryKeyAttributesWithoutSource(); Attribute sourceAttribute = metaData.getSourceAttribute(); AsOfAttribute[] asOfAttributes = finder.getAsOfAttributes(); if (asOfAttributes != null || sourceAttribute != null) { List<List<PartialDeserialized>> segregated = segregateByAsOfAndSourceAttribute(metaData, dbLookUp); for (int i = 0; i < segregated.size(); i++) { List<PartialDeserialized> list = segregated.get(i); Operation segOp = NoOperation.instance(); PartialDeserialized first = list.get(0); if (sourceAttribute != null) { if (!first.isAttributeSet(sourceAttribute, metaData)) { handleUnresolvableObjects(list, metaData); break; // can't be resolved. } segOp = segOp.and(sourceAttribute.nonPrimitiveEq(sourceAttribute.valueOf(first.dataObject))); } if (metaData.getBusinessDateAttribute() != null && first.businessDate != null) { segOp = segOp.and(metaData.getBusinessDateAttribute().eq(first.businessDate)); } if (metaData.getProcessingDateAttribute() != null && first.processingDate != null) { segOp = segOp.and(metaData.getProcessingDateAttribute().eq(first.processingDate)); } forceRefresh(metaData, list, pkAttributesNoSource, segOp); } } else { forceRefresh(metaData, dbLookUp, pkAttributesNoSource, NoOperation.instance()); } } }
Example 20
Source File: CatoBuilder.java From obevo with Apache License 2.0 | 4 votes |
public CatoBuilder withFields(Collection<String> keyFields, Collection<String> excludeFields) { this.properties = new SimpleCatoProperties(FastList.newList(keyFields), excludeFields); return this; }