本文整理汇总了Java中org.apache.commons.lang3.tuple.Triple.getMiddle方法的典型用法代码示例。如果您正苦于以下问题:Java Triple.getMiddle方法的具体用法?Java Triple.getMiddle怎么用?Java Triple.getMiddle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.tuple.Triple
的用法示例。
在下文中一共展示了Triple.getMiddle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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());
}
}
示例2: 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;
}
示例3: 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);
});
}
}
示例4: itemCustomParamSql
import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
private static void itemCustomParamSql(List<Object> params, StringBuilder where_sql,
List<Triple<String, Condition, Object>> custom_params,
boolean append_and) {
for (Triple<String, Condition, Object> custom_param : custom_params) {
if (append_and) {
where_sql.append(" AND ");
}
where_sql.append(custom_param.getLeft());
final Condition con = custom_param.getMiddle();
where_sql.append(con.condition);
switch (con) {
case BETWEEN:
final Object[] value2 = (Object[]) custom_param.getRight();
params.add(value2[0]);
params.add(value2[1]);
break;
default:
params.add(custom_param.getRight());
break;
}
append_and = true;
}
}
示例5: 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;
}
示例6: 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;
}
示例7: 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;
}
}
示例8: 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);
}
示例9: 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));
}
}
示例10: 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));
}
示例11: layoutLayer
import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
@Override
protected void layoutLayer() {
boolean prevSelected = false;
for (Triple<GPXWaypoint, Node, Line> triple : myPoints) {
final GPXWaypoint point = triple.getLeft();
final Node icon = triple.getMiddle();
final Line line = triple.getRight();
final boolean selected = selectedGPXWaypoints.contains(point);
// first point doesn't have a line
if (line != null) {
if (selected && prevSelected) {
// if selected AND previously selected => red line
line.setStrokeWidth(3);
line.setStroke(Color.RED);
} else {
line.setStrokeWidth(2);
line.setStroke(Color.BLUE);
}
}
prevSelected = selected;
final Point2D mapPoint = baseMap.getMapPoint(point.getWaypoint().getLatitude(), point.getWaypoint().getLongitude());
icon.toFront();
icon.setTranslateX(mapPoint.getX());
icon.setTranslateY(mapPoint.getY());
}
}
示例12: stringifyEntityVersionList
import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
/**
* Method used to stringify an EntityVersion Triple list with the associated schema info.
* @param entityVersionList The EntityVersion Triple list.
* @return A String containing a serialized EntityVersion Triple list.
*/
public String stringifyEntityVersionList(List<Triple<EntityVersion, Set<EntityVersion>, Set<Entity>>> entityVersionList)
{
if (entityVersionList == null)
return null;
Collections.sort(entityVersionList, new Comparator<Triple<EntityVersion, Set<EntityVersion>, Set<Entity>>>()
{
public int compare(Triple<EntityVersion, Set<EntityVersion>, Set<Entity>> o1, Triple<EntityVersion, Set<EntityVersion>, Set<Entity>> o2)
{
return o1.getLeft().getVersionId() < o2.getLeft().getVersionId() ? -1 : 1;
}
});
StringBuilder result = new StringBuilder();
result.append("Printing EntityVersion list...\n");
if (entityVersionList.isEmpty())
result.append("EntityVersion list is empty.\n");
else
{
result.append("[\n");
for (Triple<EntityVersion, Set<EntityVersion>, Set<Entity>> triple : entityVersionList)
{
result.append("\t<EntityVersion " + triple.getLeft().getVersionId() + ", EntityVersion List: [ ");
for (EntityVersion ev : triple.getMiddle())
result.append("EV_" + ev.getVersionId() + " ");
result.append("],");
result.append(" Entity List: [ ");
for (Entity e : triple.getRight())
result.append(e.getName() + " ");
result.append("]>\n");
}
result.append("]\n");
}
return result.toString();
}
示例13: stringifyEntityList
import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
/**
* Method used to stringify an Entity Triple list with the associated schema info.
* @param entityList The Entity Triple list.
* @return A String containing a serialized Entity Triple list.
*/
public String stringifyEntityList(List<Triple<Entity, Set<EntityVersion>, Set<Entity>>> entityList)
{
if (entityList == null)
return null;
Collections.sort(entityList, new Comparator<Triple<Entity, Set<EntityVersion>, Set<Entity>>>()
{
public int compare(Triple<Entity, Set<EntityVersion>, Set<Entity>> o1, Triple<Entity, Set<EntityVersion>, Set<Entity>> o2)
{
return o1.getLeft().getName().compareTo(o2.getLeft().getName());
}
});
StringBuilder result = new StringBuilder();
result.append("Printing Entity list...\n");
if (entityList.isEmpty())
result.append("Entity list is empty.\n");
else
{
result.append("[\n");
for (Triple<Entity, Set<EntityVersion>, Set<Entity>> triple : entityList)
{
result.append("\t<Entity " + triple.getLeft().getName() + ", EntityVersion List: [ ");
for (EntityVersion ev : triple.getMiddle())
result.append("EV_" + ev.getVersionId() + " ");
result.append("],");
result.append(" Entity List: [ ");
for (Entity e : triple.getRight())
result.append(e.getName() + " ");
result.append("]>\n");
}
result.append("]\n");
}
return result.toString();
}
示例14: searchItem
import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
private static String searchItem(Triple<String, String, String> triple) {
String fieldName = triple.getLeft();
String operator = triple.getMiddle();
String fieldValue = triple.getRight();
String result = " `" + fieldName + "` ";
switch (operator) {
case "LIKE":
result += " like '%" + fieldValue + "%' ";
break;
case "EQ":
result += " = '" + fieldValue + "' ";
break;
case "GTE":
result += " >= '" + fieldValue + "' ";
break;
case "LTE":
result += " <= '" + fieldValue + "' ";
break;
case "GT":
result += " > '" + fieldValue + "' ";
break;
case "LT":
result += " < '" + fieldValue + "' ";
break;
}
return result;
}
示例15: getParcelSize
import org.apache.commons.lang3.tuple.Triple; //导入方法依赖的package包/类
public int getParcelSize() {
int total = 12;
for (Triple<AttachmentModel, String, String> tuple : attachments) {
total += 40;
AttachmentModel attachment = tuple.getLeft();
String hash = tuple.getMiddle();
String post = tuple.getRight();
if (attachment.thumbnail != null) total += attachment.thumbnail.length()*2;
if (attachment.path != null) total += attachment.path.length()*2;
if (attachment.originalName != null) total += attachment.originalName.length()*2;
if (hash != null) total += hash.length()*2;
if (post != null) total += post.length()*2;
}
return total;
}