/** * Returns whether the given Integer is present in this set. * * @param i any Integer * @return true or false */ public boolean contains(Integer i) { if (i == null) { throw new NullPointerException("i is null"); } int iFrom = i.intValue(); return contains(iFrom); }
/** * Adds an int to the set. * * @param i an Integer */ public void add(Integer i) { if (i == null) { throw new NullPointerException("i is null"); } int iFrom = i.intValue(); set(iFrom, true); }
public void test() throws Exception { IntPresentSet set = new IntPresentSet(); set.set(42, true); set.set(28673452, true); assertEquals(2, set.size()); assertTrue(set.contains(42)); assertTrue(set.contains(28673452)); assertFalse(set.contains(63)); assertEquals("[42, 28673452]", set.toString()); set.set(42, true); assertEquals(2, set.size()); assertTrue(set.contains(42)); assertTrue(set.contains(28673452)); assertFalse(set.contains(63)); assertEquals("[42, 28673452]", set.toString()); set.set(42, false); assertEquals(1, set.size()); assertFalse(set.contains(42)); assertTrue(set.contains(28673452)); assertFalse(set.contains(63)); assertEquals("[28673452]", set.toString()); } }
|| (equivObjects.size() == 1 && o.getId() != null && pureObjects.contains(o.getId()) && type == SOURCE))) { return shortcut(o, equivObjects, type, time2, source, skelSource); if (writtenObjects.contains(newObj.getId())) { duplicateObjects.add(newObj.getId()); isDuplicates = true; } else { writtenObjects.add(newObj.getId()); skeletons.add(newObj.getId()); } else { if (skeletons.contains(newObj.getId().intValue())) { skeletons.set(newObj.getId().intValue(), false); if (skeletons.size() <= 10000) { LOG.info("Skeletons: " + skeletons.toString()); if (pureObjects.size() <= 10000) { LOG.info("pureObjects: " + pureObjects.toString()); if (skeletons.size() <= 10000) { LOG.info("Skeletons: " + skeletons.toString()); if (pureObjects.size() <= 10000) { LOG.info("pureObjects: " + pureObjects.toString());
if (writtenObjects.contains(newId)) { + " object from source " + o); duplicateObjects.add(newId); isDuplicates = true; } else { writtenObjects.add(newId); skeletons.add(newObj.getId()); } else if (skeletons.contains(newObj.getId().intValue())) { skeletons.set(newObj.getId().intValue(), false); pureObjects.add(o.getId());
@Test public void testSkeletonsNoException() throws Exception { Address a = (Address) DynamicUtil.createObject(Collections.singleton(Address.class)); a.setAddress("address1"); if (doIds) { a.setId(new Integer(1)); } Source source = iw.getMainSource("testsource", "testsource"); Source skelSource = iw.getSkeletonSource("testsource", "testsource"); iw.store(a, source, skelSource, IntegrationWriterDataTrackingImpl.SKELETON); Assert.assertTrue(iw.skeletons.size() == 1); iw.store(a, source, skelSource, IntegrationWriterDataTrackingImpl.SOURCE); Assert.assertTrue(iw.skeletons.size() == 0); }
/** * Resets the IntegrationWriter, clearing the id map and the hints */ @Override public void reset() { super.reset(); skeletons = new IntPresentSet(); pureObjects = new IntPresentSet(); writtenObjects = new IntPresentSet(); duplicateObjects = new IntPresentSet(); isDuplicates = false; }
/** * Puts a mapping into idMap. * * @param source the ID of the object from the source * @param dest the ID of the object from the destination * @throws ObjectStoreException if an attempt is made to change an existing mapping */ public void assignMapping(Integer source, Integer dest) throws ObjectStoreException { if (source != null && dest != null) { Integer existingValue = idMap.get(source); if (existingValue != null && !existingValue.equals(dest)) { throw new ObjectStoreException("Error: Attempt to put " + source + " -> " + dest + " into ID Map, but " + source + " -> " + existingValue + "exists already"); } idMap.put(source, dest); dbIdsStored.add(dest); idMapOps++; if (idMapOps % 100000 == 0) { LOG.info("idMap size = " + idMap.size() + ", ops = " + idMapOps); } } }
|| (equivObjects.size() == 1 && o.getId() != null && pureObjects.contains(o.getId()) && type == SOURCE))) { return shortcut(o, equivObjects, type, time2, source, skelSource); if (writtenObjects.contains(newObj.getId())) { duplicateObjects.add(newObj.getId()); isDuplicates = true; } else { writtenObjects.add(newObj.getId()); skeletons.add(newObj.getId()); } else { if (skeletons.contains(newObj.getId().intValue())) { skeletons.set(newObj.getId().intValue(), false); if (skeletons.size() <= 10000) { LOG.info("Skeletons: " + skeletons.toString()); if (pureObjects.size() <= 10000) { LOG.info("pureObjects: " + pureObjects.toString()); if (skeletons.size() <= 10000) { LOG.info("Skeletons: " + skeletons.toString()); if (pureObjects.size() <= 10000) { LOG.info("pureObjects: " + pureObjects.toString());
if (writtenObjects.contains(newId)) { + " object from source " + o); duplicateObjects.add(newId); isDuplicates = true; } else { writtenObjects.add(newId); skeletons.add(newObj.getId()); } else if (skeletons.contains(newObj.getId().intValue())) { skeletons.set(newObj.getId().intValue(), false); pureObjects.add(o.getId());
IntPresentSet doneAlready = ((ObjectStoreFastCollectionsForTranslatorImpl) origOs) .getDoneAlready(); if (doneAlready.size() > 100000) { LOG.error("Exception while dataloading", e); } else {
/** * Resets the IntegrationWriter, clearing the id map and the hints */ @Override public void reset() { super.reset(); skeletons = new IntPresentSet(); pureObjects = new IntPresentSet(); writtenObjects = new IntPresentSet(); duplicateObjects = new IntPresentSet(); isDuplicates = false; }
/** * Puts a mapping into idMap. * * @param source the ID of the object from the source * @param dest the ID of the object from the destination * @throws ObjectStoreException if an attempt is made to change an existing mapping */ public void assignMapping(Integer source, Integer dest) throws ObjectStoreException { if (source != null && dest != null) { Integer existingValue = idMap.get(source); if (existingValue != null && !existingValue.equals(dest)) { throw new ObjectStoreException("Error: Attempt to put " + source + " -> " + dest + " into ID Map, but " + source + " -> " + existingValue + "exists already"); } idMap.put(source, dest); dbIdsStored.add(dest); idMapOps++; if (idMapOps % 100000 == 0) { LOG.info("idMap size = " + idMap.size() + ", ops = " + idMapOps); } } }
/** * Returns whether the given Integer is present in this set. * * @param i any Integer * @return true or false */ public boolean contains(Integer i) { if (i == null) { throw new NullPointerException("i is null"); } int iFrom = i.intValue(); return contains(iFrom); }
IntPresentSet doneAlready = ((ObjectStoreFastCollectionsForTranslatorImpl) origOs) .getDoneAlready(); if (doneAlready.size() > 100000) { LOG.error("Exception while dataloading", e); } else {
/** * Adds an int to the set. * * @param i an Integer */ public void add(Integer i) { if (i == null) { throw new NullPointerException("i is null"); } int iFrom = i.intValue(); set(iFrom, true); }