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


Java Table.Cell方法代碼示例

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


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

示例1: MediaTypeClassifierImpl

import com.google.common.collect.Table; //導入方法依賴的package包/類
MediaTypeClassifierImpl(Iterable<? extends MediaType> mts) {
  Table<String, String, Set<MediaType>> typeTable =
      HashBasedTable.<String, String, Set<MediaType>>create();
  for (MediaType mt : mts) {
    String type = mt.type();
    String subtype = mt.subtype();
    Set<MediaType> typeSet = typeTable.get(type, subtype);
    if (typeSet == null) {
      typeSet = Sets.newLinkedHashSet();
      typeTable.put(type, subtype, typeSet);
    }
    typeSet.add(mt);
  }

  ImmutableTable.Builder<String, String, ImmutableSet<MediaType>> b =
      ImmutableTable.builder();
  for (Table.Cell<String, String, Set<MediaType>> cell
       : typeTable.cellSet()) {
    b.put(cell.getRowKey(), cell.getColumnKey(), ImmutableSet.copyOf(cell.getValue()));
  }
  this.types = b.build();
}
 
開發者ID:OWASP,項目名稱:url-classifier,代碼行數:23,代碼來源:MediaTypeClassifierBuilder.java

示例2: main

import com.google.common.collect.Table; //導入方法依賴的package包/類
public static void main(String[] args) {
    TreeBasedTable<Integer, Integer, Integer> table = TreeBasedTable.create();

    table.put(2, 0, 6);
    table.put(3, 2, 4);
    table.put(0, 0, 5);
    table.put(0, 3, 2);
    table.put(4, 1, 2);
    table.put(4, 4, 9);


    CSRSparseMatrix csr = new CSRSparseMatrix(table, 5);

    for (Table.Cell<Integer, Integer, Integer> cell : table.cellSet()) {
        if (csr.get(cell.getRowKey(), cell.getColumnKey()) == cell.getValue()) {
            System.out.println(String.format("%d->%d = %d", cell.getRowKey(), cell.getColumnKey(), cell.getValue()));
        } else {
            System.out.println("ERROR");
        }
    }


}
 
開發者ID:mayabot,項目名稱:mynlp,代碼行數:24,代碼來源:CSRSparseMatrix.java

示例3: renewSecureStore

import com.google.common.collect.Table; //導入方法依賴的package包/類
/**
 * Renews the {@link SecureStore} for all the running applications.
 *
 * @param liveApps set of running applications that need to have secure store renewal
 * @param renewer the {@link SecureStoreRenewer} for renewal
 * @param mergeCredentials {@code true} to merge with existing credentials
 * @return a {@link Multimap} containing the application runs that were failed to have secure store renewed
 */
private Multimap<String, RunId> renewSecureStore(Table<String, RunId, YarnTwillController> liveApps,
                                                 SecureStoreRenewer renewer, boolean mergeCredentials) {
  Multimap<String, RunId> failureRenews = HashMultimap.create();

  // Renew the secure store for each running application
  for (Table.Cell<String, RunId, YarnTwillController> liveApp : liveApps.cellSet()) {
    String application = liveApp.getRowKey();
    RunId runId = liveApp.getColumnKey();
    YarnTwillController controller = liveApp.getValue();

    try {
      renewer.renew(application, runId, new YarnSecureStoreWriter(application, runId, controller, mergeCredentials));
    } catch (Exception e) {
      LOG.warn("Failed to renew secure store for {}:{}", application, runId, e);
      failureRenews.put(application, runId);
    }
  }

  return failureRenews;
}
 
開發者ID:apache,項目名稱:twill,代碼行數:29,代碼來源:YarnTwillRunnerService.java

示例4: getXPath

import com.google.common.collect.Table; //導入方法依賴的package包/類
static String getXPath(Table<ACTIONS, LinkedList<ATTRIBUTES>, LinkedList<XPathValues>> xPathTable) {
    String xPath = "";
    for (Table.Cell<ACTIONS, LinkedList<ATTRIBUTES>, LinkedList<XPathValues>> tableCell : xPathTable.cellSet()) {

        if (tableCell.getColumnKey() == null)
            Assert.assertTrue("attributesList is null", false);

        if (tableCell.getValue() == null)
            Assert.assertTrue("listOfListValues is null", false);

        for (ATTRIBUTES attribute : tableCell.getColumnKey()) {

            for (XPathValues values : tableCell.getValue()) {
                xPath = xPath + XPathBuilder.getXPath(tableCell.getRowKey(), attribute, values);
            }
        }
    }
    return xPath;
}
 
開發者ID:ViliamS,項目名稱:XPathBuilder,代碼行數:20,代碼來源:IXPath.java

示例5: getXPath

import com.google.common.collect.Table; //導入方法依賴的package包/類
public String getXPath() {
    String xPath = "";

    for (Table.Cell<ACTIONS, LinkedList<ATTRIBUTES>, LinkedList<XPathValues>> tableCell : this.xPathTable.cellSet()) {

        if (tableCell.getColumnKey() == null)
            Assert.assertTrue("attributesList is null", false);
        if (tableCell.getValue() == null)
            Assert.assertTrue("listOfListValues is null", false);

        for (ATTRIBUTES attribute : tableCell.getColumnKey()) {
            for (XPathValues values : tableCell.getValue()) {
                    xPath = xPath + XPathBuilder.getXPath(tableCell.getRowKey(), attribute, values);
                }
            }
        }
    return xPath;
}
 
開發者ID:ViliamS,項目名稱:XPathBuilder,代碼行數:19,代碼來源:XPathActionsAttributesValues.java

示例6: endSummary

import com.google.common.collect.Table; //導入方法依賴的package包/類
@Override
public Set<Pair<Unit, Abstraction>> endSummary(SootMethod m, Abstraction d3) {
	Set<Pair<Unit, Abstraction>> res = null;
	
	for (Unit sP : icfg.getStartPointsOf(m)) {
		Set<Table.Cell<Unit,Abstraction,EdgeFunction<IFDSSolver.BinaryDomain>>> endSum =
				super.endSummary(sP, d3);
		if (endSum == null || endSum.isEmpty())
			continue;
		if (res == null)
			res = new HashSet<>();
		
		for (Table.Cell<Unit,Abstraction,EdgeFunction<IFDSSolver.BinaryDomain>> cell : endSum)
			res.add(new Pair<>(cell.getRowKey(), cell.getColumnKey()));
	}
	return res;
}
 
開發者ID:flankerhqd,項目名稱:JAADAS,代碼行數:18,代碼來源:InfoflowSolver.java

示例7: calHangZhouIndexer

import com.google.common.collect.Table; //導入方法依賴的package包/類
private JSONObject calHangZhouIndexer(Table<Integer,Double,Integer> detail){

        double totalRemainHouseCount=0,totalPriceSum=0,totalDealCount=0;

        for(Table.Cell<Integer,Double,Integer> cell : detail.cellSet()){
            totalRemainHouseCount += cell.getRowKey();
            totalPriceSum += cell.getColumnKey();
            totalDealCount += cell.getValue();
        }

        totalPriceSum/=detail.size();


        double index = 0;
        if(totalRemainHouseCount != 0){
            index = totalPriceSum * 1000 * totalDealCount / totalRemainHouseCount;
        }

        ESOP.writeToES("log/daily_index_detail_es", String.format("[杭州市][%s]剩餘庫存:%f,銷售均價總和:%f,銷售數量:%f,指數:%f",
                LocalDateTime.now().toString(),totalRemainHouseCount,totalPriceSum,totalDealCount,index));

        JSONObject jsonObject = new JSONObject();
        jsonObject.put("district","杭州市");
        jsonObject.put("index",index);
        return jsonObject;
    }
 
開發者ID:deanjin,項目名稱:houseHunter,代碼行數:27,代碼來源:indexCalculator.java

示例8: combineStrandJunctionsMaps

import com.google.common.collect.Table; //導入方法依賴的package包/類
/**
 * Combine junctions from both strands.  Used for Sashimi plot.
 * Note: Flanking depth arrays are not combined.
 */
private List<SpliceJunctionFeature> combineStrandJunctionsMaps() {

    // Start with all + junctions
    Table<Integer, Integer, SpliceJunctionFeature> combinedStartEndJunctionsMap = HashBasedTable.create(posStartEndJunctionsMap);

    // Merge in - junctions
    for (Table.Cell<Integer, Integer, SpliceJunctionFeature> negJunctionCell : negStartEndJunctionsMap.cellSet()) {

        int junctionStart = negJunctionCell.getRowKey();
        int junctionEnd = negJunctionCell.getColumnKey();
        SpliceJunctionFeature negFeat = negJunctionCell.getValue();

        SpliceJunctionFeature junction = combinedStartEndJunctionsMap.get(junctionStart, junctionEnd);

        if (junction == null) {
            // No existing (+) junction here, just add the (-) one\
            combinedStartEndJunctionsMap.put(junctionStart, junctionEnd, negFeat);
        } else {
            int newJunctionDepth = junction.getJunctionDepth() + negFeat.getJunctionDepth();
            junction.setJunctionDepth(newJunctionDepth);
        }
    }

    return new ArrayList<SpliceJunctionFeature>(combinedStartEndJunctionsMap.values());
}
 
開發者ID:hyounesy,項目名稱:ALEA,代碼行數:30,代碼來源:SpliceJunctionHelper.java

示例9: testHashing

import com.google.common.collect.Table; //導入方法依賴的package包/類
public void testHashing() throws Exception {
  for (String stringToTest : INPUTS) {
    for (Table.Cell<String, SecretKey, HashFunction> cell : ALGORITHMS.cellSet()) {
      String algorithm = cell.getRowKey();
      SecretKey key = cell.getColumnKey();
      HashFunction hashFunc = cell.getValue();
      assertMacHashing(HashTestUtils.ascii(stringToTest), algorithm, key, hashFunc);
    }
  }
}
 
開發者ID:zugzug90,項目名稱:guava-mock,代碼行數:11,代碼來源:MacHashFunctionTest.java

示例10: createCellDependencies

import com.google.common.collect.Table; //導入方法依賴的package包/類
private static Stream<MavenDependency> createCellDependencies(
    final Table.Cell<String, String, Dependencies.Maven> cell) {
  final String groupIdBase = cell.getRowKey();
  final String artifactIdBase = cell.getColumnKey();
  final Dependencies.Maven dependencySpec = cell.getValue();
  assert dependencySpec != null;

  // TODO(dflemstr): handle absent version, which is "dependency management"?
  final String version = dependencySpec.version().get();

  return buildCoords(groupIdBase, artifactIdBase, dependencySpec.modules())
      .map(coord -> MavenDependency.create(coord, version, Optional.empty(), false));
}
 
開發者ID:spotify,項目名稱:bazel-tools,代碼行數:14,代碼來源:MavenDependencies.java

示例11: setAnimation

import com.google.common.collect.Table; //導入方法依賴的package包/類
public void setAnimation(Triple<Integer, Integer, Float> animData, Table<Integer, Optional<Node<?>>, Key> keyData)
{
    ImmutableTable.Builder<Integer, Node<?>, Key> builder = ImmutableTable.builder();
    for(Table.Cell<Integer, Optional<Node<?>>, Key> key : keyData.cellSet())
    {
        builder.put(key.getRowKey(), key.getColumnKey().or(this), key.getValue());
    }
    setAnimation(new Animation(animData.getLeft(), animData.getMiddle(), animData.getRight(), builder.build()));
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:10,代碼來源:B3DModel.java

示例12: getDepartmentByDistrict

import com.google.common.collect.Table; //導入方法依賴的package包/類
public List<DepartmentInfo> getDepartmentByDistrict(final Table<String, String, String> districtTable) throws IOException, ParserException {
    List<DepartmentInfo> departmentInfoList = new ArrayList<>();
    for (Table.Cell<String, String, String> cell : districtTable.cellSet()) {
        departmentInfoList.addAll(runDistrict(cell, true));
        try {
            Thread.sleep(1000);
        } catch (Exception e) {

        }
    }
    return departmentInfoList;
}
 
開發者ID:deanjin,項目名稱:houseHunter,代碼行數:13,代碼來源:DepartmentParser.java

示例13: runDistrict

import com.google.common.collect.Table; //導入方法依賴的package包/類
public List<DepartmentInfo> runDistrict(final Table.Cell<String, String, String> district, boolean jsutReturnDepartmentList) throws IOException, ParserException {

        List<DepartmentInfo> ReturnDepartmentInfoList = new ArrayList<>();
        //獲取區的頁數
        DepartmentParser departmentParser = new DepartmentParser();
        String url = URLConfig.URL_PREFIX + district.getRowKey();
        int page = departmentParser.parsePageInfo(url);
        log.info("get department page:{}", page);

        //獲取每一個區的信息
        String currentDepartmentUrl;
        for (int i = 1; i <= page; i++) {
            currentDepartmentUrl = String.format("%s&page=%d", url, i);
            try {
                List<DepartmentInfo> departmentInfoList = departmentParser.parseDepartment(currentDepartmentUrl, district.getColumnKey(), district.getValue());
                if (jsutReturnDepartmentList) {
                    ReturnDepartmentInfoList.addAll(departmentInfoList);
                } else {
                    HouseParser houseParser = new HouseParser();
                    houseParser.run(departmentInfoList, true, null, null, null);
                }
            } catch (Exception e) {
                log.info("failed to parse {} page departments, url is:{}, exception:{}", i, currentDepartmentUrl, e);
            }

            log.info("finish to parse {} page departments, url is:{}", i, currentDepartmentUrl);
        }

        log.info("finish to parse distinct:{}", district);

        return ReturnDepartmentInfoList;
    }
 
開發者ID:deanjin,項目名稱:houseHunter,代碼行數:33,代碼來源:DepartmentParser.java

示例14: accuracy

import com.google.common.collect.Table; //導入方法依賴的package包/類
public double accuracy() {
    int hits = 0;
    int misses = 0;
    for (Table.Cell<Integer, Integer, Integer> cell : table.cellSet()) {
        if (cell.getRowKey().equals(cell.getColumnKey())) {
            hits = hits + cell.getValue();
        } else {
            misses = misses + cell.getValue();
        }
    }
    return hits / ((hits + misses) * 1.0);
}
 
開發者ID:jtablesaw,項目名稱:tablesaw,代碼行數:13,代碼來源:StandardConfusionMatrix.java

示例15: accuracy

import com.google.common.collect.Table; //導入方法依賴的package包/類
@Override
public double accuracy() {
    int hits = 0;
    int misses = 0;
    for (Table.Cell<Integer, Integer, Integer> cell : table.cellSet()) {
        if (cell.getRowKey().equals(cell.getColumnKey())) {
            hits = hits + cell.getValue();
        } else {
            misses = misses + cell.getValue();
        }
    }
    return hits / ((hits + misses) * 1.0);
}
 
開發者ID:jtablesaw,項目名稱:tablesaw,代碼行數:14,代碼來源:CategoryConfusionMatrix.java


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