当前位置: 首页>>代码示例>>Java>>正文


Java Pair.getRight方法代码示例

本文整理汇总了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;
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:24,代码来源:WrappedFluidStackDeserializer.java

示例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;
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:25,代码来源:BlockCrop.java

示例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);
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:20,代码来源:BlockCrop.java

示例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});
}
 
开发者ID:NCSC-NL,项目名称:PEF,代码行数:17,代码来源:CLToolTest.java

示例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);
}
 
开发者ID:leolewis,项目名称:openvisualtraceroute,代码行数:43,代码来源:AbstractTraceRoute.java

示例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();
}
 
开发者ID:taboola,项目名称:taboola-cronyx,代码行数:8,代码来源:CronyxToQuartzSelector.java

示例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);
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:16,代码来源:BaseRecipeCategory.java

示例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();
        }
    }
}
 
开发者ID:Microsoft,项目名称:elastic-db-tools-for-java,代码行数:16,代码来源:MultiShardConnection.java

示例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});
}
 
开发者ID:NCSC-NL,项目名称:PEF,代码行数:16,代码来源:CLToolChangedPCAPIT.java

示例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;
}
 
开发者ID:Aptoide,项目名称:AppCoins-ethereumj,代码行数:12,代码来源:EthashAlgoSlow.java

示例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());
}
 
开发者ID:Microsoft,项目名称:elastic-db-tools-for-java,代码行数:41,代码来源:RecoveryManager.java

示例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());
}
 
开发者ID:thlcly,项目名称:Mini-JVM,代码行数:10,代码来源:Field.java

示例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());
}
 
开发者ID:thlcly,项目名称:Mini-JVM,代码行数:13,代码来源:Method.java

示例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;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:14,代码来源:TRSRTransformation.java

示例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;
}
 
开发者ID:talentchain,项目名称:talchain,代码行数:16,代码来源:EthashAlgoSlow.java


注:本文中的org.apache.commons.lang3.tuple.Pair.getRight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。