當前位置: 首頁>>代碼示例>>Java>>正文


Java Table.contains方法代碼示例

本文整理匯總了Java中com.google.common.collect.Table.contains方法的典型用法代碼示例。如果您正苦於以下問題:Java Table.contains方法的具體用法?Java Table.contains怎麽用?Java Table.contains使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.common.collect.Table的用法示例。


在下文中一共展示了Table.contains方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: BT

import com.google.common.collect.Table; //導入方法依賴的package包/類
/**
* Returns a community of nodes find in the
* overlapping matrix.
* @param m Table
* @param Clicks cliques
* @param q queue
* @param n int
* @return A community of nodes.
*/
private Community BT(Table<Integer,Integer,Integer> m, ArrayList<Set<Node>> Clicks, Queue<Integer> q, int n) {
	Community c = new Community();
	while (!(q.isEmpty())) {
		Integer p = q.poll();
		if (m.contains(p,p) && m.get(p,p) == 1) {
			for (Node nn : Clicks.get(p)) c.addNode(nn);
			m.put(p,p,0);
			for (Integer i : m.row(p).keySet()) {
				if (m.get(p, i) == 1) {
					q.add( i);
					m.put(p,i,0);
				}
			}
		}
	}
	return c;
}
 
開發者ID:AlbertSuarez,項目名稱:Wikipedia-PROP,代碼行數:27,代碼來源:CliqueMaxim.java

示例2: getSMTProgramUpdateInfos

import com.google.common.collect.Table; //導入方法依賴的package包/類
private Table<SMTProgram, Stmt, List<Pair<DynamicValueInformation, DynamicValue>>> getSMTProgramUpdateInfos(DynamicValueContainer dynamicValues) {
	Table<SMTProgram, Stmt, List<Pair<DynamicValueInformation, DynamicValue>>> updateInfoTable = HashBasedTable.create();
			
	for(DynamicValue value : dynamicValues.getValues()) {		
		Unit unit = codePositionManager.getUnitForCodePosition(value.getCodePosition()+1);
		int paramIdx = value.getParamIdx();
		
		for(Map.Entry<SMTProgram, Set<DynamicValueInformation>> entry : dynamicValueInfos.entrySet()) {
			for(DynamicValueInformation valueInfo : entry.getValue()) {
				if(valueInfo.getStatement().equals(unit)) {
					//base object
					if(paramIdx == -1) {
						if(valueInfo.isBaseObject()) {								
							if(!updateInfoTable.contains(entry.getKey(), valueInfo.getStatement())) 
								updateInfoTable.put(entry.getKey(), valueInfo.getStatement(), new ArrayList<Pair<DynamicValueInformation, DynamicValue>>());
							updateInfoTable.get(entry.getKey(), valueInfo.getStatement()).add(new Pair<DynamicValueInformation, DynamicValue>(valueInfo, value));		
												
						}
					}
					//method arguments
					else{
						if(valueInfo.getArgPos() == paramIdx) {
							if(!updateInfoTable.contains(entry.getKey(), valueInfo.getStatement())) 
								updateInfoTable.put(entry.getKey(), valueInfo.getStatement(), new ArrayList<Pair<DynamicValueInformation, DynamicValue>>());
							updateInfoTable.get(entry.getKey(), valueInfo.getStatement()).add(new Pair<DynamicValueInformation, DynamicValue>(valueInfo, value));	
						}
					}
				}
			}
		}
	}

	return updateInfoTable;
}
 
開發者ID:srasthofer,項目名稱:FuzzDroid,代碼行數:35,代碼來源:SmartConstantDataExtractorFuzzyAnalysis.java

示例3: formatValues

import com.google.common.collect.Table; //導入方法依賴的package包/類
private static Map<String, Object> formatValues(Calendar time, Table<Calendar, String, Object> tableNO2) {
    Map<String,Object> values = new HashMap<>();
    for(String column : tableNO2.columnKeySet()) {
        if (tableNO2.contains(time,column)) {
            Object value = tableNO2.get(time,column);
            values.put(column,value);
        }
    }
    return values;
}
 
開發者ID:medialab-prado,項目名稱:puremadrid,代碼行數:11,代碼來源:Parser.java

示例4: getOptionRelations

import com.google.common.collect.Table; //導入方法依賴的package包/類
public static Table<Integer, Integer, String> getOptionRelations(final ScoredQuery<QAStructureSurfaceForm> query) {
    Table<Integer, Integer, String> relations = HashBasedTable.create();
    final int predicateId = query.getPredicateId().getAsInt();
    final int headId = query.getPrepositionIndex().isPresent() ?
            query.getPrepositionIndex().getAsInt() : predicateId;

    final int numQAs = query.getQAPairSurfaceForms().size();
    for (int opId1 = 0; opId1 < numQAs; opId1++) {
        final QAStructureSurfaceForm qa1 = query.getQAPairSurfaceForms().get(opId1);
        final ImmutableList<Integer> args1 = qa1.getAnswerStructures().stream()
                .flatMap(ans -> ans.argumentIndices.stream())
                .distinct().sorted().collect(GuavaCollectors.toImmutableList());
        final String answer1 = qa1.getAnswer().toLowerCase();
        final int dist1 = Math.abs(headId - args1.get(0));

        for (int opId2 = 0; opId2 < numQAs; opId2++) {
            if (opId2 == opId1 || relations.contains(opId1, opId2) || relations.contains(opId2, opId1)) {
                continue;
            }
            final QAStructureSurfaceForm qa2 = query.getQAPairSurfaceForms().get(opId2);
            final ImmutableList<Integer> args2 = qa2.getAnswerStructures().stream()
                    .flatMap(ans -> ans.argumentIndices.stream())
                    .distinct().sorted().collect(GuavaCollectors.toImmutableList());
            final String answer2 = qa2.getAnswer().toLowerCase();
            final int dist2 = Math.abs(headId - args2.get(0));

            final boolean isSubspan = answer1.endsWith(" " + answer2)
                    || answer1.startsWith(answer2 + " ");
            final boolean isPronoun = PronounList.nonPossessivePronouns.contains(qa2.getAnswer().toLowerCase())
                    && dist2 < dist1;

            if (isSubspan) {
                relations.put(opId1, opId2, "subspan");
            } else if (isPronoun) {
                relations.put(opId1, opId2, "pronoun");
            }
        }
    }
    return relations;
}
 
開發者ID:uwnlp,項目名稱:hitl_parsing,代碼行數:41,代碼來源:HeuristicHelper.java

示例5: splitAPI_DataFlowtoSMTConvertion

import com.google.common.collect.Table; //導入方法依賴的package包/類
private void splitAPI_DataFlowtoSMTConvertion(ResultSourceInfo dataFlow, IInfoflowCFG cfg, Set<ResultSourceInfo> preparedDataFlowsForSMT, Table<Stmt, Integer, Set<String>> splitInfos) {			
	SMTConverter converter = new SMTConverter(sources);
	for(int i = 0; i < dataFlow.getPath().length; i++) {				
		System.out.println("\t" + dataFlow.getPath()[i]);
		System.out.println("\t\t" + dataFlow.getPathAccessPaths()[i]);
	}
	
	//we remove the first statement (split-API method)
	int n = dataFlow.getPath().length-1;
	Stmt[] reducedDataFlow = new Stmt[n];
	System.arraycopy(dataFlow.getPath(), 1, reducedDataFlow, 0, n);
				
	//currently only possible if there is a constant index for the array
	if(hasConstantIndexAtArrayForSplitDataFlow(reducedDataFlow)) {
		String valueOfInterest = getValueOfInterestForSplitDataflow(reducedDataFlow);
		
		converter.convertJimpleToSMT(reducedDataFlow,
				dataFlow.getPathAccessPaths(), targetUnits, cfg, null);
					
		converter.printProgramToCmdLine();
		
		File z3str2Script = new File(FrameworkOptions.Z3SCRIPT_LOCATION);
		if(!z3str2Script.exists())
			throw new RuntimeException("There is no z3-script available");
		SMTExecutor smtExecutor = new SMTExecutor(converter.getSmtPrograms(), z3str2Script);
		Set<File> smtFiles = smtExecutor.createSMTFile();
		
		for(File smtFile : smtFiles) {
			String loggingPointValue = smtExecutor.executeZ3str2ScriptAndExtractValue(smtFile, valueOfInterest);
			if(loggingPointValue != null) {
				Stmt splitStmt = dataFlow.getPath()[0];
				int index = getConstantArrayIndexForSplitDataFlow(reducedDataFlow);
				
				if(splitInfos.contains(splitStmt, index))
					splitInfos.get(splitStmt, index).add(loggingPointValue);
				else {
					Set<String> values = new HashSet<String>();
					values.add(loggingPointValue);
					splitInfos.put(splitStmt, index, values);
				}
			}
			System.out.println(loggingPointValue);
		}
		
		System.out.println("####################################");
	}			
}
 
開發者ID:srasthofer,項目名稱:FuzzDroid,代碼行數:48,代碼來源:SmartConstantDataExtractorFuzzyAnalysis.java


注:本文中的com.google.common.collect.Table.contains方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。