本文整理汇总了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();
}
示例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");
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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());
}
示例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);
}
}
}
示例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));
}
示例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()));
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}