/** * * @param ct List of {@link ITabularFormula}. * @return */ public static ObjectArrayList cloneStructures(ObjectArrayList ct) { ObjectArrayList ctf = new ObjectArrayList(); for (int i = 0; i < ct.size(); i++) { ctf.add(((ITabularFormula) ct.get(i)).clone()); } return ctf; }
public boolean apply(int key, Object value) { ((ObjectArrayList) value).clear(); return true; } });
/** * Returns a string representation of the receiver, containing * the String representation of each element. */ public String toString() { return cern.colt.Arrays.toString(partFromTo(0, size()-1).elements()); } /**
/** * Returns a list which is a concatenation of <code>times</code> times the receiver. * @param times the number of times the receiver shall be copied. */ public ObjectArrayList times(int times) { ObjectArrayList newList = new ObjectArrayList(times*size); for (int i=times; --i >= 0; ) { newList.addAllOfFromTo(this,0,size()-1); } return newList; } /**
/** * Creates copy of <code>formula</code>. * * New formula uses the same instance of <code>permutation</code> and cloned instances of tiers. * Be careful about modifying permutation of new formula, because these changes will also affect initial formula. * * @param formula */ private SimpleFormula(SimpleFormula formula, final boolean fillTiersHash3) { this.permutation = formula.permutation; int tiersCount = formula.tiers.size(); this.tiers = new ObjectArrayList(tiersCount); this.tiersHash3 = fillTiersHash3 ? new OpenLongObjectHashMap(tiersCount) : null; Object[] tiersElements = formula.tiers.elements(); for (int i = 0; i < tiersCount; i++) { ITier clone = ((ITier) tiersElements[i]).clone(); tiers.add(clone); if (fillTiersHash3) { tiersHash3.put(clone.canonicalHashCode(), clone); } } }
replaceFromToWithFromTo(from, to, partFromTo(otherFrom, otherTo), 0, otherTo-otherFrom); return; beforeInsertDummies(theLast+1, diff); removeFromTo(theLast+diff, theLast-1);
private static IHyperStructure createFirstHSSTier(ObjectArrayList cts, final ObjectArrayList hss, ICompactTripletsStructure sBasic, ObjectArrayList basicTiers) hss.clear(); ITier firstBasicTier = (ITier) basicTiers.get(0); LOGGER.debug("Building HSS tier #1 of {}", basicTiers.size()); for (int i = 0; i < cts.size(); i++) final ICompactTripletsStructure sOther = (ICompactTripletsStructure) cts.get(i); hss.add(hs); assertIntersectionOfTierSubstructuresIsEmpty(((IHyperStructure) hss.get(0)), 0); return (IHyperStructure) hss.get(0);
public boolean apply(long key) { list.add(get(key)); return true; } }
final ObjectArrayList hss = new ObjectArrayList(); StructuresForConcordantShift structuresForConcordantShift = new StructuresForConcordantShift(hss.size()); for (int j = 1; j < basicTiers.size(); j++) LOGGER.debug("Building HSS tier #{} of {}", j+1, basicTiers.size()); final ITier basicPrevTier = (ITier) basicTiers.get(prevTierIndex); final ITier basicNextTier = (ITier) basicTiers.get(nextTierIndex); OpenIntObjectHashMap basicPrevTierVertices = (OpenIntObjectHashMap) basicGraph.getTiers().get(prevTierIndex); IVertex prevTierVertex = (IVertex) ((OpenIntObjectHashMap) basicGraph.getTiers().get(prevTierIndex)).get(tierKeyOfTheVertexToShift); for (int i = 0; i < hss.size(); i++) IHyperStructure hs = (IHyperStructure) hss.get(i); int indexOfLastTier = hs.getTiers().size() - 1; hs.getTiers().removeFromTo(indexOfLastTier - (dirtyTiersCount - 1), indexOfLastTier); if (hss.size() > 0) hssTiersCount = ((IHyperStructure) hss.get(0)).getTiers().size();
/** * Removes all (key,value) associations from the receiver. * Implicitly calls <tt>trimToSize()</tt>. */ public void clear() { new ByteArrayList(this.state).fillFromToWith(0, this.state.length-1, FREE); new ObjectArrayList(values).fillFromToWith(0, state.length-1, null); // delta this.distinct = 0; this.freeEntries = table.length; // delta trimToSize(); } /**
/** * Fills all values contained in the receiver into the specified list. * Fills the list, starting at index 0. * After this call returns the specified list has a new size that equals <tt>this.size()</tt>. * Iteration order is guaranteed to be <i>identical</i> to the order used by method {@link #forEachKey(LongProcedure)}. * <p> * This method can be used to iterate over the values of the receiver. * * @param list the list to be filled, can have any size. */ public void values(ObjectArrayList list) { list.setSize(distinct); Object[] elements = list.elements(); Object[] val = values; byte[] stat = state; int j=0; for (int i = stat.length ; i-- > 0 ;) { if (stat[i]==FULL) elements[j++]=val[i]; } } }
private void addTiersHash2(ITier tier, int varName1, int varName2) { long key = varName1 < varName2 ? (long)varName1 << 21 | varName2 : (long)varName2 << 21 | varName1; ObjectArrayList tiers = (ObjectArrayList) tiersHash2.get(key); if (tiers == null) { tiersHash2.put(key, new ObjectArrayList(new ITier[] {tier})); } else { tiers.add(tier); } }
/** * Deletes the first element from the receiver that matches the specified element. * Does nothing, if no such matching element is contained. * * Tests elements for equality or identity as specified by <tt>testForEquality</tt>. * When testing for equality, two elements <tt>e1</tt> and * <tt>e2</tt> are <i>equal</i> if <tt>(e1==null ? e2==null : * e1.equals(e2))</tt>.) * * @param testForEquality if true -> tests for equality, otherwise for identity. * @param element the element to be deleted. */ public void delete(Object element, boolean testForEquality) { int index = indexOfFromTo(element, 0, size-1, testForEquality); if (index>=0) removeFromTo(index,index); } /**
/** * Returns the number of elements in this list. * * @return the number of elements in this list. */ public int size() { return content.size(); } }
/** * @param ctf List of ITabularFormula * @return True if tier was joined to some <code>ctf</code> */ private static boolean joinTier(ObjectArrayList ctf, ITier tier) { IJoinMethod[] methods = JoinMethods.getMethods(); int ctfCount = ctf.size(); Object[] ctfElements = ctf.elements(); for (int j = 0; j < ctfCount; j++) { ITabularFormula f = (ITabularFormula)ctfElements[j]; for (int i = 0; i < methods.length; i++) { IJoinMethod method = methods[i]; if (method.tryJoin(f, tier)) { return true; } } } return false; }
/** */ protected static String get(cern.colt.list.ObjectArrayList list, int index) { return ((String) list.get(index)); } /**
/** * Inserts the part of the specified list between <code>otherFrom</code> (inclusive) and <code>otherTo</code> (inclusive) before the specified position into the receiver. * Shifts the element currently at that position (if any) and * any subsequent elements to the right. * * @param index index before which to insert first element from the specified list (must be in [0,size]).. * @param other list of which a part is to be inserted into the receiver. * @param from the index of the first element to be inserted (inclusive). * @param to the index of the last element to be inserted (inclusive). * @exception IndexOutOfBoundsException index is out of range (<tt>other.size()>0 && (from<0 || from>to || to>=other.size())</tt>). * @exception IndexOutOfBoundsException index is out of range (<tt>index < 0 || index > size()</tt>). */ public void beforeInsertAllOfFromTo(int index, ObjectArrayList other, int from, int to) { int length=to-from+1; this.beforeInsertDummies(index, length); this.replaceFromToWithFrom(index, index+length-1, other, from); } /**