本文整理汇总了Java中org.apache.commons.lang3.tuple.Triple.getLeft方法的典型用法代码示例。如果您正苦于以下问题:Java Triple.getLeft方法的具体用法?Java Triple.getLeft怎么用?Java Triple.getLeft使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.tuple.Triple
的用法示例。
在下文中一共展示了Triple.getLeft方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLBUpperBound2
import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
public Pair<HashSet<ScoredAnnotation>, Integer> getLBUpperBound2(String query,
HashSet<Annotation> goldStandardAnn, BindingGenerator bg, SmaphDebugger debugger)
throws Exception {
QueryInformation qi = getQueryInformation(query, debugger);
List<Triple<HashSet<Annotation>, BindingFeaturePack, Double>> bindingToFtrsAndF1 = getLBBindingToFtrsAndF1(
query, qi, goldStandardAnn, new StrongAnnotationMatch(
wikiApi), qi.allCandidates(), debugger);
HashSet<Annotation> bestBinding = null;
double bestF1 = Double.NEGATIVE_INFINITY;
for (Triple<HashSet<Annotation>, BindingFeaturePack, Double> bindingAndFtrsAndF1 : bindingToFtrsAndF1) {
double f1 = bindingAndFtrsAndF1.getRight();
if (f1 > bestF1) {
bestBinding = bindingAndFtrsAndF1.getLeft();
bestF1 = f1;
}
}
HashSet<ScoredAnnotation> bestBindingScored = new HashSet<>();
for (Annotation a: bestBinding)
bestBindingScored.add(new ScoredAnnotation(a.getPosition(), a.getLength(), a.getConcept(), 1.0f));
return new Pair<HashSet<ScoredAnnotation>, Integer>(bestBindingScored,
bindingToFtrsAndF1.size());
}
示例2: getUpperBoundMentions
import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
public HashSet<ScoredAnnotation> getUpperBoundMentions(String query,
HashSet<Annotation> goldStandardAnn, BindingGenerator bg, SmaphDebugger debugger)
throws Exception {
QueryInformation qi = getQueryInformation(query, debugger);
List<Triple<HashSet<Annotation>, BindingFeaturePack, Double>> bindingToFtrsAndF1 = getLBBindingToFtrsAndF1(
query, qi, goldStandardAnn,
new StrongMentionAnnotationMatch(), qi.allCandidates(), debugger);
HashSet<Annotation> bestBinding = null;
double bestF1 = Double.NEGATIVE_INFINITY;
for (Triple<HashSet<Annotation>, BindingFeaturePack, Double> bindingAndFtrsAndF1 : bindingToFtrsAndF1) {
double f1 = bindingAndFtrsAndF1.getRight();
if (f1 > bestF1) {
bestBinding = bindingAndFtrsAndF1.getLeft();
bestF1 = f1;
}
}
if (bestBinding == null) return null;
HashSet<ScoredAnnotation> bestBindingScored= new HashSet<>();
for (Annotation a : bestBinding)
bestBindingScored.add(new ScoredAnnotation(a.getPosition(), a.getLength(), a.getConcept(), 1.0f));
return bestBindingScored;
}
示例3: processApplication
import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
private void processApplication(Map<String, Application> appCache,
Map.Entry<String, Pair<Set<GrpcHost>, Set<GrpcHost>>> entry) {
Triple<String, String, String> appNameServiceVersion = getAppNameServiceVersion(entry.getKey());
Pair<Set<GrpcHost>, Set<GrpcHost>> providerConsumer = entry.getValue();
String appName = appNameServiceVersion.getLeft();
String serviceName = appNameServiceVersion.getMiddle();
String version = appNameServiceVersion.getRight();
Application application = new Application(appName);
GrpcService service = new GrpcService(appName, version, serviceName);
if (providerConsumer.getLeft() != null) {
service.addProviderHosts(providerConsumer.getLeft());
}
if (providerConsumer.getRight() != null) {
service.addConsumerHosts(providerConsumer.getRight());
}
application.addService(service);
if (appCache.get(application.getAppName()) == null) {
appCache.put(application.getAppName(), application);
} else {
appCache.get(application.getAppName()).addServices(application.getServices());
}
}
示例4: run
import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
@Override
public Object run() {
RequestContext ctx = RequestContext.getCurrentContext();
HttpServletRequest request = ctx.getRequest();
String auth = request.getHeader("Authorization");
String accessToken = auth.split(" ")[1];
ctx.set("LimitAccess", Boolean.TRUE);
try {
Triple<Long, String, Long> clientTriple = databaseUserDetailService.loadClientByToken(accessToken);
String user = clientTriple.getMiddle();
Long intervalInMills = clientTriple.getLeft();
Long limits = clientTriple.getRight();
if (intervalInMills != null && intervalInMills != 0l && limits != null && limits != 0l) {
if (!access(user, intervalInMills, limits)) {
ctx.set("LimitAccess", Boolean.FALSE);
ctx.setSendZuulResponse(false);
ctx.setResponseStatusCode(HttpServletResponse.SC_BAD_REQUEST);
ctx.setResponseBody("The times of usage is limited");
}
}
} catch (Throwable e) {
}
return null;
}
示例5: setRelativeState
import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
private void setRelativeState(Triple<IBlockState, EnumFacing, NBTTagCompound> data) {
BlockPos pos = getPos().offset(getFacingLazy());
IBlockState state = data.getLeft();
EnumFacing from = data.getMiddle();
EnumFacing to = getFacingLazy();
if(state.getBlock().canPlaceBlockAt(world, pos)) {
world.setBlockState(pos, getRotationState(state, from, to));
getTile(TileEntity.class, world, pos).ifPresent(tile -> {
NBTTagCompound tag = data.getRight();
tag.setInteger("x", pos.getX());
tag.setInteger("y", pos.getY());
tag.setInteger("z", pos.getZ());
tile.readFromNBT(tag);
});
}
}
示例6: calculateURI
import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
public static Pair<RaptureURI, String> calculateURI(String leafTail) {
String variant = (leafTail.startsWith(CONTENTDIR)) ? null : extractVariant(leafTail);
Triple<String, String, Scheme> trip = extractScheme(leafTail.substring(variantLength(variant)));
checkArgument(trip != null, "extraneuous file");
RaptureURI uri = null;
switch (trip.getRight()) {
case USER:
case ENTITLEMENTGROUP:
if (trip.getLeft().indexOf("/") == -1) {
uri = new RaptureURI(trip.getLeft(), trip.getRight());
}
break;
default:
break;
}
if (uri == null) {
uri = RaptureURI.createFromFullPathWithAttribute(trip.getLeft(), trip.getMiddle(), trip.getRight());
}
return new ImmutablePair<RaptureURI, String>(uri, variant);
}
示例7: writeToParcel
import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(initPosition);
dest.writeInt(shouldWaitForPageLoaded ? 1 : 0);
dest.writeInt(attachments.size());
for (Triple<AttachmentModel, String, String> tuple : attachments) {
AttachmentModel attachment = tuple.getLeft();
dest.writeInt(attachment.type);
dest.writeInt(attachment.size);
dest.writeString(attachment.thumbnail);
dest.writeString(attachment.path);
dest.writeInt(attachment.width);
dest.writeInt(attachment.height);
dest.writeString(attachment.originalName);
dest.writeInt(attachment.isSpoiler ? 1 : 0);
dest.writeString(tuple.getMiddle());
dest.writeString(tuple.getRight());
}
}
示例8: testSetGetAttribute
import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
private void testSetGetAttribute(MBeanServerConnection connection, ObjectName name) throws Exception {
for (Triple<String, String, String> pair : mbeanAttributes) {
String attrName = pair.getLeft();
String attrType = pair.getRight();
Object attrValue;
if (attrType.equals("int"))
attrValue = RandomUtils.nextInt(30000, 65535);
else if (attrType.equals("long"))
attrValue = RandomUtils.nextLong(10, 1000);
else
attrValue = RandomStringUtils.randomAlphabetic(10);
Attribute attr1 = new Attribute(attrName, attrValue);
server.setAttribute(name, attr1);
Object attr2 = server.getAttribute(name, attrName);
assertEquals("Attribute values do not match", attrValue, attr2);
}
}
示例9: compare
import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
@Override
public int compare(Triple<Double, String[], Tag> o1,
Triple<Double, String[], Tag> o2) {
double diff = o1.getLeft() - o2.getLeft();
if (diff < 0)
return -1;
else if (diff == 0)
return 0;
else
return 1;
}
示例10: buildQueryCondition
import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
private Set<String> buildQueryCondition(String search, String dimension, Boolean accurate) {
Set<String> beAboutToQuery = Sets.newHashSet();
Map<String, Pair<Set<GrpcHost>, Set<GrpcHost>>> servicesPassing = registryRepository.getAllPassingService();
for (Map.Entry<String, Pair<Set<GrpcHost>, Set<GrpcHost>>> entry : servicesPassing.entrySet()) {
String serviceKey = entry.getKey();
Triple<String, String, String> appNameServiceVersion = getAppNameServiceVersion(serviceKey);
String appName = appNameServiceVersion.getLeft();
String serviceName = appNameServiceVersion.getMiddle();
if (dimension.equals("service")) {
if (accurate) {
if (StringUtils.equalsIgnoreCase(serviceName, search)) {
beAboutToQuery.add(serviceKey);
}
} else {
if (StringUtils.containsIgnoreCase(serviceName, search)) {
beAboutToQuery.add(serviceKey);
}
}
} else {
if (accurate) {
if (StringUtils.equalsIgnoreCase(appName, search)) {
beAboutToQuery.add(serviceKey);
}
} else {
if (StringUtils.containsIgnoreCase(appName, search)) {
beAboutToQuery.add(serviceKey);
}
}
}
}
return beAboutToQuery;
}
示例11: buildQueryResponse
import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
private List<GrpcService> buildQueryResponse(Set<String> queryCondition, Boolean accurate) {
List<GrpcService> services = Lists.newArrayList();
Map<String, Pair<Set<GrpcHost>, Set<GrpcHost>>> servicesPassing = registryRepository.getAllPassingService();
for (Iterator<String> it = queryCondition.iterator(); it.hasNext();) {
String serviceKey = it.next();
Triple<String, String, String> appNameServiceVersion = getAppNameServiceVersion(serviceKey);
Pair<Set<GrpcHost>, Set<GrpcHost>> providerConsumer = servicesPassing.get(serviceKey);
GrpcService service = new GrpcService(appNameServiceVersion.getLeft(), appNameServiceVersion.getRight(),
appNameServiceVersion.getMiddle());
service.setProviderHost(providerConsumer.getLeft());
service.setConsumerHost(providerConsumer.getRight());
services.add(service);
}
return services;
}
示例12: genCheck
import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
private void genCheck()
{
if(!full)
{
Pair<Matrix3f, Vector3f> pair = toAffine(matrix);
Triple<Quat4f, Vector3f, Quat4f> triple = svdDecompose(pair.getLeft());
this.translation = pair.getRight();
this.leftRot = triple.getLeft();
this.scale = triple.getMiddle();
this.rightRot = triple.getRight();
full = true;
}
}
示例13: toDouble
import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
@Override
public double toDouble(Triple<Double, Double, Double> value) {
switch (element) {
case LEFT: return value.getLeft();
case MIDDLE: return value.getMiddle();
case RIGHT: return value.getRight();
}
throw new AssertionError(element);
}
示例14: value
import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
void value(NodeMsg nodeMsg) {
Triple<Long, String, Pair<Long, Serializable>> rKeyTsprimeVprime = (Triple<Long, String, Pair<Long, Serializable>>) nodeMsg.body;
long r = rKeyTsprimeVprime.getLeft();
String key = rKeyTsprimeVprime.getMiddle();
Pair<Long, Serializable> tsprimeVprime = rKeyTsprimeVprime.getRight();
//
ridReadlist.get(r).put(nodeMsg.getSource(), tsprimeVprime);
if (ridReadlist.get(r).size() > group.size() / 2) {
Pair<Long, Serializable> maxtsReadval = highest(r);
ridReadlist.get(r).clear();
bcast(group, nodeMsg.rid, NodeMsg.WRITE, groupId, Triple.of(r, key, maxtsReadval));
}
}
示例15: write
import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
void write(NodeMsg nodeMsg) {
Triple<Long, String, Pair<Long, Serializable>> rKeyTsprimeVprime = (Triple<Long, String, Pair<Long, Serializable>>) nodeMsg.body;
long r = rKeyTsprimeVprime.getLeft();
String key = rKeyTsprimeVprime.getMiddle();
Pair<Long, Serializable> tsprimeVprime = rKeyTsprimeVprime.getRight();
//
if (keyTsVal.get(key) == null || tsprimeVprime.getLeft() > keyTsVal.get(key).getLeft()) {
keyTsVal.put(key, tsprimeVprime);
}
send(nodeMsg.getSource(), nodeMsg.rid, NodeMsg.ACK, groupId, Pair.of(r, key));
}