本文整理汇总了Java中org.apache.commons.lang3.tuple.Pair.getRight方法的典型用法代码示例。如果您正苦于以下问题:Java Pair.getRight方法的具体用法?Java Pair.getRight怎么用?Java Pair.getRight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.tuple.Pair
的用法示例。
在下文中一共展示了Pair.getRight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromObject
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
private WrappedFluidStack fromObject(JsonElement json, JsonDeserializationContext context)
{
WrappedFluidStackImpl stack = new WrappedFluidStackImpl();
JsonObject jsonObject = json.getAsJsonObject();
if (jsonObject.has("fluid"))
{
JsonElement element = jsonObject.get("fluid");
if (element.isJsonPrimitive() && element.getAsJsonPrimitive().isString())
{
Pair<String, Integer> pair = parseFluidPart(element.getAsString());
element = new JsonPrimitive(pair.getLeft());
stack.amount = pair.getRight();
}
stack.fluid = context.deserialize(element, String.class);
}
if (jsonObject.has("amount"))
stack.amount = jsonObject.get("amount").getAsInt();
return stack;
}
示例2: onBlockActivated
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
if (worldIn.isRemote)
{
return true;
}
if (worldIn.getTileEntity(pos) != null && worldIn.getTileEntity(pos).hasCapability(ExPCropCapability.cropCap, null))
{
IExPCrop crop = IExPCrop.of(worldIn.getTileEntity(pos));
Pair<EnumActionResult, NonNullList<ItemStack>> ret = crop.onHarvest(playerIn, worldIn, pos, state, hand, playerIn.getHeldItem(hand), true);
if (ret.getLeft() == EnumActionResult.SUCCESS)
{
for (ItemStack is : ret.getRight())
{
EntityItem drop = new EntityItem(worldIn, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, is.copy());
worldIn.spawnEntity(drop);
}
}
}
return false;
}
示例3: onBlockHarvested
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
@Override
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player)
{
if (worldIn.getTileEntity(pos) != null && worldIn.getTileEntity(pos).hasCapability(ExPCropCapability.cropCap, null))
{
IExPCrop crop = IExPCrop.of(worldIn.getTileEntity(pos));
Pair<EnumActionResult, NonNullList<ItemStack>> ret = crop.onHarvest(player, worldIn, pos, state, EnumHand.MAIN_HAND, player.getHeldItemMainhand(), false);
if (ret.getLeft() == EnumActionResult.SUCCESS)
{
for (ItemStack is : ret.getRight())
{
EntityItem drop = new EntityItem(worldIn, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, is.copy());
worldIn.spawnEntity(drop);
}
}
}
super.onBlockHarvested(worldIn, pos, state, player);
}
示例4: testChecksumParameter
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
@Test
public void testChecksumParameter() throws IOException {
final String command = "-4 30313233343536373839414243444546 /1 -c udp,ipv4";
final Pair<ParseGraph, ParseGraph> values = CLToolTestUtil.getPacketValues(new File(_basePath + "/1udpdns.pcap"), _tempFolder.newFile(), command);
final ParseGraph preValues = values.getLeft();
final ParseGraph postValues = values.getRight();
assertAddressesDiffer(preValues, postValues);
assertEq(TestUtil.valueAtDepth(preValues, "headerchecksum", 0), new byte[]{(byte) 0xAC, (byte) 0x82});
assertEq(TestUtil.valueAtDepth(postValues, "headerchecksum", 0), new byte[]{(byte) 0xAF, 0x22});
assertEq(TestUtil.valueAtDepth(preValues, "udpchecksum", 0), new byte[]{0x7C, 0x15});
assertEq(TestUtil.valueAtDepth(postValues, "udpchecksum", 0), new byte[]{0x7E, (byte) 0xB5});
}
示例5: addPoint
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
/**
* Add a point corresponding to the given IP
*
* @param ipAndHost the IP and host
* @param latency latency
* @param dnslookupTime
*/
protected RoutePoint addPoint(final Pair<String, String> ipAndHost, final int latency, final long dnslookupTime) {
final String ip = ipAndHost.getLeft();
final String dns = ipAndHost.getRight();
RoutePoint point;
// set to previous point
RoutePoint previous = null;
if (!_route.isEmpty()) {
previous = _route.get(_route.size() - 1);
}
if (ip.startsWith("192.168.") || ip.equals("127.0.0.1")) {
// private Ips, calculate location with public IP
point = _services.getGeo().populateGeoDataForIP(new RoutePoint(), _services.getGeo().getPublicIp().getLeft(), null);
point.setIp(ip);
} else {
point = _services.getGeo().populateGeoDataForIP(new RoutePoint(), ip, dns, previous);
}
// unknown location
if (point.isUnknownGeo()) {
if (_route.isEmpty()) {
// set to local ip
point = _services.getGeo().populateGeoDataForIP(new RoutePoint(), _services.getGeo().getPublicIp().getLeft(), null);
} else {
point.setCountry(previous.getCountry());
point.setCountryIso(previous.getCountryIso());
point.setTown(previous.getTown());
point.setLat(previous.getLat());
point.setLon(previous.getLon());
}
}
point.setNumber(_route.size() + 1);
point.setLatency(latency);
point.setDnsLookUpTime(dnslookupTime);
point.setHostname(dns);
return addPoint(point);
}
示例6: getCronyxToQuartzConverter
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
private CronyxToQuartzConverter getCronyxToQuartzConverter(TriggerDefinition triggerDefinition) {
Pair<Class, CronyxToQuartzConverter> pair = pairs.stream()
.filter(p -> p.getLeft().isInstance(triggerDefinition))
.findFirst()
.orElseThrow(() -> new CronyxException("Could not find a CronyxToQuartzConverter to the triggerDefinition " + triggerDefinition.toString()));
return pair.getRight();
}
示例7: BaseRecipeCategory
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
protected BaseRecipeCategory(R recipe, IGuiHelper guiHelper, Class<M> moduleClass)
{
this.recipe = recipe;
uid = recipe.getUid();
title = recipe.title;
gui = recipe.getGui();
tileEntity = TileEntityRegistry.getContent(recipe.tileEntity);
Pair<String, M> pair = getModule(moduleClass);
this.moduleName = pair.getLeft();
this.module = pair.getRight();
background = guiHelper.createDrawable(gui.bg, recipe.bgX, recipe.bgY, recipe.bgWidth, recipe.bgHeight);
}
示例8: closeOpenConnections
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
/**
* Closes any open connections to shards. Does a best-effort close and doesn't throw.
*/
public void closeOpenConnections() {
for (Pair<ShardLocation, Connection> conn : this.getShardConnections()) {
try {
if (conn.getRight() != null && !conn.getRight().isClosed()) {
conn.getRight().close();
}
}
catch (SQLException e) {
e.printStackTrace();
}
}
}
示例9: testUDPNBNS
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
@Test
public void testUDPNBNS() throws IOException {
final Pair<ParseGraph, ParseGraph> values = CLToolTestUtil.getPacketValues(new File(_basePath + "/1udpnbns.pcap"), _tempFolder.newFile(), CLToolTestUtil.PEF_COMMAND);
final ParseGraph preValues = values.getLeft();
final ParseGraph postValues = values.getRight();
assertAddressesDiffer(preValues, postValues);
assertEq(TestUtil.valueAtDepth(preValues, "headerchecksum", 0), new byte[]{(byte) 0xFA, (byte) 0xEB});
assertEq(TestUtil.valueAtDepth(postValues, "headerchecksum", 0), new byte[]{(byte) 0xC3, (byte) 0xD3});
assertEq(TestUtil.valueAtDepth(preValues, "udpchecksum", 0), new byte[]{0x69, 0x55});
assertEq(TestUtil.valueAtDepth(postValues, "udpchecksum", 0), new byte[]{0x32, 0x3D});
}
示例10: mine
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
public long mine(long fullSize, byte[][] dataset, byte[] blockHeaderTruncHash, long difficulty) {
BigInteger target = valueOf(2).pow(256).divide(valueOf(difficulty));
long nonce = new Random().nextLong();
while(!Thread.currentThread().isInterrupted()) {
nonce++;
Pair<byte[], byte[]> pair = hashimotoFull(fullSize, dataset, blockHeaderTruncHash, longToBytes(nonce));
BigInteger h = new BigInteger(1, pair.getRight() /* ?? */);
if (h.compareTo(target) < 0) break;
}
return nonce;
}
示例11: getStoreShardFromToken
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
/**
* Helper function to obtain a store shard object from given recovery token.
*
* @param operationName
* Operation name.
* @param token
* Token from DetectMappingDifferences.
* @param ssmLocal
* Reference to store shard map corresponding to the token.
* @return Store shard object corresponding to given token, or null if shard map is default shard map.
*/
private StoreShard getStoreShardFromToken(String operationName,
RecoveryToken token,
ReferenceObjectHelper<StoreShardMap> ssmLocal) {
Pair<StoreShardMap, StoreShard> shardInfoLocal;
if (this.getStoreShardMaps().containsKey(token)) {
shardInfoLocal = this.getStoreShardMaps().get(token);
}
else {
throw new IllegalArgumentException(StringUtilsLocal.formatInvariant(Errors._Recovery_InvalidRecoveryToken, token),
new Throwable("token"));
}
ssmLocal.argValue = shardInfoLocal.getLeft();
StoreShard ssLocal = shardInfoLocal.getRight();
ShardLocation location = this.getShardLocation(token);
try (IStoreOperationLocal op = this.getShardMapManager().getStoreOperationFactory().createCheckShardLocalOperation(operationName,
this.getShardMapManager(), location)) {
op.doLocal();
}
catch (IOException e) {
e.printStackTrace();
throw (ShardManagementException) e.getCause();
}
return new StoreShard(ssLocal.getId(), ssLocal.getVersion(), ssLocal.getShardMapId(), ssLocal.getLocation(), ssLocal.getStatus());
}
示例12: generateField
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
public static Field generateField(byte[] contents, int start, ClassFile classFile) {
int accessFlag = (int) byte2UnsignedInt(Arrays.copyOfRange(contents, start, start + 2));
List<FieldAccessFlag> accessFlags = _parseFieldAccessFlag(accessFlag);
int nameIndex = (int) byte2UnsignedInt(Arrays.copyOfRange(contents, start + 2, start + 4));
int descriptorIndex = (int) byte2UnsignedInt(Arrays.copyOfRange(contents, start + 4, start + 6));
int attributesCount = (int) byte2UnsignedInt(Arrays.copyOfRange(contents, start + 6, start + 8));
Pair<List<AbstractAttribute>, Integer> pair = _parseFieldAttribute(contents, start + 8, attributesCount, classFile);
return new Field(accessFlag, accessFlags, nameIndex, descriptorIndex, attributesCount, pair.getLeft(), start, pair.getRight(), classFile.getConstantPool());
}
示例13: generateMethod
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
public static Method generateMethod(byte[] content, int start, ClassFile classFile) {
ConstantPool pool = classFile.getConstantPool();
int accessFlag = (int) byte2UnsignedInt(Arrays.copyOfRange(content, start, start + 2));
List<MethodAccessFlag> methodAccessFlags = _parseMethodAccessFlag(accessFlag);
int nameIndex = (int) byte2UnsignedInt(Arrays.copyOfRange(content, start + 2, start + 4));
String name = pool.getUTF8String(nameIndex);
int descriptorIndex = (int) byte2UnsignedInt(Arrays.copyOfRange(content, start + 4, start + 6));
String descriptor = pool.getUTF8String(descriptorIndex);
int attributesCount = (int) byte2UnsignedInt(Arrays.copyOfRange(content, start + 6, start + 8));
Pair<List<AbstractAttribute>, Integer> pair = _parseMethodAttribute(content, start + 8, attributesCount, classFile);
return new Method(accessFlag, methodAccessFlags, nameIndex, name, descriptorIndex, descriptor, attributesCount, pair.getLeft(), pool, start, pair.getRight());
}
示例14: genCheck
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的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;
}
}
示例15: mineLight
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
/**
* This the slower miner version which uses only cache thus taking much less memory than
* regular {@link #mine} method
*/
public long mineLight(long fullSize, final byte[][] cache, byte[] blockHeaderTruncHash, long difficulty) {
BigInteger target = valueOf(2).pow(256).divide(valueOf(difficulty));
long nonce = new Random().nextLong();
while(!Thread.currentThread().isInterrupted()) {
nonce++;
Pair<byte[], byte[]> pair = hashimotoLight(fullSize, cache, blockHeaderTruncHash, longToBytes(nonce));
BigInteger h = new BigInteger(1, pair.getRight() /* ?? */);
if (h.compareTo(target) < 0) break;
}
return nonce;
}