it.unimi.dsi.fastutil.objects.ObjectArrayList Java Examples

The following examples show how to use it.unimi.dsi.fastutil.objects.ObjectArrayList. 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: TaneAlgorithmFilterTreeEnd.java    From metanome-algorithms with Apache License 2.0 6 votes vote down vote up
/**
     * Build the prefix blocks for a level. It is a Hashmap containing the
     * prefix as a key and the corresponding attributes as  the value.
     */
    private void buildPrefixBlocks() {
//		System.out.println("Start BuildPrefixBlocks");
        this.prefix_blocks.clear();
        for (BitSet level_iter : level0.keySet()) {
            BitSet prefix = getPrefix(level_iter);

            if (prefix_blocks.containsKey(prefix)) {
                prefix_blocks.get(prefix).add(level_iter);
            } else {
                ObjectArrayList<BitSet> list = new ObjectArrayList<BitSet>();
                list.add(level_iter);
                prefix_blocks.put(prefix, list);
            }
        }
//		System.out.println("Stop BuildPrefixBlocks");
    }
 
Example #2
Source File: Minimization.java    From minie with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Given a list of words to be removed and a list of matched nodes, remove the words to be removed from the phrase and
 * empty that list, also empty the list of matched nodes
 * @param remWords
 * @param matchedNodes
 */
public void dropWords(List<CoreMap> remWords, List<CoreMap> matchWords){
    matchWords.clear();
    // in addition to removing the words, save them in a separate list
    ObjectArrayList<SemanticGraphEdge> droppedEdges = CoreNLPUtils.listOfCoreMapWordsToParentEdges(this.sg, remWords);
    /*ObjectArrayList<SemanticGraphEdge> droppedEdges = new ObjectArrayList<SemanticGraphEdge>();
    for (IndexedWord word: remWordsArray) {
        SemanticGraphEdge edge = this.sg.getEdge(this.sg.getParent(word), word);
        droppedEdges.add(edge);
    }*/
    this.phrase.addDroppedEdges(droppedEdges);
    this.phrase.addDroppedWords(CoreNLPUtils.getWordListFromCoreMapList(remWords));
    // remove words
    this.phrase.removeCoreLabelWordsFromList(remWords);
    remWords.clear();
}
 
Example #3
Source File: BedrockUtils.java    From Protocol with Apache License 2.0 6 votes vote down vote up
public static List<ResourcePacksInfoPacket.Entry> readPacksInfoEntries(ByteBuf buffer) {
    Preconditions.checkNotNull(buffer, "buffer");

    List<ResourcePacksInfoPacket.Entry> entries = new ObjectArrayList<>();
    int length = buffer.readUnsignedShortLE();
    for (int i = 0; i < length; i++) {
        String packId = readString(buffer);
        String packVersion = readString(buffer);
        long packSize = buffer.readLongLE();
        String encryptionKey = readString(buffer);
        String subpackName = readString(buffer);
        String contentId = readString(buffer);
        boolean scripting = buffer.readBoolean();
        entries.add(new ResourcePacksInfoPacket.Entry(packId, packVersion, packSize, encryptionKey, subpackName, contentId, scripting));
    }
    return entries;
}
 
Example #4
Source File: Util.java    From StreamingRec with Apache License 2.0 6 votes vote down vote up
/**
 * Sorts the entries of a map based on their values
 * 
 * @param <K> - 
 * @param <V> - 
 * @param map -
 * @param ascending -
 * @return the sorted map
 */
public static <K, V extends Comparable<? super V>> Map<K, V> sortByValue(Map<K, V> map, final boolean ascending) {
	List<Map.Entry<K, V>> list = new ObjectArrayList<Map.Entry<K, V>>(map.entrySet());
	Collections.sort(list, new Comparator<Map.Entry<K, V>>() {
		public int compare(Map.Entry<K, V> o1, Map.Entry<K, V> o2) {
			if (ascending) {
				return (o1.getValue()).compareTo(o2.getValue());
			} else {
				return (o2.getValue()).compareTo(o1.getValue());
			}

		}
	});

	Map<K, V> result = new Object2ObjectLinkedOpenHashMap<K, V>();
	for (Map.Entry<K, V> entry : list) {
		result.put(entry.getKey(), entry.getValue());
	}
	return result;
}
 
Example #5
Source File: CoreNLPUtils.java    From minie with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Given a sequence of words and a pivot-word index, return the "chained words" from the left and from the right
 * of the pivot word. "Chained words" are a list of words, which all of them share the same POS tag and have no 
 * NE types.
 * 
 * @param sequence: a sequence of words (list of IndexedWord)
 * @param wordInd: the index of the pivot word
 * @return a list of chained words to the left and the right of the pivot word (the pivot word is included)
 */
public static ObjectArrayList<IndexedWord> getChainedTagNoNER(ObjectArrayList<IndexedWord> sequence, int wordInd){
    IntArrayList chainedPosWordsInd = new IntArrayList();
    
    // Get the chained nouns from left and right
    IntArrayList chainedPosWordsLeft = getChainedTagsFromLeftNoNER(sequence, chainedPosWordsInd.clone(), wordInd);
    IntArrayList chainedPosWordsRight = getChainedTagsFromRightNoNER(sequence, chainedPosWordsInd.clone(), wordInd);
    
    // Add all the words to the chained nouns
    chainedPosWordsInd.addAll(chainedPosWordsLeft);
    chainedPosWordsInd.add(wordInd);
    chainedPosWordsInd.addAll(chainedPosWordsRight);
    
    // IndexedWord chained nouns
    ObjectArrayList<IndexedWord> iChainedNouns = new ObjectArrayList<IndexedWord>();
    for (int i: FastUtil.sort(chainedPosWordsInd)){
        iChainedNouns.add(sequence.get(i));
    }
    
    return iChainedNouns;
}
 
Example #6
Source File: BedrockUtils.java    From Protocol with Apache License 2.0 6 votes vote down vote up
public static List<ResourcePacksInfoPacket.Entry> readPacksInfoEntries(ByteBuf buffer) {
    Preconditions.checkNotNull(buffer, "buffer");

    List<ResourcePacksInfoPacket.Entry> entries = new ObjectArrayList<>();
    int length = buffer.readUnsignedShortLE();
    for (int i = 0; i < length; i++) {
        String packId = readString(buffer);
        String packVersion = readString(buffer);
        long packSize = buffer.readLongLE();
        String encryptionKey = readString(buffer);
        String subpackName = readString(buffer);
        String contentId = readString(buffer);
        boolean unknownBool = buffer.readBoolean();
        entries.add(new ResourcePacksInfoPacket.Entry(packId, packVersion, packSize, encryptionKey, subpackName, contentId, unknownBool));
    }
    return entries;
}
 
Example #7
Source File: Clause.java    From minie with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Clause clone() {
    Clause clause = new Clause();
    clause.constituents = new ObjectArrayList<Constituent>(constituents);
    clause.type = type;
    clause.subject = subject;
    clause.verb = verb;
    clause.dobjects = new IntArrayList(dobjects);
    clause.iobjects = new IntArrayList(iobjects);
    clause.complement = complement;
    clause.xcomps = new IntArrayList(xcomps);
    clause.ccomps = new IntArrayList(ccomps);
    clause.acomps = new IntArrayList(acomps);
    clause.adverbials = new IntArrayList(adverbials);
    clause.relativeAdverbial = relativeAdverbial;
    clause.agent = agent;
    clause.parentClause = parentClause;
    clause.include = include;
    clause.propositions = propositions;
    return clause;
}
 
Example #8
Source File: FrequencyCandidates.java    From minie with GNU General Public License v3.0 6 votes vote down vote up
/** Generate the frequency candidates by default: 
 *  1) the whole phrase itself
 *  2) the root word
 *  3) the chained words from the root 
 *  4) the chained sub-constituent candidates
 **/
public void generateDefaultFreqCandidates(){
    // Stoping conditions (when the phrase is just one word or no words at all (sometimes it happens)
    if (this.phrase.getWordList().size() == 0){
        return;
    }
    else if (this.phrase.getWordList().size() == 1){
        this.candidates.add(this.phrase.getWordList().get(0).lemma().toLowerCase());
        return;
    }
    
    // 1) the whole phrase itself
    this.candidates.add(CoreNLPUtils.listOfWordsToLemmaString(this.phrase.getWordList()).toLowerCase());
    
    // 2) the root word
    this.candidates.add(this.phrase.getRoot().lemma().toLowerCase());
    
    // 3) the chained words from the root
    ObjectArrayList<IndexedWord> chainedRootWords = 
            CoreNLPUtils.getChainedWords(this.phrase.getRoot(), this.phrase.getWordList());
    this.candidates.add(CoreNLPUtils.listOfWordsToLemmaString(chainedRootWords).toLowerCase());
}
 
Example #9
Source File: PagesIndex.java    From presto with Apache License 2.0 6 votes vote down vote up
public void compact()
{
    if (eagerCompact) {
        return;
    }
    for (int channel = 0; channel < types.size(); channel++) {
        ObjectArrayList<Block> blocks = channels[channel];
        for (int i = nextBlockToCompact; i < blocks.size(); i++) {
            Block block = blocks.get(i);

            // Copy the block to compact its size
            Block compactedBlock = block.copyRegion(0, block.getPositionCount());
            blocks.set(i, compactedBlock);
            pagesMemorySize -= block.getRetainedSizeInBytes();
            pagesMemorySize += compactedBlock.getRetainedSizeInBytes();
        }
    }
    nextBlockToCompact = channels[0].size();
    estimatedSize = calculateEstimatedSize();
}
 
Example #10
Source File: FrequencyCandidates.java    From minie with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Given a token sequence matcher for regular expressions for sequences over tokens, get the sub-constituents and
 * store them in the sub-constituent object sc
 * @param tMatcher: token sequence matcher for regular expressions for sequences over tokens
 * @param sc: sub-constituent object
 */
public void generateCandidatesFromTokenRegexMatch(TokenSequenceMatcher tMatcher, SubConstituent sc){
    // The matched list of words and their "root"
    ObjectArrayList<IndexedWord> matchWords;
    IndexedWord matchRoot;
    
    // Given a match, get the subconstituents
    while (tMatcher.find()){         
        matchWords = CoreNLPUtils.listOfCoreMapWordsToIndexedWordList(tMatcher.groupNodes());
        matchRoot = CoreNLPUtils.getRootFromWordList(this.sg, matchWords);
        sc.setRoot(matchRoot);
        sc.setWords(matchWords);
        sc.generateSubConstituentsFromLeft();
        for (String cand: sc.getStringSubConstituents()){
            this.candidates.add(cand);
        }
        sc.clearSubConstituentsAndCandidates();
    }
}
 
Example #11
Source File: AnnotatedPhrase.java    From minie with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Parametric constructor 
 * @param p: the phrase to be annotated
 * @param q: the quantities for phrase 'p'
 */
public AnnotatedPhrase(Phrase p, ObjectArrayList<Quantity> q){
    super(p);
    this.quantities = q;
    this.droppedEdges = new ObjectOpenHashSet<>();
    this.droppedWords = new ObjectOpenHashSet<>();
}
 
Example #12
Source File: PLIBuilder.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
public static List<PositionListIndex> getPLIs(ObjectArrayList<List<String>> records, int numAttributes, boolean isNullEqualNull) throws InputIterationException {
	if (records.size() > Integer.MAX_VALUE)
		throw new RuntimeException("PLI encoding into integer based PLIs is not possible, because the number of records in the dataset exceeds Integer.MAX_VALUE. Use long based plis instead! (NumRecords = " + records.size() + " and Integer.MAX_VALUE = " + Integer.MAX_VALUE);
	
	List<HashMap<String, IntArrayList>> clusterMaps = calculateClusterMapsStatic(records, numAttributes);
	return fetchPositionListIndexesStatic(clusterMaps, isNullEqualNull);
}
 
Example #13
Source File: FastUtil.java    From minie with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Given a list of lists, get the combinations of the elements between the lists.
 * For example, if we have lists = [[1, 2, 3], [4, 5]], then 
 * getElementsCombinations(lists) = [1, 4], [1, 5], [2, 4], [2, 5], [3, 4], [3, 5] 
 * @param lists: list of lists
 * @return combination of elements between the lists
 */
public static <T> Set<ObjectArrayList<T>> getElementsCombinations(ObjectArrayList<ObjectArrayList<T>> lists) {
    Set<ObjectArrayList<T>> combinations = new HashSet<ObjectArrayList<T>>();
    Set<ObjectArrayList<T>> newCombinations = new HashSet<ObjectArrayList<T>>();
    ObjectArrayList<T> newList = new ObjectArrayList<T>();
    
    int index = 0;

    // Extract each of the integers in the first list and add each to ints as a new list
    for(T i: lists.get(0)) {
        newList.clear();
        newList.add(i);
        combinations.add(newList.clone());
    }
    index++;
    List<T> nextList;
    while(index < lists.size()) {
        nextList = lists.get(index).clone();
        newCombinations.clear();
        for(List<T> first: combinations) {
            for(T second: nextList) {
                newList.clear();
                newList.addAll(first);
                newList.add(second);
                newCombinations.add(newList.clone());
            }
        }
        combinations = newCombinations;

        index++;
        nextList.clear();
    }

    return combinations;
}
 
Example #14
Source File: FdepAlgorithmHashValues.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
/**
 * Fetch the data from the database and keep it as List of Lists.
 *
 * @throws AlgorithmExecutionException
 * @throws AlgorithmConfigurationException
 */
private void loadData() throws AlgorithmExecutionException, AlgorithmConfigurationException {
    RelationalInput ri = null;
    tuples = new ObjectArrayList<int[]>();
    if (this.relationalInputGenerator != null) {
        ri = this.relationalInputGenerator.generateNewCopy();
    } else if (this.databaseConnectionGenerator != null && this.tableName != null) {
        String sql = "SELECT * FROM " + this.tableName;
        ri = this.databaseConnectionGenerator.generateRelationalInputFromSql(sql, this.tableName);
    } else {
        throw new AlgorithmConfigurationException("No input Generator set.");
    }
    if (ri != null) {
        this.columnNames = ri.columnNames();
        this.numberAttributes = ri.numberOfColumns();
        this.tableName = ri.relationName();
        int i;
        String element;
        while (ri.hasNext()) {
            List<String> row = ri.next();
            int[] intRow = new int[numberAttributes];
            for (i = 0; i < numberAttributes; i++) {
                element = row.get(i);
                if (element != null) {
                    intRow[i] = element.hashCode();
                } else {
                    intRow[i] = -1;
                }
            }
            tuples.add(intRow);
        }
    }
}
 
Example #15
Source File: SumMethod1.java    From WarpPI with Apache License 2.0 5 votes vote down vote up
private static int[] getFirstWorkingSumCouple(final MathContext root, final ObjectArrayList<Function> elements)
			throws InterruptedException {
		return null;
//		final int size = elements.size();
//		Function a;
//		Function b;
//		if (elements.size() == 2) {
//			return null;
//		}
//		for (int i = 0; i < size; i++) {
//			a = elements.get(i);
//			for (int j = 0; j < size; j++) {
//				if (Thread.interrupted()) throw new InterruptedException();
//				b = elements.get(j);
//				if (i != j) {
//					Function testFunc;
//					if (b instanceof Negative) {
//						testFunc = new Subtraction(root, a, ((Negative) b).getParameter());
//					} else if (b instanceof Number && ((Number) b).getTerm().compareTo(BigDecimal.ZERO) < 0) {
//						testFunc = new Subtraction(root, a, ((Number) b).multiply(new Number(root, -1)));
//					} else if (a instanceof Negative) {
//						testFunc = new Subtraction(root, b, ((Negative) a).getParameter());
//					} else if (a instanceof Number && ((Number) a).getTerm().compareTo(BigDecimal.ZERO) < 0) {
//						testFunc = new Subtraction(root, b, ((Number) a).multiply(new Number(root, -1)));
//					} else {
//						testFunc = new Sum(root, a, b);
//					}
//					if (!testFunc.isSimplified()) {
//						return new int[] { i, j };
//					}
//				}
//			}
//		}
//		return null;
	}
 
Example #16
Source File: PhraseUtils.java    From minie with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Given a list of annoteted phrases, return their words concatenated into one string.
 * @param phraseList: list of phrases
 * @return string (words from the phrase list concatenated)
 */
public static String listOfAnnotatedPhrasesToString(ObjectArrayList<AnnotatedPhrase> phraseList){
    StringBuffer sb = new StringBuffer();
    for (AnnotatedPhrase aPhrase: phraseList){
        sb.append(aPhrase.getWords());
        sb.append(SEPARATOR.SPACE);
    }
    return sb.toString().trim();
}
 
Example #17
Source File: MathSolver.java    From WarpPI with Apache License 2.0 5 votes vote down vote up
private void setSimplified(Function fnc, Rule rule) {
	ObjectArrayList<Rule> oar;
	if (simplificationCache.containsKey(fnc)) {
		oar = new ObjectArrayList<>();
		simplificationCache.put(fnc, oar);
	} else {
		oar = simplificationCache.get(fnc);
		if (oar.contains(rule)) return;
	}
	oar.add(rule);
}
 
Example #18
Source File: AnnotatedPhrase.java    From minie with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Parametric constructor: given a list of indexed words and semantic graph, create annotated phrase, with empty
 * quantities list
 * @param wList: the list of words for the phrase
 * @param sg: the semantic graph of the phrase (should be the sentence subgraph)
 */
public AnnotatedPhrase(ObjectArrayList<IndexedWord> wList, SemanticGraph sg){
    super(wList, sg);
    this.quantities = new ObjectArrayList<>();
    this.droppedEdges = new ObjectOpenHashSet<>();
    this.droppedWords = new ObjectOpenHashSet<>();
}
 
Example #19
Source File: SegmentedInputStream.java    From database with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a segmented input stream with no markers.
 * 
 * @param in the underlying input stream.  
 */
public SegmentedInputStream( final InputStream in ) {
	if ( in == null ) throw new NullPointerException();
	this.in = in;
	this.blocks = new ObjectArrayList<SegmentBlock>();
	this.currentBlock = -1;
}
 
Example #20
Source File: DivisionRule.java    From WarpPI with Apache License 2.0 5 votes vote down vote up
@Override
public ObjectArrayList<Function> execute(final Function f) throws Error {
	if (f instanceof Division) {
		final ObjectArrayList<Function> result = new ObjectArrayList<>();
		final Function variable1 = ((FunctionOperator) f).getParameter1();
		final Function variable2 = ((FunctionOperator) f).getParameter2();
		final MathContext mathContext = f.getMathContext();
		if (variable1 instanceof Number && variable2 instanceof Number)
			if (mathContext.exactMode) {
				if (((Number) variable1).isInteger() && ((Number) variable2).isInteger()) {
					LinkedList<BigInteger> factors1, factors2, mcm;
					try {
						factors1 = ((Number) variable1).getFactors();
						factors2 = ((Number) variable2).getFactors();
						mcm = ScriptUtils.mcm(factors1, factors2);
					} catch (final Exception ex) {
						return null;
					}
					if (mcm.size() > 0) { //true if there is at least one common factor
						//divide by the common factor (ab/cb = a/c)
						BigInteger nmb1 = ((Number) variable1).getTerm().toBigIntegerExact();
						BigInteger nmb2 = ((Number) variable2).getTerm().toBigIntegerExact();
						for (final BigInteger integerNumber : mcm) {
							nmb1 = nmb1.divide(integerNumber);
							nmb2 = nmb2.divide(integerNumber);
						}
						result.add(new Division(mathContext, new Number(mathContext, nmb1), new Number(mathContext, nmb2)));
						return result;
					}
				}
			} else {
				//divide a by b (a/b = c)
				result.add(((Number) variable1).divide((Number) variable2));
				return result;
			}
	}
	return null;
}
 
Example #21
Source File: PLIBuilder.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
public static List<PositionListIndex> getPLIs(ObjectArrayList<List<String>> records, int numAttributes, boolean isNullEqualNull) throws InputIterationException {
	if (records.size() > Integer.MAX_VALUE)
		throw new RuntimeException("PLI encoding into integer based PLIs is not possible, because the number of records in the dataset exceeds Integer.MAX_VALUE. Use long based plis instead! (NumRecords = " + records.size() + " and Integer.MAX_VALUE = " + Integer.MAX_VALUE);
	
	List<HashMap<String, IntArrayList>> clusterMaps = calculateClusterMapsStatic(records, numAttributes);
	return fetchPositionListIndexesStatic(clusterMaps, isNullEqualNull);
}
 
Example #22
Source File: PLIBuilder.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
protected static List<HashMap<String, IntArrayList>> calculateClusterMapsStatic(ObjectArrayList<List<String>> records, int numAttributes) throws InputIterationException {
	List<HashMap<String, IntArrayList>> clusterMaps = new ArrayList<>();
	for (int i = 0; i < numAttributes; i++)
		clusterMaps.add(new HashMap<String, IntArrayList>());
	
	int recordId = 0;
	for (List<String> record : records) {
		int attributeId = 0;
		for (String value : record) {
			HashMap<String, IntArrayList> clusterMap = clusterMaps.get(attributeId);
			
			if (clusterMap.containsKey(value)) {
				clusterMap.get(value).add(recordId);
			}
			else {
				IntArrayList newCluster = new IntArrayList();
				newCluster.add(recordId);
				clusterMap.put(value, newCluster);
			}
			
			attributeId++;
		}
		recordId++;
	}
	
	return clusterMaps;
}
 
Example #23
Source File: BlockLogarithm.java    From WarpPI with Apache License 2.0 5 votes vote down vote up
@Override
public ObjectArrayList<BlockContainer> getInnerContainers() {
	ObjectArrayList<BlockContainer> output = new ObjectArrayList<>();
	output.add(containerBase);
	output.add(containerNumber);
	return output;
}
 
Example #24
Source File: CoreNLPUtils.java    From minie with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Given a list of indexed words 'words', return an integer list of indices of the words
 * @param words: list of indexed words
 * @return list of indices of the words
 */
public static IntArrayList listOfWordsToIndexList(ObjectArrayList<IndexedWord> words){
    IntArrayList indices = new IntArrayList();
    for (IndexedWord word: words){
        indices.add(word.index());
    }
    return indices;
}
 
Example #25
Source File: CoreNLPUtils.java    From minie with GNU General Public License v3.0 5 votes vote down vote up
/**
 *
 */
public static ObjectArrayList<SemanticGraphEdge> listOfIndexedWordsToParentEdges(SemanticGraph semanticGraph, ObjectArrayList<IndexedWord> wordList) {
    ObjectArrayList<SemanticGraphEdge> result = new ObjectArrayList<>();
    for (IndexedWord word: wordList) {
        if (!semanticGraph.containsVertex(word)) continue;
        SemanticGraphEdge edge = semanticGraph.getEdge(semanticGraph.getParent(word), word);
        result.add(edge);
    }
    return result;
}
 
Example #26
Source File: CoreNLPUtils.java    From minie with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Given a list of words, return the phrase of words as a whole string, separated with empty space
 * @param words: list of words (e.g. [Kiril, lives, in, Mannheim])
 * @return string of the list of words separated by space (e.g. it returns "Kiril lives in Mannheim")
 */
public static String listOfWordsToWordsString(ObjectArrayList<IndexedWord> words){
    StringBuffer sbSentence = new StringBuffer();
    for (int i = 0; i < words.size(); i++){
        sbSentence.append(words.get(i).word());
        sbSentence.append(SEPARATOR.SPACE);
    }
    return sbSentence.toString().trim();
}
 
Example #27
Source File: AnnotatedProposition.java    From minie with GNU General Public License v3.0 5 votes vote down vote up
/** Constructor given list of phrases and attribution only **/
public AnnotatedProposition(ObjectArrayList<AnnotatedPhrase> t, Attribution s){
    this.triple = t;
    this.attribution = s;
    this.polarity = new Polarity();
    this.modality = new Modality();
    this.id = -1;
}
 
Example #28
Source File: FDTreeElement.java    From metanome-algorithms with Apache License 2.0 5 votes vote down vote up
public void addFunctionalDependenciesInto(List<FunctionalDependency> functionalDependencies, BitSet lhs, ObjectArrayList<ColumnIdentifier> columnIdentifiers, List<PositionListIndex> plis) {
	for (int rhs = this.rhsFds.nextSetBit(0); rhs >= 0; rhs = this.rhsFds.nextSetBit(rhs + 1)) {
		ColumnIdentifier[] columns = new ColumnIdentifier[lhs.cardinality()];
		int j = 0;
		for (int i = lhs.nextSetBit(0); i >= 0; i = lhs.nextSetBit(i + 1)) {
			int columnId = plis.get(i).getAttribute(); // Here we translate the column i back to the real column i before the sorting
			columns[j++] = columnIdentifiers.get(columnId); 
		}
		
		ColumnCombination colCombination = new ColumnCombination(columns);
		int rhsId = plis.get(rhs).getAttribute(); // Here we translate the column rhs back to the real column rhs before the sorting
		FunctionalDependency fdResult = new FunctionalDependency(colCombination, columnIdentifiers.get(rhsId));
		functionalDependencies.add(fdResult);
	}

	if (this.getChildren() == null)
		return;
		
	for (int childAttr = 0; childAttr < this.numAttributes; childAttr++) {
		FDTreeElement element = this.getChildren()[childAttr];
		if (element != null) {
			lhs.set(childAttr);
			element.addFunctionalDependenciesInto(functionalDependencies, lhs, columnIdentifiers, plis);
			lhs.clear(childAttr);
		}
	}
}
 
Example #29
Source File: ByteArrayDiskQueues.java    From BUbiNG with Apache License 2.0 5 votes vote down vote up
/** Creates a set of byte-array disk queues in the given directory using the specified
 * file size.
 *
 * @param dir a directory.
 * @param log2LogFileSize the base-2 logarithm of the size of a log file.
 */
public ByteArrayDiskQueues(final File dir, final int log2LogFileSize) {
	this.dir = dir;
	this.log2LogFileSize =log2LogFileSize;
	logFileSize = 1 << log2LogFileSize;
	logFilePositionMask = (1 << log2LogFileSize) - 1;
	key2QueueData = new Reference2ObjectOpenHashMap<>();
	files = new ObjectArrayList<>();
	buffers = new ObjectArrayList<>();
}
 
Example #30
Source File: FDTreeElement.java    From winter with Apache License 2.0 5 votes vote down vote up
public void addFunctionalDependenciesInto(List<FunctionalDependency> functionalDependencies, OpenBitSet lhs, ObjectArrayList<ColumnIdentifier> columnIdentifiers, List<PositionListIndex> plis) {
	for (int rhs = this.rhsFds.nextSetBit(0); rhs >= 0; rhs = this.rhsFds.nextSetBit(rhs + 1)) {
		ColumnIdentifier[] columns = new ColumnIdentifier[(int) lhs.cardinality()];
		int j = 0;
		for (int i = lhs.nextSetBit(0); i >= 0; i = lhs.nextSetBit(i + 1)) {
			int columnId = plis.get(i).getAttribute(); // Here we translate the column i back to the real column i before the sorting
			columns[j++] = columnIdentifiers.get(columnId); 
		}
		
		ColumnCombination colCombination = new ColumnCombination(columns);
		int rhsId = plis.get(rhs).getAttribute(); // Here we translate the column rhs back to the real column rhs before the sorting
		FunctionalDependency fdResult = new FunctionalDependency(colCombination, columnIdentifiers.get(rhsId));
		functionalDependencies.add(fdResult);
	}

	if (this.getChildren() == null)
		return;
		
	for (int childAttr = 0; childAttr < this.numAttributes; childAttr++) {
		FDTreeElement element = this.getChildren()[childAttr];
		if (element != null) {
			lhs.set(childAttr);
			element.addFunctionalDependenciesInto(functionalDependencies, lhs, columnIdentifiers, plis);
			lhs.clear(childAttr);
		}
	}
}