@Override public synchronized int size() { return map.size(); }
/** * Trims the capacity of the receiver to be the receiver's current size. Releases any superfluous internal memory. An application * can use this operation to minimize the storage of the receiver. */ public void trimToSize() { // * 1.2 because open addressing's performance exponentially degrades // beyond that point // so that even rehashing the table can take very long int newCapacity = nextPrime((int) (1 + 1.2 * size())); if (table.length > newCapacity) { rehash(newCapacity); } }
/** * Trims the capacity of the receiver to be the receiver's current * size. Releases any superfluous internal memory. An application can use this operation to minimize the * storage of the receiver. */ public void trimToSize() { // * 1.2 because open addressing's performance exponentially degrades beyond that point // so that even rehashing the table can take very long int newCapacity = nextPrime((int)(1 + 1.2*size())); if (table.length > newCapacity) { rehash(newCapacity); } } /**
/** * Trims the capacity of the receiver to be the receiver's current * size. Releases any superfluous internal memory. An application can use this operation to minimize the * storage of the receiver. */ public void trimToSize() { // * 1.2 because open addressing's performance exponentially degrades beyond that point // so that even rehashing the table can take very long int newCapacity = nextPrime((int)(1 + 1.2*size())); if (table.length > newCapacity) { rehash(newCapacity); } } /**
public void clear() { substructureEdges.clear(); coincidentIntersections.clear(); int hssSize = hsIntersections.size(); for (int h = 0; h < hssSize; h++) { hsIntersections.forEachPair(new IntObjectProcedure() { public boolean apply(int key, Object value) { ((ObjectArrayList) value).clear(); return true; } }); } } }
private static void assertIntersectionOfTierSubstructuresIsEmpty(IHyperStructure basicGraph, final int tierIndex) throws AssertionError { OpenIntObjectHashMap tierVertices = (OpenIntObjectHashMap) basicGraph.getTiers().get(tierIndex); if (tierVertices.size() == 1) { return; } ICompactTripletsStructure intersection = intersectAll(tierVertices.values()); if (!intersection.isEmpty()) { Helper.prettyPrint(intersection); throw new AssertionError("By the construction rules, intersection of substructure-vertices of a single tier should be an empty substructure"); } }
for (int i = 0; i < tier.size(); i++)
for (int i = 0; i < tierVertices.size(); i++)
if (basicPrevTier.size() != basicPrevTierVertices.size())
private static void assertHSSTierContainsSameNameVertices(ObjectArrayList hss, int tierIndex) { IHyperStructure basicGraph = (IHyperStructure) hss.get(0); ICompactTripletsStructure basicCTS = basicGraph.getBasicCTS(); for (int j = 0; j < basicGraph.getTiers().size(); j++) { ITier basicTier = basicCTS.getTier(j); for (int h = 0; h < hss.size(); h++) { IHyperStructure hs = (IHyperStructure) hss.get(h); OpenIntObjectHashMap hsTier = (OpenIntObjectHashMap) hs.getTiers().get(j); if (hsTier.size() != basicTier.size()) { throw new AssertionError("hsTier.size() != basicTier.size(), tierIndex=" + tierIndex); } assertBothContainsTripletValue(basicTier, hsTier, _000_instance); assertBothContainsTripletValue(basicTier, hsTier, _001_instance); assertBothContainsTripletValue(basicTier, hsTier, _010_instance); assertBothContainsTripletValue(basicTier, hsTier, _011_instance); assertBothContainsTripletValue(basicTier, hsTier, _100_instance); assertBothContainsTripletValue(basicTier, hsTier, _101_instance); assertBothContainsTripletValue(basicTier, hsTier, _110_instance); assertBothContainsTripletValue(basicTier, hsTier, _111_instance); } } }
/** * * @param hs * @param vertex * @return List of vertices from <code>hs</code> whose substructures has non-empty intersection * with substructure of the <code>vertex</code> argument. */ public static ObjectArrayList findNonEmptyIntersections(IHyperStructure hs, IVertex vertex) { ObjectArrayList result = new ObjectArrayList(); for (int j = 0; j < hs.getTiers().size(); j++) { OpenIntObjectHashMap tierVertices = (OpenIntObjectHashMap) hs.getTiers().get(j); for (int i = 0; i < tierVertices.size(); i++) { IVertex tierVertex = (IVertex) tierVertices.values().get(i); ICompactTripletsStructure clone = ((ICompactTripletsStructure) tierVertex.getCTS().clone()); clone.intersect(vertex.getCTS()); if (!clone.isEmpty()) { result.add(tierVertex); } } } return result; }
int tierSize = ((OpenIntObjectHashMap) basicGraph.getTiers().get(j)).size();
int sTierSize = ((OpenIntObjectHashMap) basicGraph.getTiers().get(s)).size();
ObjectArrayList intersections = new ObjectArrayList(); hsIntersections.put(h, intersections); for (int s = 0; s < nextTier.size(); s++)