List of usage examples for org.apache.commons.lang3.tuple Triple getRight
public abstract R getRight();
Gets the right element from this triple.
From source file:at.gridtec.lambda4j.function.tri.to.ThrowableToByteTriFunction.java
/** * Applies this function to the given tuple. * * @param tuple The tuple to be applied to the function * @return The return value from the function, which is its result. * @throws NullPointerException If given argument is {@code null} * @throws X Any throwable from this functions action * @see org.apache.commons.lang3.tuple.Triple *///from w w w .j a va 2 s .c o m default byte applyAsByteThrows(@Nonnull Triple<T, U, V> tuple) throws X { Objects.requireNonNull(tuple); return applyAsByteThrows(tuple.getLeft(), tuple.getMiddle(), tuple.getRight()); }
From source file:at.gridtec.lambda4j.function.tri.to.ThrowableToCharTriFunction.java
/** * Applies this function to the given tuple. * * @param tuple The tuple to be applied to the function * @return The return value from the function, which is its result. * @throws NullPointerException If given argument is {@code null} * @throws X Any throwable from this functions action * @see org.apache.commons.lang3.tuple.Triple */// www . j av a 2 s .c o m default char applyAsCharThrows(@Nonnull Triple<T, U, V> tuple) throws X { Objects.requireNonNull(tuple); return applyAsCharThrows(tuple.getLeft(), tuple.getMiddle(), tuple.getRight()); }
From source file:at.gridtec.lambda4j.function.tri.to.ThrowableToLongTriFunction.java
/** * Applies this function to the given tuple. * * @param tuple The tuple to be applied to the function * @return The return value from the function, which is its result. * @throws NullPointerException If given argument is {@code null} * @throws X Any throwable from this functions action * @see org.apache.commons.lang3.tuple.Triple *//*from w w w .j a v a2 s. c o m*/ default long applyAsLongThrows(@Nonnull Triple<T, U, V> tuple) throws X { Objects.requireNonNull(tuple); return applyAsLongThrows(tuple.getLeft(), tuple.getMiddle(), tuple.getRight()); }
From source file:at.gridtec.lambda4j.function.tri.to.ThrowableToFloatTriFunction.java
/** * Applies this function to the given tuple. * * @param tuple The tuple to be applied to the function * @return The return value from the function, which is its result. * @throws NullPointerException If given argument is {@code null} * @throws X Any throwable from this functions action * @see org.apache.commons.lang3.tuple.Triple */// w w w .j a va 2 s . co m default float applyAsFloatThrows(@Nonnull Triple<T, U, V> tuple) throws X { Objects.requireNonNull(tuple); return applyAsFloatThrows(tuple.getLeft(), tuple.getMiddle(), tuple.getRight()); }
From source file:at.gridtec.lambda4j.function.tri.to.ThrowableToShortTriFunction.java
/** * Applies this function to the given tuple. * * @param tuple The tuple to be applied to the function * @return The return value from the function, which is its result. * @throws NullPointerException If given argument is {@code null} * @throws X Any throwable from this functions action * @see org.apache.commons.lang3.tuple.Triple */// w w w. j av a2 s . c om default short applyAsShortThrows(@Nonnull Triple<T, U, V> tuple) throws X { Objects.requireNonNull(tuple); return applyAsShortThrows(tuple.getLeft(), tuple.getMiddle(), tuple.getRight()); }
From source file:at.gridtec.lambda4j.function.tri.to.ThrowableToDoubleTriFunction.java
/** * Applies this function to the given tuple. * * @param tuple The tuple to be applied to the function * @return The return value from the function, which is its result. * @throws NullPointerException If given argument is {@code null} * @throws X Any throwable from this functions action * @see org.apache.commons.lang3.tuple.Triple *//*from www . j av a 2s .com*/ default double applyAsDoubleThrows(@Nonnull Triple<T, U, V> tuple) throws X { Objects.requireNonNull(tuple); return applyAsDoubleThrows(tuple.getLeft(), tuple.getMiddle(), tuple.getRight()); }
From source file:blusunrize.immersiveengineering.api.ApiUtils.java
private static boolean handlePos(Vec3d pos, BlockPos posB, HashMap<BlockPos, Vec3d> halfScanned, HashSet<BlockPos> done, Predicate<Triple<BlockPos, Vec3d, Vec3d>> shouldStop, HashSet<Triple<BlockPos, Vec3d, Vec3d>> near) { final double DELTA_NEAR = .3; if (!done.contains(posB)) { if (halfScanned.containsKey(posB) && !pos.equals(halfScanned.get(posB))) { Triple<BlockPos, Vec3d, Vec3d> added = new ImmutableTriple<>(posB, halfScanned.get(posB), pos); boolean stop = shouldStop.test(added); done.add(posB);/*w w w.j a v a 2s .c om*/ halfScanned.remove(posB); near.removeIf((t) -> t.getLeft().equals(posB)); if (stop) return true; for (int i = 0; i < 3; i++) { double coord = getDim(pos, i); double diff = coord - Math.floor(coord); if (diff < DELTA_NEAR) near.add( new ImmutableTriple<>(offsetDim(posB, i, -1), added.getMiddle(), added.getRight())); diff = Math.ceil(coord) - coord; if (diff < DELTA_NEAR) near.add(new ImmutableTriple<>(offsetDim(posB, i, 1), added.getMiddle(), added.getRight())); } } else { halfScanned.put(posB, pos); } } return false; }
From source file:com.microsoft.azure.management.containerinstance.implementation.ContainerGroupImpl.java
@Override protected Observable<ContainerGroupInner> createInner() { final ContainerGroupImpl self = this; if (!isInCreateMode()) { throw new UnsupportedOperationException( "Update on an existing container group resource is not supported"); } else if (newFileShares == null || creatableStorageAccountKey == null) { return this.manager().inner().containerGroups().createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()); } else {/* w ww . j a v a 2s . com*/ final StorageAccount storageAccount = (StorageAccount) this .createdResource(this.creatableStorageAccountKey); return createFileShareAsync(storageAccount).collect(new Func0<List<Triple<String, String, String>>>() { @Override public List<Triple<String, String, String>> call() { return new ArrayList<>(); } }, new Action2<List<Triple<String, String, String>>, Triple<String, String, String>>() { @Override public void call(List<Triple<String, String, String>> cloudFileShares, Triple<String, String, String> fileShare) { cloudFileShares.add(fileShare); } }).flatMap( new Func1<List<Triple<String, String, String>>, Observable<? extends ContainerGroupInner>>() { @Override public Observable<? extends ContainerGroupInner> call( List<Triple<String, String, String>> fileShares) { for (Triple<String, String, String> fileShareEntry : fileShares) { self.defineVolume(fileShareEntry.getLeft()) .withExistingReadWriteAzureFileShare(fileShareEntry.getMiddle()) .withStorageAccountName(storageAccount.name()) .withStorageAccountKey(fileShareEntry.getRight()).attach(); } return self.manager().inner().containerGroups() .createOrUpdateAsync(self.resourceGroupName(), self.name(), self.inner()); } }); } }
From source file:com.vmware.identity.openidconnect.server.AuthenticationRequestProcessor.java
public Pair<ModelAndView, HttpResponse> process() { // parse authn request (and if that fails, see if you can still construct an error response off of the partially parsed request) ClientID clientId;//from ww w . j a v a 2s. c o m URI redirectUri; AuthenticationErrorResponse parseErrorResponse; try { this.authnRequest = AuthenticationRequest.parse(this.httpRequest); clientId = this.authnRequest.getClientID(); redirectUri = this.authnRequest.getRedirectURI(); parseErrorResponse = null; } catch (AuthenticationRequest.ParseException e) { if (e.getClientID() != null && e.getRedirectURI() != null && e.createAuthenticationErrorResponse(this.isAjaxRequest) != null) { clientId = e.getClientID(); redirectUri = e.getRedirectURI(); parseErrorResponse = e.createAuthenticationErrorResponse(this.isAjaxRequest); } else { LoggerUtils.logFailedRequest(logger, e.getErrorObject(), e); return Pair.of((ModelAndView) null, HttpResponse.createErrorResponse(e.getErrorObject())); } } // check that tenant, client, and redirect_uri are registered (if not, return error to browser, not client) try { if (this.tenant == null) { this.tenant = this.tenantInfoRetriever.getDefaultTenantName(); } this.tenantInfo = this.tenantInfoRetriever.retrieveTenantInfo(this.tenant); this.clientInfo = this.clientInfoRetriever.retrieveClientInfo(this.tenant, clientId); if (!this.clientInfo.getRedirectURIs().contains(redirectUri)) { throw new ServerException(ErrorObject.invalidRequest("unregistered redirect_uri")); } } catch (ServerException e) { LoggerUtils.logFailedRequest(logger, e); return Pair.of((ModelAndView) null, HttpResponse.createErrorResponse(e.getErrorObject())); } // if tenant, client, and redirect_uri are registered, we can return authn error response to the client instead of browser if (parseErrorResponse != null) { LoggerUtils.logFailedRequest(logger, parseErrorResponse.getErrorObject()); return Pair.of((ModelAndView) null, parseErrorResponse.toHttpResponse()); } // authenticate client try { authenticateClient(); } catch (ServerException e) { LoggerUtils.logFailedRequest(logger, e); return Pair.of((ModelAndView) null, authnErrorResponse(e).toHttpResponse()); } // process login information (username/password or session), if failed, return error message to browser so javascript can consume it LoginProcessor p = new LoginProcessor(this.personUserAuthenticator, this.sessionManager, this.messageSource, this.locale, this.httpRequest, this.tenant); Triple<PersonUser, SessionID, LoginMethod> loginResult; try { loginResult = p.process(); } catch (LoginProcessor.LoginException e) { LoggerUtils.logFailedRequest(logger, e.getErrorObject(), e); return Pair.of((ModelAndView) null, e.toHttpResponse()); } PersonUser personUser = loginResult.getLeft(); SessionID sessionId = loginResult.getMiddle(); LoginMethod loginMethod = loginResult.getRight(); // if no person user, return login form if (personUser == null) { try { return Pair.of(generateLoginForm(), (HttpResponse) null); } catch (ServerException e) { LoggerUtils.logFailedRequest(logger, e); return Pair.of((ModelAndView) null, authnErrorResponse(e).toHttpResponse()); } } // we have a person user, process authn request for this person user try { AuthenticationSuccessResponse authnSuccessResponse = (this.authnRequest.getResponseType() .contains(ResponseTypeValue.AUTHORIZATION_CODE)) ? processAuthzCodeResponse(personUser, sessionId) : processIDTokenResponse(personUser, sessionId); if (loginMethod == null) { this.sessionManager.update(sessionId, this.clientInfo); } else { this.sessionManager.add(sessionId, personUser, loginMethod, this.clientInfo); } HttpResponse httpResponse = authnSuccessResponse.toHttpResponse(); httpResponse.addCookie(loggedInSessionCookie(sessionId)); return Pair.of((ModelAndView) null, httpResponse); } catch (ServerException e) { LoggerUtils.logFailedRequest(logger, e); return Pair.of((ModelAndView) null, authnErrorResponse(e).toHttpResponse()); } }
From source file:blusunrize.immersiveengineering.common.items.ItemDrill.java
@Override public boolean onBlockDestroyed(ItemStack stack, World world, IBlockState state, BlockPos pos, EntityLivingBase living) {// w ww .j av a 2s . co m if ((double) state.getBlockHardness(world, pos) != 0.0D) { int dmg = ForgeHooks.isToolEffective(world, pos, stack) ? 1 : 3; ItemStack head = getHead(stack); if (!head.isEmpty()) { if (living instanceof EntityPlayer) { if (((EntityPlayer) living).capabilities.isCreativeMode) return true; ((IDrillHead) head.getItem()).afterBlockbreak(stack, head, (EntityPlayer) living); } if (!getUpgrades(stack).getBoolean("oiled") || Utils.RAND.nextInt(4) == 0) ((IDrillHead) head.getItem()).damageHead(head, dmg); this.setHead(stack, head); IFluidHandler handler = FluidUtil.getFluidHandler(stack); handler.drain(1, true); Triple<ItemStack, ShaderRegistryEntry, ShaderCase> shader = ShaderRegistry .getStoredShaderAndCase(stack); if (shader != null) shader.getMiddle().getEffectFunction().execute(world, shader.getLeft(), stack, shader.getRight().getShaderType(), new Vec3d(pos.getX() + .5, pos.getY() + .5, pos.getZ() + .5), null, .375f); } } return true; }