本文整理汇总了Java中org.apache.commons.lang3.tuple.Pair.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java Pair.getValue方法的具体用法?Java Pair.getValue怎么用?Java Pair.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.tuple.Pair
的用法示例。
在下文中一共展示了Pair.getValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
public void update() {
entityItem.age += 4;
BlockPos lastPos = pos;
pos = drone.getTargetedBlock();
if (pos != null) {
if (lastPos == null) {
oldPos = pos;
} else if (!pos.equals(lastPos)) {
progress = 0;
oldPos = lastPos;
}
} else {
oldPos = null;
}
progress = Math.min((float) Math.PI, progress + 0.1F);
Iterator<Pair<RenderCoordWireframe, Integer>> iterator = blackListWireframes.iterator();
while (iterator.hasNext()) {
Pair<RenderCoordWireframe, Integer> wireframe = iterator.next();
wireframe.getKey().ticksExisted++;
wireframe.setValue(wireframe.getValue() - 1);
if (wireframe.getValue() <= 0) {
iterator.remove();
}
}
}
示例2: HeatFrameCoolingRecipe
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
public HeatFrameCoolingRecipe(Object input, ItemStack output) {
if (input == null) throw new NullPointerException("Input can't be null!");
if (output == null) throw new NullPointerException("Output can't be null!");
if (!(input instanceof ItemStack) && !(input instanceof Pair))
throw new IllegalArgumentException("Input needs to be of type ItemStack or org.apache.commons.lang3.tuple.Pair<String, Integer>. Violating object: " + input);
if (input instanceof Pair) {
Pair pair = (Pair) input;
if (!(pair.getKey() instanceof String))
throw new IllegalArgumentException("Pair key needs to be a String (ore dict entry)");
if (!(pair.getValue() instanceof Integer))
throw new IllegalArgumentException("Pair value needs to be an Integer (amount)");
}
this.input = input;
this.output = output;
}
示例3: PressureChamberRecipe
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
public PressureChamberRecipe(Object[] input, float pressureRequired, ItemStack[] output) {
for (Object o : input) {
if (!(o instanceof ItemStack) && !(o instanceof Pair))
throw new IllegalArgumentException("Input objects need to be of type ItemStack or (Apache's) Pair<String, Integer>. Violating object: " + o);
if (o instanceof Pair) {
Pair pair = (Pair) o;
if (!(pair.getKey() instanceof String))
throw new IllegalArgumentException("Pair key needs to be a String (ore dict entry)");
if (!(pair.getValue() instanceof Integer))
throw new IllegalArgumentException("Value key needs to be an Integer (amount)");
}
}
this.input = input;
this.output = NonNullList.from(ItemStack.EMPTY, output);
pressure = pressureRequired;
}
示例4: verifyAuthenticationContextSignature
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
/**
* Verify authentication context signature.
*
* @param authenticationContext the authentication context
* @param request the request
* @param authnRequest the authn request
* @param adaptor the adaptor
* @throws Exception the exception
*/
protected void verifyAuthenticationContextSignature(final Pair<? extends SignableSAMLObject, MessageContext> authenticationContext,
final HttpServletRequest request, final AuthnRequest authnRequest,
final SamlRegisteredServiceServiceProviderMetadataFacade adaptor) throws Exception {
final MessageContext ctx = authenticationContext.getValue();
if (!SAMLBindingSupport.isMessageSigned(ctx)) {
LOGGER.debug("The authentication context is not signed");
if (adaptor.isAuthnRequestsSigned()) {
LOGGER.error("Metadata for [{}] says authentication requests are signed, yet authentication request is not", adaptor.getEntityId());
throw new SAMLException("AuthN request is not signed but should be");
}
LOGGER.debug("Authentication request is not signed, so there is no need to verify its signature.");
} else {
LOGGER.debug("The authentication context is signed; Proceeding to validate signatures...");
this.samlObjectSignatureValidator.verifySamlProfileRequestIfNeeded(authnRequest, adaptor, request, ctx);
}
}
示例5: handleSloProfileRequest
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
/**
* Handle profile request.
*
* @param response the response
* @param request the request
* @param decoder the decoder
* @throws Exception the exception
*/
protected void handleSloProfileRequest(final HttpServletResponse response,
final HttpServletRequest request,
final BaseHttpServletRequestXMLMessageDecoder decoder) throws Exception {
if (singleLogoutCallbacksDisabled) {
LOGGER.info("Processing SAML IdP SLO requests is disabled");
return;
}
final Pair<? extends SignableSAMLObject, MessageContext> pair = decodeSamlContextFromHttpRequest(request, decoder, LogoutRequest.class);
final LogoutRequest logoutRequest = LogoutRequest.class.cast(pair.getKey());
final MessageContext ctx = pair.getValue();
if (this.forceSignedLogoutRequests && !SAMLBindingSupport.isMessageSigned(ctx)) {
throw new SAMLException("Logout request is not signed but should be.");
}
if (SAMLBindingSupport.isMessageSigned(ctx)) {
final MetadataResolver resolver = SamlIdPUtils.getMetadataResolverForAllSamlServices(this.servicesManager,
SamlIdPUtils.getIssuerFromSamlRequest(logoutRequest),
this.samlRegisteredServiceCachingMetadataResolver);
this.samlObjectSignatureValidator.verifySamlProfileRequestIfNeeded(logoutRequest, resolver, request, ctx);
}
SamlUtils.logSamlObject(this.configBean, logoutRequest);
response.sendRedirect(this.logoutUrl);
}
示例6: handleDropCollection
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
private void handleDropCollection() {
// There are drops we need to collect first.
for (Pair<BlockPos, ItemStack> pair : options.getDrops()) {
ItemStack drop = pair.getValue();
if (!drop.isEmpty()) {
ItemStack remaining = entity.addStack(drop);
if (!remaining.isEmpty()) {
entity.entityDropItem(remaining, 0.0f);
needsToPutAway = true;
}
}
}
options.clearDrops();
ServerActionManager.getManager().save();
waitABit = 1; // Process faster
}
示例7: transferOut
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
private ItemStack transferOut(BlockPos pos, boolean test) {
EnumFacing facing = getFacing().getOpposite();
Pair<IItemHandler, ISidedInventory> inv = getInventory(pos, facing);
if(inv.getKey() != null) {
IItemHandler handler = inv.getKey();
ISidedInventory tile = inv.getValue();
for(int slot = 0; slot < handler.getSlots(); slot++) {
ItemStack in = handler.getStackInSlot(slot);
if(!in.isEmpty() && (tile == null || tile.canExtractItem(slot, in, facing))) {
return handler.extractItem(slot, Integer.MAX_VALUE, test);
}
}
}
return ItemStack.EMPTY;
}
示例8: transferIn
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
private boolean transferIn(BlockPos pos, ItemStack inserted, boolean test) {
EnumFacing facing = getFacing();
Pair<IItemHandler, ISidedInventory> inv = getInventory(pos, facing);
if(inv.getKey() != null) {
IItemHandler handler = inv.getKey();
ISidedInventory tile = inv.getValue();
for(int slot = 0; slot < handler.getSlots(); slot++) {
ItemStack inSlot = handler.getStackInSlot(slot);
if(tile != null && !tile.canInsertItem(slot, inserted, facing)) return false;
if(inSlot.isEmpty() || (ItemHandlerHelper.canItemStacksStack(inSlot, inserted) && (inSlot.getCount() < inSlot.getMaxStackSize() && inSlot.getCount() < handler.getSlotLimit(slot)))) {
return handler.insertItem(slot, inserted, test) != inserted;
}
}
}
return false;
}
示例9: assertNerProcessingResults
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
private void assertNerProcessingResults(ProcessingData processingData, List<Pair<String,Hint[]>> expected) {
expected = new LinkedList<>(expected); //copy so we can remove
Conversation conv = processingData.getConversation();
Assert.assertFalse(conv.getTokens().isEmpty());
for(Token token : conv.getTokens()){
log.debug("Token(idx: {}, span[{},{}], type: {}): {}", token.getMessageIdx(), token.getStart(), token.getEnd(), token.getType(), token.getValue());
Assert.assertNotNull(token.getType());
Assert.assertTrue(conv.getMeta().getLastMessageAnalyzed() < token.getMessageIdx());
Assert.assertTrue(conv.getMessages().size() > token.getMessageIdx());
Message message = conv.getMessages().get(token.getMessageIdx());
Assert.assertTrue(message.getOrigin() == Origin.User);
Assert.assertTrue(token.getStart() >= 0);
Assert.assertTrue(token.getEnd() > token.getStart());
Assert.assertTrue(token.getEnd() <= message.getContent().length());
Assert.assertEquals(message.getContent().substring(token.getStart(), token.getEnd()), String.valueOf(token.getValue()));
Pair<String,Hint[]> p = expected.remove(0);
Assert.assertEquals("Wrong Named Entity",p.getKey(), token.getValue());
for(Hint hint : p.getValue()){
Assert.assertTrue("Missing expected hint " + hint,token.hasHint(hint));
}
}
}
示例10: assertNerProcessingResults
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
private void assertNerProcessingResults(ProcessingData processingData, List<Pair<String,Hint[]>> expected) {
expected = new LinkedList<>(expected); //copy so we can remove
Conversation conv = processingData.getConversation();
Assert.assertFalse(conv.getTokens().isEmpty());
for(Token token : conv.getTokens()){
log.debug("Token(idx: {}, span[{},{}], type: {}): {}", token.getMessageIdx(), token.getStart(), token.getEnd(), token.getType(), token.getValue());
Assert.assertNotNull(token.getType());
Assert.assertTrue(conv.getMeta().getLastMessageAnalyzed() < token.getMessageIdx());
Assert.assertTrue(conv.getMessages().size() > token.getMessageIdx());
Message message = conv.getMessages().get(token.getMessageIdx());
Assert.assertTrue(message.getOrigin() == Origin.User);
Assert.assertTrue(token.getStart() >= 0);
Assert.assertTrue(token.getEnd() > token.getStart());
Assert.assertTrue(token.getEnd() <= message.getContent().length());
//the next assert is no longer true as the token.getValue() is the Lemma if present
//Assert.assertEquals(message.getContent().substring(token.getStart(), token.getEnd()), String.valueOf(token.getValue()));
Pair<String,Hint[]> p = expected.remove(0);
Assert.assertEquals("Wrong Named Entity", p.getKey(), token.getValue());
for(Hint hint : p.getValue()){
Assert.assertTrue("Missing expected hint " + hint,token.hasHint(hint));
}
}
}
示例11: createRegistrationRequest
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
private RegistrationRequest createRegistrationRequest(Pair<String, String> file, BiologicalDataItemFormat format) {
RegistrationRequest registration = new RegistrationRequest();
registration.setName(fileName);
registration.setPath(file.getLeft());
registration.setIndexPath(file.getRight());
registration.setReferenceId(referenceId);
registration.setType(BiologicalDataItemResourceType.getTypeFromPath(file.getKey()));
if (file.getValue() != null) {
registration.setIndexType(BiologicalDataItemResourceType.getTypeFromPath(file.getValue()));
}
if (format == BiologicalDataItemFormat.VCF || format == BiologicalDataItemFormat.GENE) {
registration.setDoIndex(doIndex);
}
return registration;
}
示例12: invoke
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
@Override
public Object invoke(Object target, Method method, Object[] args) throws Throwable {
Pair<Boolean, Object> result = invokeObjectMethod(target, method, args);
if(result.getKey()){
return result.getValue();
}
Request req = new Request();
req.setServiceName(serviceClass.getName());
req.setMethodName(method.getName());
req.setArgs(args);
Header header = Header.HeaderMaker.newMaker()
.make();
header.setExtend(RpcUtil.getExtend(serializeType, compressType));
RpcRequest message = new RpcRequest(header, req);
setRpcContext();
return invoker.invoke(message);
}
示例13: getMaxDispersion
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
@Override
public int getMaxDispersion() {
IAirHandler connectedHandler = null;
for (Pair<EnumFacing, IAirHandler> entry : pressureTube.getAirHandler(null).getConnectedPneumatics()) {
if (entry.getKey().equals(dir)) {
connectedHandler = entry.getValue();
break;
}
}
if (connectedHandler == null) return 0;
int maxDispersion = (int) ((getThreshold() - connectedHandler.getPressure()) * connectedHandler.getVolume());
if (maxDispersion < 0) return 0;
return maxDispersion;
}
示例14: initialize
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
/**
* Init. Attempts to locate the logging configuration to insert listeners.
* The log configuration location is pulled directly from the environment
* given there is not an explicit property mapping for it provided by Boot, etc.
*/
@PostConstruct
public void initialize() {
try {
final Pair<Resource, LoggerContext> pair = ControllerUtils.buildLoggerContext(environment, resourceLoader);
if (pair != null) {
this.loggerContext = pair.getValue();
registerLogFileTailThreads();
}
} catch (final Exception e) {
throw Throwables.propagate(e);
}
}
示例15: initialize
import org.apache.commons.lang3.tuple.Pair; //导入方法依赖的package包/类
/**
* Init. Attempts to locate the logging configuration to insert listeners.
* The log configuration location is pulled directly from the environment
* given there is not an explicit property mapping for it provided by Boot, etc.
*/
@PostConstruct
public void initialize() {
final Pair<Resource, LoggerContext> pair = ControllerUtils.buildLoggerContext(environment, resourceLoader);
if (pair != null) {
this.logConfigurationFile = pair.getKey();
this.loggerContext = pair.getValue();
}
}