idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
33,450 | public boolean apply(Game game, Ability source) {<NEW_LINE>Spell spell = game.getStack().getSpell(this.getTargetPointer().getFirst(game, source));<NEW_LINE>if (spell != null) {<NEW_LINE>if (spell.getManaValue() > 9) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>MageObject mageObject = game.getObject(source);<NEW_LINE>if (mageObject != null) {<NEW_LINE>// Map<number, amount of counters><NEW_LINE>Map<Integer, Integer> chipCounters = new HashMap<>();<NEW_LINE>if (game.getState().getValue(mageObject.getId() + "_chip") != null) {<NEW_LINE>chipCounters.putAll((Map<Integer, Integer>) game.getState().getValue(mageObject.getId() + "_chip"));<NEW_LINE>}<NEW_LINE>chipCounters.putIfAbsent(spell.getManaValue(), 0);<NEW_LINE>chipCounters.put(spell.getManaValue(), chipCounters.get(spell.getManaValue()) + 1);<NEW_LINE>game.getState().setValue(mageObject.getId() + "_chip", chipCounters);<NEW_LINE>if (mageObject instanceof Permanent) {<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>int i = 0;<NEW_LINE>for (Map.Entry<Integer, Integer> entry : chipCounters.entrySet()) {<NEW_LINE>i++;<NEW_LINE>sb.append(entry.getKey());<NEW_LINE>if (i < chipCounters.size()) {<NEW_LINE>sb.append(", ");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>((Permanent) mageObject).addInfo("chip counters", CardUtil.addToolTipMarkTags<MASK><NEW_LINE>new AddCountersSourceEffect(CounterType.CHIP.createInstance()).apply(game, source);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | ("Chip counters at: " + sb), game); |
1,108,834 | static // [START translate_create_glossary_beta]<NEW_LINE>Glossary createGlossary(String projectId, String location, String name, String gcsUri) {<NEW_LINE>try (TranslationServiceClient translationServiceClient = TranslationServiceClient.create()) {<NEW_LINE>LocationName locationName = LocationName.newBuilder().setProject(projectId).setLocation(location).build();<NEW_LINE>LanguageCodesSet languageCodesSet = LanguageCodesSet.newBuilder().addLanguageCodes("en").addLanguageCodes("es").build();<NEW_LINE>GcsSource gcsSource = GcsSource.newBuilder().setInputUri(gcsUri).build();<NEW_LINE>GlossaryInputConfig glossaryInputConfig = GlossaryInputConfig.newBuilder().setGcsSource(gcsSource).build();<NEW_LINE>GlossaryName glossaryName = GlossaryName.newBuilder().setProject(projectId).setLocation(location).<MASK><NEW_LINE>Glossary glossary = Glossary.newBuilder().setLanguageCodesSet(languageCodesSet).setInputConfig(glossaryInputConfig).setName(glossaryName.toString()).build();<NEW_LINE>CreateGlossaryRequest request = CreateGlossaryRequest.newBuilder().setParent(locationName.toString()).setGlossary(glossary).build();<NEW_LINE>// Call the API<NEW_LINE>Glossary response = translationServiceClient.createGlossaryAsync(request).get(300, TimeUnit.SECONDS);<NEW_LINE>System.out.format("Created: %s\n", response.getName());<NEW_LINE>System.out.format("Input Uri: %s\n", response.getInputConfig().getGcsSource());<NEW_LINE>return response;<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuntimeException("Couldn't create client.", e);<NEW_LINE>}<NEW_LINE>} | setGlossary(name).build(); |
1,635,611 | public void suspend(final String hostName) {<NEW_LINE>UpdateHostResponse response;<NEW_LINE>try {<NEW_LINE>var params = new ConfigServerApi.Params<UpdateHostResponse>().setConnectionTimeout(CONNECTION_TIMEOUT).setRetryPolicy(createRetryPolicyForSuspend());<NEW_LINE>response = configServerApi.put(getSuspendPath(hostName), Optional.empty(), UpdateHostResponse.class, params);<NEW_LINE>} catch (HttpException.NotFoundException n) {<NEW_LINE>throw new OrchestratorNotFoundException("Failed to suspend " + hostName + ", host not found");<NEW_LINE>} catch (HttpException e) {<NEW_LINE>throw new OrchestratorException("Failed to suspend " + hostName + ": " + e.toString());<NEW_LINE>} catch (ConnectionException e) {<NEW_LINE>throw new ConvergenceException("Failed to suspend " + hostName + <MASK><NEW_LINE>} catch (RuntimeException e) {<NEW_LINE>throw new RuntimeException("Got error on suspend", e);<NEW_LINE>}<NEW_LINE>Optional.ofNullable(response.reason()).ifPresent(reason -> {<NEW_LINE>throw new OrchestratorException(reason.message());<NEW_LINE>});<NEW_LINE>} | ": " + e.getMessage()); |
129,093 | public static void visitNamespaceClassForCompletion(PsiElement psiElement, int cursorOffset, ClassForCompletionVisitor visitor) {<NEW_LINE>int cursorOffsetClean = cursorOffset - psiElement.getTextOffset();<NEW_LINE>if (cursorOffsetClean < 1) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String content = psiElement.getText();<NEW_LINE><MASK><NEW_LINE>if (!(length >= cursorOffsetClean)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String beforeCursor = content.substring(0, cursorOffsetClean);<NEW_LINE>boolean isValid;<NEW_LINE>// espend\|Container, espend\Cont|ainer <- fallback to last full namespace<NEW_LINE>// espend|\Container <- only on known namespace "espend"<NEW_LINE>String namespace = beforeCursor;<NEW_LINE>// if no backslash or its equal in first position, fallback on namespace completion<NEW_LINE>int lastSlash = beforeCursor.lastIndexOf("\\");<NEW_LINE>if (lastSlash <= 0) {<NEW_LINE>isValid = PhpIndexUtil.hasNamespace(psiElement.getProject(), beforeCursor);<NEW_LINE>} else {<NEW_LINE>isValid = true;<NEW_LINE>namespace = beforeCursor.substring(0, lastSlash);<NEW_LINE>}<NEW_LINE>if (!isValid) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// format namespaces and add prefix for fluent completion<NEW_LINE>String prefix = "";<NEW_LINE>if (namespace.startsWith("\\")) {<NEW_LINE>prefix = "\\";<NEW_LINE>} else {<NEW_LINE>namespace = "\\" + namespace;<NEW_LINE>}<NEW_LINE>// search classes in current namespace and child namespaces<NEW_LINE>for (PhpClass phpClass : PhpIndexUtil.getPhpClassInsideNamespace(psiElement.getProject(), namespace)) {<NEW_LINE>String presentableFQN = phpClass.getPresentableFQN();<NEW_LINE>if (fr.adrienbrault.idea.symfony2plugin.util.StringUtils.startWithEqualClassname(presentableFQN, beforeCursor)) {<NEW_LINE>visitor.visit(phpClass, presentableFQN, prefix);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | int length = content.length(); |
1,571,895 | final UpdateResourceResult executeUpdateResource(UpdateResourceRequest updateResourceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateResourceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateResourceRequest> request = null;<NEW_LINE>Response<UpdateResourceResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdateResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateResourceRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "WorkMail");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateResource");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpdateResourceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateResourceResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); |
912,841 | public static File writeSource(File sourceDir, String fqClassName, String sourceCode) throws IOException {<NEW_LINE>String[] parts = fqClassName.split(S_BACKSLASH + S_DOT);<NEW_LINE>StringBuilder builder = new StringBuilder();<NEW_LINE>builder.append(sourceDir.getAbsolutePath()).append(File.separatorChar);<NEW_LINE>for (String part : parts) {<NEW_LINE>builder.append(part).append(File.separatorChar);<NEW_LINE>}<NEW_LINE>builder.deleteCharAt(builder.length() - 1);<NEW_LINE>builder.append(".java");<NEW_LINE>String filePathString = builder.toString();<NEW_LINE>int lastSep = filePathString.lastIndexOf(File.separatorChar);<NEW_LINE>File sourceFile;<NEW_LINE>if (lastSep != -1) {<NEW_LINE>String dirPart = filePathString.substring(0, lastSep);<NEW_LINE>String filePart = <MASK><NEW_LINE>File dir = new File(dirPart);<NEW_LINE>if (!dir.exists()) {<NEW_LINE>dir.mkdirs();<NEW_LINE>}<NEW_LINE>sourceFile = new File(dir, filePart);<NEW_LINE>} else {<NEW_LINE>sourceFile = new File(filePathString);<NEW_LINE>}<NEW_LINE>if (DEBUG_LOGGING) {<NEW_LINE>logger.debug("Writing source file: {}", sourceFile.getAbsolutePath());<NEW_LINE>}<NEW_LINE>BufferedWriter fout = new BufferedWriter(new FileWriter(sourceFile));<NEW_LINE>try {<NEW_LINE>fout.write(sourceCode);<NEW_LINE>fout.flush();<NEW_LINE>} finally {<NEW_LINE>fout.close();<NEW_LINE>}<NEW_LINE>return sourceFile;<NEW_LINE>} | filePathString.substring(lastSep + 1); |
606,546 | <T extends AbstractSaml2AuthenticationRequest> T resolve(HttpServletRequest request, BiConsumer<RelyingPartyRegistration, AuthnRequest> authnRequestConsumer) {<NEW_LINE>RequestMatcher.MatchResult result = this.requestMatcher.matcher(request);<NEW_LINE>if (!result.isMatch()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>String registrationId = result.getVariables().get("registrationId");<NEW_LINE>RelyingPartyRegistration registration = this.relyingPartyRegistrationResolver.resolve(request, registrationId);<NEW_LINE>if (registration == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>AuthnRequest authnRequest = this.authnRequestBuilder.buildObject();<NEW_LINE>authnRequest.setForceAuthn(Boolean.FALSE);<NEW_LINE>authnRequest.setIsPassive(Boolean.FALSE);<NEW_LINE>authnRequest.setProtocolBinding(registration.getAssertionConsumerServiceBinding().getUrn());<NEW_LINE>Issuer iss = this.issuerBuilder.buildObject();<NEW_LINE>iss.setValue(registration.getEntityId());<NEW_LINE>authnRequest.setIssuer(iss);<NEW_LINE>authnRequest.setDestination(registration.getAssertingPartyDetails().getSingleSignOnServiceLocation());<NEW_LINE>authnRequest.setAssertionConsumerServiceURL(registration.getAssertionConsumerServiceLocation());<NEW_LINE>authnRequestConsumer.accept(registration, authnRequest);<NEW_LINE>if (authnRequest.getID() == null) {<NEW_LINE>authnRequest.setID("ARQ" + UUID.randomUUID().toString().substring(1));<NEW_LINE>}<NEW_LINE>String relayState = UUID.randomUUID().toString();<NEW_LINE>Saml2MessageBinding binding = registration.getAssertingPartyDetails().getSingleSignOnServiceBinding();<NEW_LINE>if (binding == Saml2MessageBinding.POST) {<NEW_LINE>if (registration.getAssertingPartyDetails().getWantAuthnRequestsSigned()) {<NEW_LINE>OpenSamlSigningUtils.sign(authnRequest, registration);<NEW_LINE>}<NEW_LINE>String xml = serialize(authnRequest);<NEW_LINE>String encoded = Saml2Utils.samlEncode(xml.getBytes(StandardCharsets.UTF_8));<NEW_LINE>return (T) Saml2PostAuthenticationRequest.withRelyingPartyRegistration(registration).samlRequest(encoded).relayState(relayState).build();<NEW_LINE>} else {<NEW_LINE>String xml = serialize(authnRequest);<NEW_LINE>String deflatedAndEncoded = Saml2Utils.samlEncode(Saml2Utils.samlDeflate(xml));<NEW_LINE>Saml2RedirectAuthenticationRequest.Builder builder = Saml2RedirectAuthenticationRequest.withRelyingPartyRegistration(registration).samlRequest(deflatedAndEncoded).relayState(relayState);<NEW_LINE>if (registration.getAssertingPartyDetails().getWantAuthnRequestsSigned()) {<NEW_LINE>Map<String, String> parameters = OpenSamlSigningUtils.sign(registration).param(Saml2ParameterNames.SAML_REQUEST, deflatedAndEncoded).param(Saml2ParameterNames.RELAY_STATE, relayState).parameters();<NEW_LINE>builder.sigAlg(parameters.get(Saml2ParameterNames.SIG_ALG)).signature(parameters<MASK><NEW_LINE>}<NEW_LINE>return (T) builder.build();<NEW_LINE>}<NEW_LINE>} | .get(Saml2ParameterNames.SIGNATURE)); |
984,904 | private void followBlogUrl(String normUrl) {<NEW_LINE>ReaderActions.ActionListener followListener = succeeded -> {<NEW_LINE>if (isFinishing()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>hideProgress();<NEW_LINE>if (succeeded) {<NEW_LINE>// clear the edit text and hide the soft keyboard<NEW_LINE>mEditAdd.setText(null);<NEW_LINE>EditTextUtils.hideSoftInput(mEditAdd);<NEW_LINE>showInfoSnackbar(getString(R.string.reader_label_followed_blog));<NEW_LINE>getPageAdapter().refreshBlogFragments(ReaderBlogType.FOLLOWED);<NEW_LINE>// update tags if the site we added belongs to a tag we don't yet have<NEW_LINE>// also update followed blogs so lists are ready in case we need to present them<NEW_LINE>// in bottom sheet reader filtering<NEW_LINE>performUpdate(EnumSet.of(UpdateTask.TAGS, UpdateTask.FOLLOWED_BLOGS));<NEW_LINE>} else {<NEW_LINE>showInfoSnackbar(getString<MASK><NEW_LINE>}<NEW_LINE>};<NEW_LINE>// note that this uses the endpoint to follow as a feed since typed URLs are more<NEW_LINE>// likely to point to a feed than a wp blog (and the endpoint should internally<NEW_LINE>// follow it as a blog if it is one)<NEW_LINE>ReaderBlogActions.followFeedByUrl(normUrl, followListener, ReaderTracker.SOURCE_SETTINGS, mReaderTracker);<NEW_LINE>} | (R.string.reader_toast_err_follow_blog)); |
1,393,975 | public Object convert(final Object source) throws FrameworkException {<NEW_LINE>if (source == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>final File currentFile = (File) getCurrentObject();<NEW_LINE>if (source instanceof byte[]) {<NEW_LINE>try {<NEW_LINE>byte[] <MASK><NEW_LINE>MagicMatch match = Magic.getMagicMatch(data);<NEW_LINE>String mimeType = match.getMimeType();<NEW_LINE>try {<NEW_LINE>FileHelper.setFileData(currentFile, data, mimeType);<NEW_LINE>} catch (IOException ioex) {<NEW_LINE>logger.warn("Unable to store file", ioex);<NEW_LINE>}<NEW_LINE>} catch (MagicException | MagicParseException | MagicMatchNotFoundException mex) {<NEW_LINE>logger.warn("Unable to parse file data", mex);<NEW_LINE>}<NEW_LINE>} else if (source instanceof String) {<NEW_LINE>String sourceString = (String) source;<NEW_LINE>if (StringUtils.isNotBlank(sourceString)) {<NEW_LINE>final Base64URIData uriData = new Base64URIData(sourceString);<NEW_LINE>try {<NEW_LINE>FileHelper.setFileData(currentFile, uriData.getBinaryData(), uriData.getContentType());<NEW_LINE>} catch (IOException ioex) {<NEW_LINE>logger.warn("Unable to store file", ioex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | data = (byte[]) source; |
174,872 | public void init(ViewFactoryContext viewFactoryContext, EPStatementInitServices services) {<NEW_LINE>for (ViewFactory grouped : intersecteds) {<NEW_LINE>grouped.init(viewFactoryContext, services);<NEW_LINE>}<NEW_LINE>if (batchViewIndex != -1) {<NEW_LINE>batchViewLocalState = new ThreadLocal<IntersectBatchViewLocalState>() {<NEW_LINE><NEW_LINE>protected synchronized IntersectBatchViewLocalState initialValue() {<NEW_LINE>return new IntersectBatchViewLocalState(new EventBean[intersecteds.length][], new EventBean[intersecteds.length][]);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} else if (hasAsymetric) {<NEW_LINE>asymetricViewLocalState = new ThreadLocal<IntersectAsymetricViewLocalState>() {<NEW_LINE><NEW_LINE>protected synchronized IntersectAsymetricViewLocalState initialValue() {<NEW_LINE>return new IntersectAsymetricViewLocalState(new EventBean<MASK><NEW_LINE>}<NEW_LINE>};<NEW_LINE>} else {<NEW_LINE>defaultViewLocalState = new ThreadLocal<IntersectDefaultViewLocalState>() {<NEW_LINE><NEW_LINE>protected synchronized IntersectDefaultViewLocalState initialValue() {<NEW_LINE>return new IntersectDefaultViewLocalState(new EventBean[intersecteds.length][]);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>}<NEW_LINE>} | [intersecteds.length][]); |
67,014 | protected Map<UUID, FilterEntity> copyFilters(User fromUser, User toUser) {<NEW_LINE>Map<UUID, FilterEntity> filtersMap = new HashMap<>();<NEW_LINE>try (Transaction tx = persistence.createTransaction()) {<NEW_LINE>MetaClass effectiveMetaClass = metadata.getExtendedEntities().getEffectiveMetaClass(FilterEntity.class);<NEW_LINE>EntityManager em = persistence.getEntityManager();<NEW_LINE>try {<NEW_LINE>em.setSoftDeletion(false);<NEW_LINE>Query deleteFiltersQuery = em.createQuery(String.format("delete from %s f where f.user.id = ?1", effectiveMetaClass.getName()));<NEW_LINE>deleteFiltersQuery.setParameter(1, toUser.getId());<NEW_LINE>deleteFiltersQuery.executeUpdate();<NEW_LINE>} finally {<NEW_LINE>em.setSoftDeletion(true);<NEW_LINE>}<NEW_LINE>TypedQuery<FilterEntity> q = em.createQuery(String.format("select f from %s f where f.user.id = ?1", effectiveMetaClass.getName()), FilterEntity.class);<NEW_LINE>q.setParameter(1, fromUser.getId());<NEW_LINE>List<FilterEntity> fromUserFilters = q.getResultList();<NEW_LINE>for (FilterEntity filter : fromUserFilters) {<NEW_LINE>FilterEntity newFilter = metadata.create(FilterEntity.class);<NEW_LINE>newFilter.setUser(toUser);<NEW_LINE>newFilter.setCode(filter.getCode());<NEW_LINE>newFilter.setName(filter.getName());<NEW_LINE>newFilter.<MASK><NEW_LINE>newFilter.setXml(filter.getXml());<NEW_LINE>filtersMap.put(filter.getId(), newFilter);<NEW_LINE>em.persist(newFilter);<NEW_LINE>}<NEW_LINE>tx.commit();<NEW_LINE>return filtersMap;<NEW_LINE>}<NEW_LINE>} | setComponentId(filter.getComponentId()); |
1,331,927 | private void processBadEvent(String methodName, int methodEventId, ConnectionEvent eventIn) {<NEW_LINE>// Connection Event passed in doesn't match the method called.<NEW_LINE>// This should never happen unless there is an error in the ResourceAdapter.<NEW_LINE>String eventIdIn = Integer.toString(eventIn.getId());<NEW_LINE>String xpathId = mcWrapper.gConfigProps.getXpathId();<NEW_LINE>String cfName = mcWrapper.gConfigProps.cfName;<NEW_LINE>Tr.error(tc, "UNEXPECTED_CONNECTION_EVENT_J2CA0034", methodEventId, eventIdIn, cfName);<NEW_LINE>// Retrieve the corresponding ManagedConnection.<NEW_LINE>ManagedConnection mc = null;<NEW_LINE>try {<NEW_LINE>mc = (ManagedConnection) eventIn.getSource();<NEW_LINE>} catch (ClassCastException cce) {<NEW_LINE>Tr.error(tc, "GET_SOURCE_CLASS_CAST_EXCP_J2CA0098", cce);<NEW_LINE>RuntimeException rte = new IllegalStateException("processBadEvent: ClassCastException occurred attempting to cast event.getSource to ManagedConnection");<NEW_LINE>FFDCFilter.processException(cce, "com.ibm.ejs.j2c.ConnectionEventListener.processBadEvent", "809", this);<NEW_LINE>throw rte;<NEW_LINE>}<NEW_LINE>// Force the cleanup of the MC.<NEW_LINE>ConnectionEvent errorEvent = new ConnectionEvent(mc, ConnectionEvent.CONNECTION_ERROR_OCCURRED);<NEW_LINE>this.connectionErrorOccurred(errorEvent);<NEW_LINE>// Throw a runtime exception<NEW_LINE>RuntimeException rte = new IllegalStateException("Method " + methodName + " detected an unexpected ConnectionEvent of " + eventIdIn + " for DataSource/ConnectionFactory " + xpathId);<NEW_LINE>FFDCFilter.processException(<MASK><NEW_LINE>throw rte;<NEW_LINE>} | rte, "com.ibm.ejs.j2c.ConnectionEventListener.processBadEvent", "709", this); |
45,365 | public synchronized void unstage(Collection<String> deploymentIdsProvided) throws EPStageException {<NEW_LINE>checkDestroyed();<NEW_LINE>Set<String> deploymentIds = checkArgument(deploymentIdsProvided);<NEW_LINE>if (deploymentIds.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>checkDeploymentIdsExist(deploymentIds, stageSpecificServices.getDeploymentLifecycleService());<NEW_LINE>validateDependencyPreconditions(deploymentIds, stageSpecificServices, stageSpecificServices.getDeploymentLifecycleService());<NEW_LINE>Set<Integer> statementIds = new HashSet<>();<NEW_LINE>for (String deploymentId : deploymentIds) {<NEW_LINE>DeploymentInternal deployment = stageSpecificServices.getDeploymentLifecycleService().getDeploymentById(deploymentId);<NEW_LINE>traverseContextPartitions(deployment, this::processUnstage);<NEW_LINE>traverseStatements(deployment, statementContext -> updateStatement(statementContext, servicesContext), statementIds);<NEW_LINE>movePath(deployment, stageSpecificServices, servicesContext);<NEW_LINE>stageSpecificServices.getDeploymentLifecycleService().removeDeployment(deploymentId);<NEW_LINE>servicesContext.getDeploymentLifecycleService().addDeployment(deploymentId, deployment);<NEW_LINE>servicesContext.getStageRecoveryService().deploymentRemoveFromStages(deploymentId);<NEW_LINE>}<NEW_LINE>stageSpecificServices.getSchedulingService().transfer(<MASK><NEW_LINE>} | statementIds, servicesContext.getSchedulingService()); |
1,375,323 | public void onSuccess(@Nullable List<Map<String, TsValue>> result) {<NEW_LINE>missingTelemetryFutures.forEach((key, value) -> {<NEW_LINE>try {<NEW_LINE>key.getLatest().get(EntityKeyType.TIME_SERIES).putAll(value.get());<NEW_LINE>} catch (InterruptedException | ExecutionException e) {<NEW_LINE>log.warn("[{}][{}] Failed to lookup latest telemetry: {}:{}", ctx.getSessionId(), ctx.getCmdId(), key.<MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>EntityDataUpdate update;<NEW_LINE>if (!ctx.isInitialDataSent()) {<NEW_LINE>update = new EntityDataUpdate(ctx.getCmdId(), ctx.getData(), null, ctx.getMaxEntitiesPerDataSubscription());<NEW_LINE>ctx.setInitialDataSent(true);<NEW_LINE>} else {<NEW_LINE>update = new EntityDataUpdate(ctx.getCmdId(), null, ctx.getData().getData(), ctx.getMaxEntitiesPerDataSubscription());<NEW_LINE>}<NEW_LINE>wsService.sendWsMsg(ctx.getSessionId(), update);<NEW_LINE>ctx.createLatestValuesSubscriptions(latestCmd.getKeys());<NEW_LINE>} | getEntityId(), allTsKeys, e); |
161,708 | private Pair<Long, Long> calcOperatorInterval(FilterOperator filterOperator) {<NEW_LINE>if (filterOperator.getSinglePath() != null && !IoTDBConstant.TIME.equals(filterOperator.getSinglePath().getMeasurement())) {<NEW_LINE>throw new SQLParserException(DELETE_ONLY_SUPPORT_TIME_EXP_ERROR_MSG);<NEW_LINE>}<NEW_LINE>long time = Long.parseLong(((BasicFunctionOperator) filterOperator).getValue());<NEW_LINE>switch(filterOperator.getFilterType()) {<NEW_LINE>case LESSTHAN:<NEW_LINE>return new Pair<>(Long.MIN_VALUE, time - 1);<NEW_LINE>case LESSTHANOREQUALTO:<NEW_LINE>return new Pair<>(Long.MIN_VALUE, time);<NEW_LINE>case GREATERTHAN:<NEW_LINE>return new Pair<>(time + 1, Long.MAX_VALUE);<NEW_LINE>case GREATERTHANOREQUALTO:<NEW_LINE>return new Pair<<MASK><NEW_LINE>case EQUAL:<NEW_LINE>return new Pair<>(time, time);<NEW_LINE>default:<NEW_LINE>throw new SQLParserException(DELETE_RANGE_ERROR_MSG);<NEW_LINE>}<NEW_LINE>} | >(time, Long.MAX_VALUE); |
1,345,533 | public PartitionGetResult partitionGet(PartitionGetParam partParam) {<NEW_LINE>HistAggrParam.HistPartitionAggrParam param = (HistAggrParam.HistPartitionAggrParam) partParam;<NEW_LINE>LOG.info("For the gradient histogram of GBDT, we use PS to find the optimal split");<NEW_LINE>GBDTParam gbtparam = new GBDTParam();<NEW_LINE>gbtparam.numSplit = param.getSplitNum();<NEW_LINE>gbtparam.minChildWeight = param.getMinChildWeight();<NEW_LINE>gbtparam.regAlpha = param.getRegAlpha();<NEW_LINE>gbtparam.regLambda = param.getRegLambda();<NEW_LINE>ServerIntDoubleRow row = (ServerIntDoubleRow) psContext.getMatrixStorageManager().getRow(param.getMatrixId(), param.getRowId(), param.getPartKey().getPartitionId());<NEW_LINE>SplitEntry splitEntry = GradHistHelper.findSplitOfServerRow(row, gbtparam);<NEW_LINE>int fid = splitEntry.getFid();<NEW_LINE>int splitIndex = (int) splitEntry.getFvalue();<NEW_LINE>double lossGain = splitEntry.getLossChg();<NEW_LINE>GradStats leftGradStat = splitEntry.leftGradStat;<NEW_LINE>GradStats rightGradStat = splitEntry.rightGradStat;<NEW_LINE>double leftSumGrad = leftGradStat.sumGrad;<NEW_LINE>double leftSumHess = leftGradStat.sumHess;<NEW_LINE>double rightSumGrad = rightGradStat.sumGrad;<NEW_LINE>double rightSumHess = rightGradStat.sumHess;<NEW_LINE>LOG.info(String.format("split of matrix[%d] part[%d] row[%d]: fid[%d], split index[%d], loss gain[%f], " + "left sumGrad[%f], left sum hess[%f], right sumGrad[%f], right sum hess[%f]", param.getMatrixId(), param.getPartKey().getPartitionId(), param.getRowId(), fid, splitIndex, lossGain, leftSumGrad, leftSumHess, rightSumGrad, rightSumHess));<NEW_LINE>int startFid = (int) row.getStartCol() <MASK><NEW_LINE>// each split contains 7 doubles<NEW_LINE>int sendStartCol = startFid * 7;<NEW_LINE>// int sendStartCol = (int) row.getStartCol();<NEW_LINE>int sendEndCol = sendStartCol + 7;<NEW_LINE>ServerIntDoubleRow sendRow = new ServerIntDoubleRow(param.getRowId(), RowType.T_DOUBLE_DENSE, sendStartCol, sendEndCol, sendEndCol - sendStartCol, RouterType.RANGE);<NEW_LINE>LOG.info(String.format("Create server row of split result: row id[%d], start col[%d], end col[%d]", param.getRowId(), sendStartCol, sendEndCol));<NEW_LINE>sendRow.set(0 + sendStartCol, fid);<NEW_LINE>sendRow.set(1 + sendStartCol, splitIndex);<NEW_LINE>sendRow.set(2 + sendStartCol, lossGain);<NEW_LINE>sendRow.set(3 + sendStartCol, leftSumGrad);<NEW_LINE>sendRow.set(4 + sendStartCol, leftSumHess);<NEW_LINE>sendRow.set(5 + sendStartCol, rightSumGrad);<NEW_LINE>sendRow.set(6 + sendStartCol, rightSumHess);<NEW_LINE>return new PartitionGetRowResult(sendRow);<NEW_LINE>} | / (2 * gbtparam.numSplit); |
1,259,300 | private void addObjectRecord(final String name) throws IOException {<NEW_LINE>assert name != null;<NEW_LINE>final ObjectRecordValue<?> value = getObjectRecordValue();<NEW_LINE>final long key;<NEW_LINE>switch(insert) {<NEW_LINE>case AS_FIRST_CHILD:<NEW_LINE>if (parents.peek() == Fixed.NULL_NODE_KEY.getStandardProperty()) {<NEW_LINE>key = wtx.insertObjectRecordAsFirstChild(name, value).getNodeKey();<NEW_LINE>} else {<NEW_LINE>key = wtx.insertObjectRecordAsRightSibling(name, value).getNodeKey();<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case AS_LAST_CHILD:<NEW_LINE>if (parents.peek() == Fixed.NULL_NODE_KEY.getStandardProperty()) {<NEW_LINE>key = wtx.insertObjectRecordAsLastChild(name, value).getNodeKey();<NEW_LINE>} else {<NEW_LINE>key = wtx.insertObjectRecordAsRightSibling(name, value).getNodeKey();<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case AS_LEFT_SIBLING:<NEW_LINE>key = wtx.insertObjectRecordAsLeftSibling(name, value).getNodeKey();<NEW_LINE>break;<NEW_LINE>case AS_RIGHT_SIBLING:<NEW_LINE>key = wtx.insertObjectRecordAsRightSibling(name, value).getNodeKey();<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>// Should not happen<NEW_LINE>throw new AssertionError();<NEW_LINE>}<NEW_LINE>parents.pop();<NEW_LINE>parents.<MASK><NEW_LINE>parents.push(Fixed.NULL_NODE_KEY.getStandardProperty());<NEW_LINE>if (wtx.getKind() == NodeKind.OBJECT || wtx.getKind() == NodeKind.ARRAY) {<NEW_LINE>parents.pop();<NEW_LINE>parents.push(key);<NEW_LINE>parents.push(Fixed.NULL_NODE_KEY.getStandardProperty());<NEW_LINE>} else {<NEW_LINE>final boolean isNextTokenParentToken = reader.peek() == JsonToken.NAME || reader.peek() == JsonToken.END_OBJECT;<NEW_LINE>adaptTrxPosAndStack(isNextTokenParentToken, key);<NEW_LINE>}<NEW_LINE>} | push(wtx.getParentKey()); |
496,552 | private I_C_OrderLine createOrderLine(final PurchaseCandidate candidate) {<NEW_LINE>final int flatrateDataEntryId = candidate.getC_Flatrate_DataEntry_ID();<NEW_LINE>final int huPIItemProductId = candidate.getM_HU_PI_Item_Product_ID();<NEW_LINE>final Timestamp datePromised = candidate.getDatePromised();<NEW_LINE>final BigDecimal price = candidate.getPrice();<NEW_LINE>final I_C_OrderLine orderLine = orderLineBL.createOrderLine(order, I_C_OrderLine.class);<NEW_LINE>orderLine.setIsMFProcurement(true);<NEW_LINE>//<NEW_LINE>// BPartner/Location/Contact<NEW_LINE>OrderLineDocumentLocationAdapterFactory.locationAdapter(orderLine).setFromOrderHeader(order);<NEW_LINE>//<NEW_LINE>// PMM Contract<NEW_LINE>if (flatrateDataEntryId > 0) {<NEW_LINE>orderLine.setC_Flatrate_DataEntry_ID(flatrateDataEntryId);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Product/UOM/Handling unit<NEW_LINE>orderLine.setM_Product_ID(candidate.getM_Product_ID());<NEW_LINE>orderLine.setC_UOM_ID(candidate.getC_UOM_ID());<NEW_LINE>if (huPIItemProductId > 0) {<NEW_LINE>orderLine.setM_HU_PI_Item_Product_ID(huPIItemProductId);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// ASI<NEW_LINE>final AttributeSetInstanceId attributeSetInstanceId = candidate.getAttributeSetInstanceId();<NEW_LINE>final I_M_AttributeSetInstance contractASI = attributeSetInstanceId.isRegular() ? Services.get(IAttributeDAO.class<MASK><NEW_LINE>final I_M_AttributeSetInstance asi;<NEW_LINE>if (contractASI != null) {<NEW_LINE>asi = Services.get(IAttributeDAO.class).copy(contractASI);<NEW_LINE>} else {<NEW_LINE>asi = null;<NEW_LINE>}<NEW_LINE>orderLine.setPMM_Contract_ASI(contractASI);<NEW_LINE>orderLine.setM_AttributeSetInstance(asi);<NEW_LINE>//<NEW_LINE>// Quantities<NEW_LINE>orderLine.setQtyEntered(BigDecimal.ZERO);<NEW_LINE>orderLine.setQtyOrdered(BigDecimal.ZERO);<NEW_LINE>//<NEW_LINE>// Dates<NEW_LINE>orderLine.setDatePromised(datePromised);<NEW_LINE>//<NEW_LINE>// Pricing<NEW_LINE>// go with the candidate's price. e.g. don't reset it to 0 because we have no PL<NEW_LINE>orderLine.setIsManualPrice(true);<NEW_LINE>orderLine.setPriceEntered(price);<NEW_LINE>orderLine.setPriceActual(price);<NEW_LINE>//<NEW_LINE>// BPartner/Location/Contact<NEW_LINE>return orderLine;<NEW_LINE>} | ).getAttributeSetInstanceById(attributeSetInstanceId) : null; |
459,701 | public void keyPressed(KeyEvent ev) {<NEW_LINE>if (ev.stateMask == SWT.CTRL) {<NEW_LINE>if (ev.keyCode == 97) {<NEW_LINE>if (ev.widget instanceof Text) {<NEW_LINE>((Text) ev.widget).selectAll();<NEW_LINE>} else if (ev.widget instanceof StyledText) {<NEW_LINE>((StyledText) ev.widget).selectAll();<NEW_LINE>}<NEW_LINE>} else if (ev.keyCode == 115) {<NEW_LINE>FileDialog dialog = new FileDialog(superShell, SWT.SAVE);<NEW_LINE>dialog.setFileName(fileName);<NEW_LINE>String file = dialog.open();<NEW_LINE>if (file == null)<NEW_LINE>return;<NEW_LINE>try {<NEW_LINE>if (ev.widget instanceof Text) {<NEW_LINE>save(file, ((Text) ev.widget).getText());<NEW_LINE>} else if (ev.widget instanceof StyledText) {<NEW_LINE>save(file, ((StyledText) ev.widget).getText());<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>ConsoleProxy.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>super.keyPressed(ev);<NEW_LINE>} | errorSafe(ex.toString()); |
1,624,151 | public static BoundingBox mapWayToBoundingBox(TDWay way) {<NEW_LINE>TDNode[] wayNodes = way.getWayNodes();<NEW_LINE>if (wayNodes.length < 3) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>double lat = LatLongUtils.microdegreesToDegrees(wayNodes[0].getLatitude());<NEW_LINE>double lon = LatLongUtils.microdegreesToDegrees(wayNodes[0].getLongitude());<NEW_LINE>BoundingBox bb = new BoundingBox(lat, lon, lat, lon);<NEW_LINE>for (int i = 1; i < wayNodes.length; i++) {<NEW_LINE>bb = bb.extendCoordinates(LatLongUtils.microdegreesToDegrees(wayNodes[i].getLatitude()), LatLongUtils.microdegreesToDegrees(wayNodes[i].getLongitude()));<NEW_LINE>}<NEW_LINE>return bb;<NEW_LINE>} catch (IllegalArgumentException ex) {<NEW_LINE>LOGGER.warning("wrong coordinates on way: " + way.toString() + "\nLat: " + LatLongUtils.microdegreesToDegrees(wayNodes[0].getLatitude()) + " Lon: " + LatLongUtils.microdegreesToDegrees(wayNodes[<MASK><NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | 0].getLongitude())); |
626,534 | public Mono<ShouldRetryResult> shouldRetry(Exception exception) {<NEW_LINE>Duration backoffTime = Duration.ofSeconds(0);<NEW_LINE>if (!WebExceptionUtility.isWebExceptionRetriable(exception)) {<NEW_LINE>// Have caller propagate original exception.<NEW_LINE>this.durationTimer.stop();<NEW_LINE>return Mono.just(ShouldRetryResult.noRetryOnNonRelatedException());<NEW_LINE>}<NEW_LINE>// Don't penalise first retry with delay.<NEW_LINE>if (attemptCount++ > 1) {<NEW_LINE>int remainingSeconds = WebExceptionRetryPolicy.waitTimeInSeconds - Math.toIntExact(this.durationTimer.getTime(TimeUnit.SECONDS));<NEW_LINE>if (remainingSeconds <= 0) {<NEW_LINE>this.durationTimer.stop();<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>backoffTime = Duration.ofSeconds(Math.min(this.currentBackoffSeconds, remainingSeconds));<NEW_LINE>this.currentBackoffSeconds *= WebExceptionRetryPolicy.backoffMultiplier;<NEW_LINE>}<NEW_LINE>logger.warn("Received retriable web exception, will retry", exception);<NEW_LINE>return Mono.just(ShouldRetryResult.retryAfter(backoffTime));<NEW_LINE>} | just(ShouldRetryResult.noRetry()); |
1,715,135 | final RegExp parseRepeatExp() throws IllegalArgumentException {<NEW_LINE>RegExp e = parseComplExp();<NEW_LINE>while (peek("?*+{")) {<NEW_LINE>if (match('?')) {<NEW_LINE>e = makeOptional(e);<NEW_LINE>} else if (match('*')) {<NEW_LINE>e = makeRepeat(e);<NEW_LINE>} else if (match('+')) {<NEW_LINE>e = makeRepeat(e, 1);<NEW_LINE>} else if (match('{')) {<NEW_LINE>int start = _pos;<NEW_LINE>while (peek("0123456789")) {<NEW_LINE>next();<NEW_LINE>}<NEW_LINE>if (start == _pos) {<NEW_LINE>throw new IllegalArgumentException("integer expected at position " + _pos);<NEW_LINE>}<NEW_LINE>int n = Integer.parseInt(_inputString.substring(start, _pos));<NEW_LINE>int m = -1;<NEW_LINE>if (match(',')) {<NEW_LINE>start = _pos;<NEW_LINE>while (peek("0123456789")) {<NEW_LINE>next();<NEW_LINE>}<NEW_LINE>if (start != _pos) {<NEW_LINE>m = Integer.parseInt(_inputString.substring(start, _pos));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>m = n;<NEW_LINE>}<NEW_LINE>if (!match('}')) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (m == -1) {<NEW_LINE>e = makeRepeat(e, n);<NEW_LINE>} else {<NEW_LINE>e = makeRepeat(e, n, m);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return e;<NEW_LINE>} | throw new IllegalArgumentException("expected '}' at position " + _pos); |
1,119,598 | public static void init() throws SlickException, FontFormatException, IOException {<NEW_LINE>float fontBase = 12f * GameImage.getUIscale();<NEW_LINE>Font javaFontMain = Font.createFont(Font.TRUETYPE_FONT, ResourceLoader.getResourceAsStream(Options.FONT_MAIN));<NEW_LINE>Font javaFontBold = Font.createFont(Font.TRUETYPE_FONT, ResourceLoader.getResourceAsStream(Options.FONT_BOLD));<NEW_LINE>Font javaFontCJK = Font.createFont(Font.TRUETYPE_FONT, ResourceLoader.getResourceAsStream(Options.FONT_CJK));<NEW_LINE>Font fontMain = javaFontMain.deriveFont(Font.PLAIN, (int) (fontBase * 4 / 3));<NEW_LINE>Font fontBold = javaFontBold.deriveFont(Font.PLAIN, (int) (fontBase * 4 / 3));<NEW_LINE>Font fontCJK = javaFontCJK.deriveFont(Font.PLAIN, (int) (fontBase * 4 / 3));<NEW_LINE>DEFAULT = new UnicodeFont(fontMain);<NEW_LINE>BOLD = new UnicodeFont(fontBold.deriveFont(Font.BOLD));<NEW_LINE>XLARGE = new UnicodeFont(fontMain.deriveFont(fontBase * 3));<NEW_LINE>LARGE = new UnicodeFont(fontMain.deriveFont(fontBase * 2));<NEW_LINE>MEDIUM = new UnicodeFont(fontMain.deriveFont(fontBase * 3 / 2));<NEW_LINE>MEDIUMBOLD = new UnicodeFont(fontBold.deriveFont(Font.BOLD, fontBase * 3 / 2));<NEW_LINE>SMALL = new UnicodeFont(fontMain.deriveFont(fontBase));<NEW_LINE>SMALLBOLD = new UnicodeFont(fontBold.deriveFont(Font.BOLD, fontBase));<NEW_LINE>ColorEffect colorEffect = new ColorEffect();<NEW_LINE>loadFont(DEFAULT, colorEffect, new UnicodeFont(fontCJK));<NEW_LINE>loadFont(BOLD, colorEffect, new UnicodeFont(fontCJK.deriveFont(Font.BOLD)));<NEW_LINE>loadFont(XLARGE, colorEffect, new UnicodeFont(fontCJK.<MASK><NEW_LINE>loadFont(LARGE, colorEffect, new UnicodeFont(fontCJK.deriveFont(fontBase * 2)));<NEW_LINE>loadFont(MEDIUM, colorEffect, new UnicodeFont(fontCJK.deriveFont(fontBase * 3 / 2)));<NEW_LINE>loadFont(MEDIUMBOLD, colorEffect, new UnicodeFont(fontCJK.deriveFont(Font.BOLD, fontBase * 3 / 2)));<NEW_LINE>loadFont(SMALL, colorEffect, new UnicodeFont(fontCJK.deriveFont(fontBase)));<NEW_LINE>loadFont(SMALLBOLD, colorEffect, new UnicodeFont(fontCJK.deriveFont(Font.BOLD, fontBase)));<NEW_LINE>} | deriveFont(fontBase * 3))); |
1,542,794 | public String select() {<NEW_LINE>assert imageUuid != null : "imageUuid cannot be null";<NEW_LINE>assert zoneUuid != null : "zoneUuid cannot be null";<NEW_LINE>TypedQuery<String> q;<NEW_LINE>if (checkStatus) {<NEW_LINE>String sql = "select bs.uuid from BackupStorageVO bs, BackupStorageZoneRefVO bsRef, ImageBackupStorageRefVO iref where" + " bs.uuid = bsRef.backupStorageUuid and bsRef.zoneUuid = :zoneUuid and iref.backupStorageUuid = bs.uuid and" + " bs.status = :bsStatus and iref.imageUuid = :imageUuid and iref.status != :refStatus";<NEW_LINE>q = dbf.getEntityManager().createQuery(sql, String.class);<NEW_LINE><MASK><NEW_LINE>q.setParameter("bsStatus", BackupStorageStatus.Connected);<NEW_LINE>q.setParameter("imageUuid", imageUuid);<NEW_LINE>q.setParameter("refStatus", ImageStatus.Deleted);<NEW_LINE>} else {<NEW_LINE>String sql = "select bs.uuid from BackupStorageVO bs, BackupStorageZoneRefVO bsRef, ImageBackupStorageRefVO iref where" + " bs.uuid = bsRef.backupStorageUuid and bsRef.zoneUuid = :zoneUuid and iref.backupStorageUuid = bs.uuid and" + " iref.imageUuid = :imageUuid and iref.status != :refStatus";<NEW_LINE>q = dbf.getEntityManager().createQuery(sql, String.class);<NEW_LINE>q.setParameter("zoneUuid", zoneUuid);<NEW_LINE>q.setParameter("imageUuid", imageUuid);<NEW_LINE>q.setParameter("refStatus", ImageStatus.Deleted);<NEW_LINE>}<NEW_LINE>List<String> bsUuids = q.getResultList();<NEW_LINE>if (bsUuids.isEmpty()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return bsUuids.get(0);<NEW_LINE>} | q.setParameter("zoneUuid", zoneUuid); |
190,200 | public static Expression substituteBoolExpression(ConfigVariableExpander cve, Expression expression) {<NEW_LINE>try {<NEW_LINE>if (expression instanceof BinaryBooleanExpression) {<NEW_LINE>BinaryBooleanExpression binaryBoolExp = (BinaryBooleanExpression) expression;<NEW_LINE>Expression substitutedLeftExp = substituteBoolExpression(cve, binaryBoolExp.getLeft());<NEW_LINE>Expression substitutedRightExp = substituteBoolExpression(cve, binaryBoolExp.getRight());<NEW_LINE>if (substitutedLeftExp != binaryBoolExp.getLeft() || substitutedRightExp != binaryBoolExp.getRight()) {<NEW_LINE>Constructor<? extends BinaryBooleanExpression> constructor = binaryBoolExp.getClass().getConstructor(SourceWithMetadata.class, Expression.class, Expression.class);<NEW_LINE>return constructor.newInstance(binaryBoolExp.getSourceWithMetadata(), substitutedLeftExp, substitutedRightExp);<NEW_LINE>}<NEW_LINE>} else if (expression instanceof UnaryBooleanExpression) {<NEW_LINE>UnaryBooleanExpression unaryBoolExp = (UnaryBooleanExpression) expression;<NEW_LINE>Expression substitutedExp = substituteBoolExpression(cve, unaryBoolExp.getExpression());<NEW_LINE>if (substitutedExp != unaryBoolExp.getExpression()) {<NEW_LINE>Constructor<? extends UnaryBooleanExpression> constructor = unaryBoolExp.getClass().getConstructor(SourceWithMetadata.class, Expression.class);<NEW_LINE>return constructor.newInstance(<MASK><NEW_LINE>}<NEW_LINE>} else if (expression instanceof ValueExpression && !(expression instanceof RegexValueExpression) && (((ValueExpression) expression).get() != null)) {<NEW_LINE>final String key = "placeholder";<NEW_LINE>Map<String, Object> args = ImmutableMap.of(key, ((ValueExpression) expression).get());<NEW_LINE>Map<String, Object> substitutedArgs = CompiledPipeline.expandConfigVariables(cve, args);<NEW_LINE>return new ValueExpression(expression.getSourceWithMetadata(), substitutedArgs.get(key));<NEW_LINE>}<NEW_LINE>return expression;<NEW_LINE>} catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException | InvalidIRException e) {<NEW_LINE>throw new IllegalStateException("Unable to instantiate substituted condition expression", e);<NEW_LINE>}<NEW_LINE>} | unaryBoolExp.getSourceWithMetadata(), substitutedExp); |
239,487 | static VisitsForWeek boundContributedDays(VisitsForWeek visits, int maxContributedDays) {<NEW_LINE>Map<String, Set<DayOfWeek>> boundedVisitorDays = new HashMap<>();<NEW_LINE>List<Visit> allVisits = new ArrayList<>();<NEW_LINE>VisitsForWeek boundedVisits = new VisitsForWeek();<NEW_LINE>// Add all visits to a list in order to shuffle them.<NEW_LINE>for (DayOfWeek d : DayOfWeek.values()) {<NEW_LINE>Collection<Visit> <MASK><NEW_LINE>allVisits.addAll(visitsForDay);<NEW_LINE>}<NEW_LINE>Collections.shuffle(allVisits);<NEW_LINE>// For each visitorId, copy their visits for at most maxContributedDays days to the result.<NEW_LINE>for (Visit visit : allVisits) {<NEW_LINE>String visitorId = visit.visitorId();<NEW_LINE>DayOfWeek visitDay = visit.day();<NEW_LINE>if (boundedVisitorDays.containsKey(visitorId)) {<NEW_LINE>Set<DayOfWeek> visitorDays = boundedVisitorDays.get(visitorId);<NEW_LINE>if (visitorDays.contains(visitDay)) {<NEW_LINE>boundedVisits.addVisit(visit);<NEW_LINE>} else if (visitorDays.size() < maxContributedDays) {<NEW_LINE>visitorDays.add(visitDay);<NEW_LINE>boundedVisits.addVisit(visit);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Set<DayOfWeek> visitorDays = new HashSet<>();<NEW_LINE>boundedVisitorDays.put(visitorId, visitorDays);<NEW_LINE>visitorDays.add(visitDay);<NEW_LINE>boundedVisits.addVisit(visit);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return boundedVisits;<NEW_LINE>} | visitsForDay = visits.getVisitsForDay(d); |
1,458,292 | private void init() {<NEW_LINE>this.parameterList = null;<NEW_LINE>if (this.ctx == null) {<NEW_LINE>this.ctx = new Context();<NEW_LINE>}<NEW_LINE>this.whereList = new HashSet<String>();<NEW_LINE>this.selectList = new HashSet<String>();<NEW_LINE>this.recycleList = new ArrayList<String>();<NEW_LINE>this.intoFileName = "";<NEW_LINE>this.singleTable = false;<NEW_LINE>this.withTableMap = new HashMap<String, JoinTable>();<NEW_LINE>this.isMemory = false;<NEW_LINE>this.parallelNumber = 1;<NEW_LINE>this.subQueryOfExistsEntryList = new ArrayList<Map.Entry<String<MASK><NEW_LINE>this.subQueryOfSelectEntryList = new ArrayList<Map.Entry<String, Token[]>>();<NEW_LINE>this.subQueryOfInEntryList = new ArrayList<Map.Entry<String, Token[]>>();<NEW_LINE>this.subQueryOfWhereEntryList = new ArrayList<Map.Entry<String, Token[]>>();<NEW_LINE>this.subQueryOfExistsMap = new HashMap<String, String>();<NEW_LINE>this.subQueryOfSelectMap = new HashMap<String, String>();<NEW_LINE>this.subQueryOfInMap = new HashMap<String, String>();<NEW_LINE>this.subQueryOfWhereMap = new HashMap<String, String>();<NEW_LINE>} | , Token[]>>(); |
160,105 | public StageExecution unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>StageExecution stageExecution = new StageExecution();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("pipelineExecutionId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>stageExecution.setPipelineExecutionId(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("status", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>stageExecution.setStatus(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return stageExecution;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
861,519 | public ApiResponse<Void> createUsersWithArrayInputWithHttpInfo(List<User> user) throws ApiException {<NEW_LINE>Object localVarPostBody = user;<NEW_LINE>// verify the required parameter 'user' is set<NEW_LINE>if (user == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'user' when calling createUsersWithArrayInput");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/user/createWithArray";<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, String> localVarCookieParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>final String[] localVarAccepts = {};<NEW_LINE>final String <MASK><NEW_LINE>final String[] localVarContentTypes = { "application/json" };<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] {};<NEW_LINE>return apiClient.invokeAPI("UserApi.createUsersWithArrayInput", localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null, false);<NEW_LINE>} | localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); |
131,824 | public ActionResult<Wo> call() throws Exception {<NEW_LINE>ActionResult<Wo> result = new ActionResult<>();<NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>Business business = new Business(emc);<NEW_LINE>WorkCompleted workCompleted = emc.find(id, WorkCompleted.class);<NEW_LINE>if (null == workCompleted) {<NEW_LINE>throw new ExceptionEntityNotExist(id, WorkCompleted.class);<NEW_LINE>}<NEW_LINE>Snap snap = new Snap(workCompleted);<NEW_LINE>List<Item> items = new ArrayList<>();<NEW_LINE>List<TaskCompleted> taskCompleteds = new ArrayList<>();<NEW_LINE>List<Read> reads = new ArrayList<>();<NEW_LINE>List<ReadCompleted> readCompleteds = new ArrayList<>();<NEW_LINE>List<Review> reviews = new ArrayList<>();<NEW_LINE>List<WorkLog> workLogs = new ArrayList<>();<NEW_LINE>List<Record> records = new ArrayList<>();<NEW_LINE>List<Attachment> attachments = new ArrayList<>();<NEW_LINE>snap.setProperties(snap(business, workCompleted.getJob(), items, workCompleted, taskCompleteds, reads, readCompleteds, reviews, workLogs, records, attachments));<NEW_LINE>snap.setType(Snap.TYPE_SNAPWORKCOMPLETED);<NEW_LINE>emc.beginTransaction(Snap.class);<NEW_LINE>emc.<MASK><NEW_LINE>emc.commit();<NEW_LINE>// clean(business, items, workCompleted, taskCompleteds, reads, readCompleteds, reviews, workLogs, records,<NEW_LINE>// attachments);<NEW_LINE>// emc.commit();<NEW_LINE>Wo wo = new Wo();<NEW_LINE>wo.setId(snap.getId());<NEW_LINE>result.setData(wo);<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>} | persist(snap, CheckPersistType.all); |
1,119,566 | public Apple read(JsonReader in) throws IOException {<NEW_LINE>JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject();<NEW_LINE>validateJsonObject(jsonObj);<NEW_LINE>// store additional fields in the deserialized instance<NEW_LINE>Apple <MASK><NEW_LINE>for (Map.Entry<String, JsonElement> entry : jsonObj.entrySet()) {<NEW_LINE>if (!openapiFields.contains(entry.getKey())) {<NEW_LINE>if (entry.getValue().isJsonPrimitive()) {<NEW_LINE>// primitive type<NEW_LINE>if (entry.getValue().getAsJsonPrimitive().isString())<NEW_LINE>instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString());<NEW_LINE>else if (entry.getValue().getAsJsonPrimitive().isNumber())<NEW_LINE>instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber());<NEW_LINE>else if (entry.getValue().getAsJsonPrimitive().isBoolean())<NEW_LINE>instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());<NEW_LINE>else<NEW_LINE>throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));<NEW_LINE>} else {<NEW_LINE>// non-primitive type<NEW_LINE>instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return instance;<NEW_LINE>} | instance = thisAdapter.fromJsonTree(jsonObj); |
389,638 | protected static String poa(Object o, String indent, boolean dumpCollection, int depth) {<NEW_LINE>if (dumpCollection == false || o == null || depth > 5) {<NEW_LINE>return poa(o);<NEW_LINE>}<NEW_LINE>final Class<?> oClass = o.getClass();<NEW_LINE>final StringBuilder sb = new StringBuilder();<NEW_LINE>if (oClass.isArray()) {<NEW_LINE>sb<MASK><NEW_LINE>final Object[] objarr = (Object[]) o;<NEW_LINE>int idx = 0;<NEW_LINE>for (Object obj : objarr) {<NEW_LINE>sb.append("\n").append(indent).append(idx++).append(" : ");<NEW_LINE>sb.append(poa(obj, indent + " ", true, depth++));<NEW_LINE>}<NEW_LINE>} else if (isCastable("java.util.Collection", oClass)) {<NEW_LINE>// (Collection.class.isInstance(o)) {<NEW_LINE>sb.append(getInstanceClassAndAddress(o));<NEW_LINE>sb.append(":");<NEW_LINE>Collection<?> c = (Collection<?>) o;<NEW_LINE>for (Object obj : c) {<NEW_LINE>sb.append("\n").append(indent).append(poa(obj, indent + " ", true, depth++));<NEW_LINE>}<NEW_LINE>} else if (isCastable("java.util.Map", oClass)) {<NEW_LINE>// (Collection.class.isInstance(o)) {<NEW_LINE>sb.append(getInstanceClassAndAddress(o));<NEW_LINE>sb.append(":");<NEW_LINE>final Map<?, ?> map = (Map<?, ?>) o;<NEW_LINE>for (Map.Entry<?, ?> entry : map.entrySet()) {<NEW_LINE>sb.append("\n").append(indent).append(poa(entry.getKey())).append(" |---> ");<NEW_LINE>sb.append(poa(entry.getValue(), indent + " ", true, depth++));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>return poa(o);<NEW_LINE>}<NEW_LINE>return sb.toString();<NEW_LINE>} | .append(getInstanceClassAndAddress(o)); |
1,103,275 | protected Optional<ActiveSession> performHandshake(Tracer tracer, X additionalData, URL url, Set<Dialect> downstreamDialects, Capabilities capabilities) {<NEW_LINE>try {<NEW_LINE>HttpClient client = HttpClient.Factory.createDefault().createClient(url);<NEW_LINE>Command command = new Command(null, DriverCommand.NEW_SESSION(capabilities));<NEW_LINE>ProtocolHandshake.Result result = new ProtocolHandshake().createSession(client, command);<NEW_LINE>HttpHandler codec;<NEW_LINE>Dialect upstream = result.getDialect();<NEW_LINE>Dialect downstream;<NEW_LINE>if (downstreamDialects.contains(result.getDialect())) {<NEW_LINE>codec = new ReverseProxyHandler(tracer, client);<NEW_LINE>downstream = upstream;<NEW_LINE>} else {<NEW_LINE>downstream = downstreamDialects.isEmpty() ? OSS : downstreamDialects.iterator().next();<NEW_LINE>codec = new ProtocolConverter(tracer, client, downstream, upstream);<NEW_LINE>}<NEW_LINE>Response response = result.createResponse();<NEW_LINE>// noinspection unchecked<NEW_LINE>Optional<ActiveSession> activeSession = Optional.of(newActiveSession(additionalData, downstream, upstream, codec, new SessionId(response.getSessionId()), (Map<String, Object><MASK><NEW_LINE>activeSession.ifPresent(session -> LOG.info("Started new session " + session));<NEW_LINE>return activeSession;<NEW_LINE>} catch (IOException | IllegalStateException | NullPointerException e) {<NEW_LINE>LOG.log(Level.WARNING, e.getMessage(), e);<NEW_LINE>return Optional.empty();<NEW_LINE>}<NEW_LINE>} | ) response.getValue())); |
331,245 | public SimilarsMap fusiformSimilarity(Iterator<Vertex> vertices, Directions direction, String label, int minNeighbors, double alpha, int minSimilars, int top, String groupProperty, int minGroups, long degree, long capacity, long limit, boolean withIntermediary) {<NEW_LINE>checkCapacity(capacity);<NEW_LINE>checkLimit(limit);<NEW_LINE>checkGroupArgs(groupProperty, minGroups);<NEW_LINE>int foundCount = 0;<NEW_LINE>SimilarsMap results = new SimilarsMap();<NEW_LINE>while (vertices.hasNext()) {<NEW_LINE>checkCapacity(capacity, ++this.accessed, "fusiform similarity");<NEW_LINE>HugeVertex vertex = (HugeVertex) vertices.next();<NEW_LINE>// Find fusiform similarity for current vertex<NEW_LINE>Set<Similar> result = this.fusiformSimilarityForVertex(vertex, direction, label, minNeighbors, alpha, minSimilars, top, groupProperty, <MASK><NEW_LINE>if (result.isEmpty()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>results.put(vertex.id(), result);<NEW_LINE>// Reach limit<NEW_LINE>if (limit != NO_LIMIT && ++foundCount >= limit) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>this.reset();<NEW_LINE>return results;<NEW_LINE>} | minGroups, degree, capacity, withIntermediary); |
1,218,496 | public void deleteByIdWithResponse(String id, Context context) {<NEW_LINE>String sharedPrivateLinkResourceName = Utils.getValueFromIdByName(id, "sharedPrivateLinkResources");<NEW_LINE>if (sharedPrivateLinkResourceName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'sharedPrivateLinkResources'.", id)));<NEW_LINE>}<NEW_LINE>String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups");<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id)));<NEW_LINE>}<NEW_LINE>String resourceName = Utils.getValueFromIdByName(id, "signalR");<NEW_LINE>if (resourceName == null) {<NEW_LINE>throw LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("The resource ID '%s' is not valid. Missing path segment 'signalR'.", id)));<NEW_LINE>}<NEW_LINE>this.delete(<MASK><NEW_LINE>} | sharedPrivateLinkResourceName, resourceGroupName, resourceName, context); |
327,465 | public DescribePatchPropertiesResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>DescribePatchPropertiesResult describePatchPropertiesResult = new DescribePatchPropertiesResult();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return describePatchPropertiesResult;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("Properties", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>describePatchPropertiesResult.setProperties(new ListUnmarshaller<java.util.Map<String, String>>(new MapUnmarshaller<String, String>(context.getUnmarshaller(String.class), context.getUnmarshaller(String.class))).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("NextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>describePatchPropertiesResult.setNextToken(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return describePatchPropertiesResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,587,356 | protected <T> Collection<T> doInsertBatch(String collectionName, Collection<? extends T> batchToSave, MongoWriter<T> writer) {<NEW_LINE>Assert.notNull(writer, "MongoWriter must not be null!");<NEW_LINE>List<Document> documentList = new ArrayList<>();<NEW_LINE>List<T> initializedBatchToSave = new ArrayList<<MASK><NEW_LINE>for (T uninitialized : batchToSave) {<NEW_LINE>BeforeConvertEvent<T> event = new BeforeConvertEvent<>(uninitialized, collectionName);<NEW_LINE>T toConvert = maybeEmitEvent(event).getSource();<NEW_LINE>toConvert = maybeCallBeforeConvert(toConvert, collectionName);<NEW_LINE>AdaptibleEntity<T> entity = operations.forEntity(toConvert, mongoConverter.getConversionService());<NEW_LINE>entity.assertUpdateableIdIfNotSet();<NEW_LINE>T initialized = entity.initializeVersionProperty();<NEW_LINE>Document document = entity.toMappedDocument(writer).getDocument();<NEW_LINE>maybeEmitEvent(new BeforeSaveEvent<>(initialized, document, collectionName));<NEW_LINE>initialized = maybeCallBeforeSave(initialized, document, collectionName);<NEW_LINE>documentList.add(document);<NEW_LINE>initializedBatchToSave.add(initialized);<NEW_LINE>}<NEW_LINE>List<Object> ids = insertDocumentList(collectionName, documentList);<NEW_LINE>List<T> savedObjects = new ArrayList<>(documentList.size());<NEW_LINE>int i = 0;<NEW_LINE>for (T obj : initializedBatchToSave) {<NEW_LINE>if (i < ids.size()) {<NEW_LINE>T saved = populateIdIfNecessary(obj, ids.get(i));<NEW_LINE>Document doc = documentList.get(i);<NEW_LINE>maybeEmitEvent(new AfterSaveEvent<>(saved, doc, collectionName));<NEW_LINE>savedObjects.add(maybeCallAfterSave(saved, doc, collectionName));<NEW_LINE>} else {<NEW_LINE>savedObjects.add(obj);<NEW_LINE>}<NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>return savedObjects;<NEW_LINE>} | >(batchToSave.size()); |
1,599,350 | public void onResponse(final Call<ResponseBody> call, final Response<ResponseBody> response) {<NEW_LINE>Cancellable cancellable = new Cancellable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void cancel() {<NEW_LINE>call.cancel();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean isCanceled() {<NEW_LINE>return call.isCanceled();<NEW_LINE>}<NEW_LINE>};<NEW_LINE>try {<NEW_LINE>if (response.isSuccessful()) {<NEW_LINE>ResponseBody chunkedBody = response.body();<NEW_LINE>chunkProccesor.process(chunkedBody, cancellable, onNext, onComplete);<NEW_LINE>} else {<NEW_LINE>// REVIEW: must be handled consistently with IOException.<NEW_LINE><MASK><NEW_LINE>if (errorBody != null) {<NEW_LINE>InfluxDBException influxDBException = new InfluxDBException(errorBody.string());<NEW_LINE>if (onFailure == null) {<NEW_LINE>throw influxDBException;<NEW_LINE>} else {<NEW_LINE>onFailure.accept(influxDBException);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>QueryResult queryResult = new QueryResult();<NEW_LINE>queryResult.setError(e.toString());<NEW_LINE>onNext.accept(cancellable, queryResult);<NEW_LINE>// passing null onFailure consumer is here for backward compatibility<NEW_LINE>// where the empty queryResult containing error is propagating into onNext consumer<NEW_LINE>if (onFailure != null) {<NEW_LINE>onFailure.accept(e);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>call.cancel();<NEW_LINE>if (onFailure != null) {<NEW_LINE>onFailure.accept(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ResponseBody errorBody = response.errorBody(); |
1,694,804 | public void modifiedService(ServiceReference<ManagedService> reference, ManagedService service) {<NEW_LINE>String[] pids = getServicePid(reference);<NEW_LINE>List<String> newPids = Collections.emptyList();<NEW_LINE>if (pids != null) {<NEW_LINE>newPids = Arrays.asList(pids);<NEW_LINE>}<NEW_LINE>synchronized (caFactory.getConfigurationStore()) {<NEW_LINE>List<String> previousPids = getPidsForManagedService(service);<NEW_LINE>HashSet<String> prevSet = new HashSet<String>(previousPids);<NEW_LINE>HashSet<String> newSet = <MASK><NEW_LINE>if (!prevSet.equals(newSet)) {<NEW_LINE>// remove those that are not gone<NEW_LINE>for (String pid : previousPids) {<NEW_LINE>if (!newSet.contains(pid)) {<NEW_LINE>remove(reference, pid);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// add those that are new<NEW_LINE>for (String pid : newPids) {<NEW_LINE>if (!prevSet.contains(pid)) {<NEW_LINE>add(reference, pid, service);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | new HashSet<String>(newPids); |
385,015 | static void writeServletDoMethod(ThreadInfo ti, String method, String servletPath, String sessionId) {<NEW_LINE>int fullInfoLen = 1 + 1 + (servletPath.length() * 2) + 4;<NEW_LINE>// It's important to use a local copy for evBufPos, so that evBufPos is at event boundary at any moment<NEW_LINE>int curPos = ti.evBufPos;<NEW_LINE>if ((curPos + fullInfoLen) > ThreadInfo.evBufPosThreshold) {<NEW_LINE>copyLocalBuffer(ti);<NEW_LINE>curPos = ti.evBufPos;<NEW_LINE>}<NEW_LINE>byte[] evBuf = ti.evBuf;<NEW_LINE>byte methodId = -1;<NEW_LINE>int sessionHash = -1;<NEW_LINE>if (null != method)<NEW_LINE>switch(method) {<NEW_LINE>// NOI18N<NEW_LINE>case "GET":<NEW_LINE>methodId = 1;<NEW_LINE>break;<NEW_LINE>// NOI18N<NEW_LINE>case "POST":<NEW_LINE>methodId = 2;<NEW_LINE>break;<NEW_LINE>// NOI18N<NEW_LINE>case "PUT":<NEW_LINE>methodId = 3;<NEW_LINE>break;<NEW_LINE>// NOI18N<NEW_LINE>case "DELETE":<NEW_LINE>methodId = 4;<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (sessionId != null) {<NEW_LINE>sessionHash = sessionId.hashCode();<NEW_LINE>}<NEW_LINE>evBuf[curPos++] = SERVLET_DO_METHOD;<NEW_LINE>evBuf[curPos++] = methodId;<NEW_LINE>byte[<MASK><NEW_LINE>int len = name.length;<NEW_LINE>evBuf[curPos++] = (byte) ((len >> 8) & 0xFF);<NEW_LINE>evBuf[curPos++] = (byte) ((len) & 0xFF);<NEW_LINE>System.arraycopy(name, 0, evBuf, curPos, len);<NEW_LINE>curPos += len;<NEW_LINE>evBuf[curPos++] = (byte) ((sessionHash >> 24) & 0xFF);<NEW_LINE>evBuf[curPos++] = (byte) ((sessionHash >> 16) & 0xFF);<NEW_LINE>evBuf[curPos++] = (byte) ((sessionHash >> 8) & 0xFF);<NEW_LINE>evBuf[curPos++] = (byte) ((sessionHash) & 0xFF);<NEW_LINE>ti.evBufPos = curPos;<NEW_LINE>} | ] name = servletPath.getBytes(); |
1,123,787 | protected void initContentBuffer(XMLStringBuffer suiteBuffer) {<NEW_LINE>Properties testAttrs = new Properties();<NEW_LINE>testAttrs.setProperty("name", m_projectName);<NEW_LINE>testAttrs.setProperty("verbose", String.valueOf(m_logLevel));<NEW_LINE><MASK><NEW_LINE>if (null != m_groupNames) {<NEW_LINE>suiteBuffer.push("groups");<NEW_LINE>suiteBuffer.push("run");<NEW_LINE>for (String groupName : m_groupNames) {<NEW_LINE>Properties includeAttrs = new Properties();<NEW_LINE>includeAttrs.setProperty("name", groupName);<NEW_LINE>suiteBuffer.addEmptyElement("include", includeAttrs);<NEW_LINE>}<NEW_LINE>suiteBuffer.pop("run");<NEW_LINE>suiteBuffer.pop("groups");<NEW_LINE>}<NEW_LINE>// packages belongs to suite according to the latest DTD<NEW_LINE>if ((m_packageNames != null) && (m_packageNames.size() > 0)) {<NEW_LINE>suiteBuffer.push("packages");<NEW_LINE>for (String packageName : m_packageNames) {<NEW_LINE>Properties packageAttrs = new Properties();<NEW_LINE>packageAttrs.setProperty("name", packageName);<NEW_LINE>suiteBuffer.addEmptyElement("package", packageAttrs);<NEW_LINE>}<NEW_LINE>suiteBuffer.pop("packages");<NEW_LINE>}<NEW_LINE>if ((m_classNames != null) && (m_classNames.size() > 0)) {<NEW_LINE>suiteBuffer.push("classes");<NEW_LINE>for (String className : m_classNames) {<NEW_LINE>Properties classAttrs = new Properties();<NEW_LINE>classAttrs.setProperty("name", className);<NEW_LINE>suiteBuffer.addEmptyElement("class", classAttrs);<NEW_LINE>}<NEW_LINE>suiteBuffer.pop("classes");<NEW_LINE>}<NEW_LINE>suiteBuffer.pop("test");<NEW_LINE>} | suiteBuffer.push("test", testAttrs); |
228,690 | private void submitClearVotingConfigExclusionsTask(ClearVotingConfigExclusionsRequest request, long startTimeMillis, ActionListener<ActionResponse.Empty> listener) {<NEW_LINE>clusterService.submitStateUpdateTask("clear-voting-config-exclusions", new ClusterStateUpdateTask(Priority.URGENT, TimeValue.timeValueMillis(Math.max(0, request.getTimeout().millis() + startTimeMillis - threadPool.relativeTimeInMillis()))) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public ClusterState execute(ClusterState currentState) {<NEW_LINE>final CoordinationMetadata newCoordinationMetadata = CoordinationMetadata.builder(currentState.coordinationMetadata()).clearVotingConfigExclusions().build();<NEW_LINE>final Metadata newMetadata = Metadata.builder(currentState.metadata()).coordinationMetadata(newCoordinationMetadata).build();<NEW_LINE>return ClusterState.builder(currentState).<MASK><NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onFailure(Exception e) {<NEW_LINE>listener.onFailure(e);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void clusterStateProcessed(ClusterState oldState, ClusterState newState) {<NEW_LINE>listener.onResponse(ActionResponse.Empty.INSTANCE);<NEW_LINE>}<NEW_LINE>}, newExecutor());<NEW_LINE>} | metadata(newMetadata).build(); |
1,345,062 | public GetDocumentPathResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>GetDocumentPathResult getDocumentPathResult = new GetDocumentPathResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return getDocumentPathResult;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("Path", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getDocumentPathResult.setPath(ResourcePathJsonUnmarshaller.getInstance<MASK><NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return getDocumentPathResult;<NEW_LINE>} | ().unmarshall(context)); |
1,673,349 | private boolean checkAndOpenConflictResolutionDialog(User user, ItemViewHolder itemViewHolder, OCUpload item, String status) {<NEW_LINE>String remotePath = item.getRemotePath();<NEW_LINE>OCFile ocFile = storageManager.getFileByPath(remotePath);<NEW_LINE>if (ocFile == null) {<NEW_LINE>// Remote file doesn't exist, try to refresh folder<NEW_LINE>OCFile folder = storageManager.getFileByPath(new File(remotePath).getParent() + "/");<NEW_LINE>if (folder != null && folder.isFolder()) {<NEW_LINE>this.refreshFolder(itemViewHolder, user, folder, (caller, result) -> {<NEW_LINE>itemViewHolder.binding.uploadStatus.setText(status);<NEW_LINE>if (result.isSuccess()) {<NEW_LINE>OCFile <MASK><NEW_LINE>if (file != null) {<NEW_LINE>this.openConflictActivity(file, item);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>// Destination folder doesn't exist anymore<NEW_LINE>}<NEW_LINE>if (ocFile != null) {<NEW_LINE>this.openConflictActivity(ocFile, item);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>// Remote file doesn't exist anymore = there is no more conflict<NEW_LINE>return false;<NEW_LINE>} | file = storageManager.getFileByPath(remotePath); |
412,577 | private boolean placeBlock(BlockPos pos) {<NEW_LINE>Vec3d eyesPos = new Vec3d(MC.player.getX(), MC.player.getY() + MC.player.getEyeHeight(MC.player.getPose()), MC.player.getZ());<NEW_LINE>for (Direction side : Direction.values()) {<NEW_LINE>BlockPos <MASK><NEW_LINE>Direction side2 = side.getOpposite();<NEW_LINE>// check if side is visible (facing away from player)<NEW_LINE>if (eyesPos.squaredDistanceTo(Vec3d.ofCenter(pos)) >= eyesPos.squaredDistanceTo(Vec3d.ofCenter(neighbor)))<NEW_LINE>continue;<NEW_LINE>// check if neighbor can be right clicked<NEW_LINE>if (!BlockUtils.canBeClicked(neighbor))<NEW_LINE>continue;<NEW_LINE>Vec3d hitVec = Vec3d.ofCenter(neighbor).add(Vec3d.of(side2.getVector()).multiply(0.5));<NEW_LINE>// check if hitVec is within range (4.25 blocks)<NEW_LINE>if (eyesPos.squaredDistanceTo(hitVec) > 18.0625)<NEW_LINE>continue;<NEW_LINE>// place block<NEW_LINE>Rotation rotation = RotationUtils.getNeededRotations(hitVec);<NEW_LINE>PlayerMoveC2SPacket.LookAndOnGround packet = new PlayerMoveC2SPacket.LookAndOnGround(rotation.getYaw(), rotation.getPitch(), MC.player.isOnGround());<NEW_LINE>MC.player.networkHandler.sendPacket(packet);<NEW_LINE>IMC.getInteractionManager().rightClickBlock(neighbor, side2, hitVec);<NEW_LINE>MC.player.swingHand(Hand.MAIN_HAND);<NEW_LINE>IMC.setItemUseCooldown(4);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | neighbor = pos.offset(side); |
1,197,169 | public void actionPerformed(ActionEvent e) {<NEW_LINE>WsdlOperation operation = (WsdlOperation) mockResponse.getMockOperation().getOperation();<NEW_LINE>if (operation == null) {<NEW_LINE>UISupport.showErrorMessage("Missing operation for this mock response");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (UISupport.confirm("Overwrite current response with a fault message?", "Create Fault")) {<NEW_LINE>WsdlInterface iface = operation.getInterface();<NEW_LINE>MessagePart[] faultParts = operation.getFaultParts();<NEW_LINE>if (faultParts != null && faultParts.length > 0) {<NEW_LINE>List<String> names = new ArrayList<String>();<NEW_LINE>for (int c = 0; c < faultParts.length; c++) {<NEW_LINE>names.add(faultParts[c].getName());<NEW_LINE>}<NEW_LINE>String faultName = UISupport.prompt("Select fault detail to generate", "Create Fault", names);<NEW_LINE>if (faultName != null) {<NEW_LINE>FaultPart faultPart = (FaultPart) faultParts[names.indexOf(faultName)];<NEW_LINE>mockResponse.setResponseContent(iface.getMessageBuilder<MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>mockResponse.setResponseContent(iface.getMessageBuilder().buildEmptyFault());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ().buildFault(faultPart)); |
185,637 | private ClientMaster.OpsTaskInfo.Builder buildOpsTaskInfo(ConsumeGroupInfo groupInfo, ConsumerInfo nodeInfo, OpsSyncInfo opsTaskInfo) {<NEW_LINE>ClientMaster.OpsTaskInfo.Builder builder = ClientMaster.OpsTaskInfo.newBuilder();<NEW_LINE>long csmFromMaxCtrlId = groupInfo.getCsmFromMaxCtrlId();<NEW_LINE>if (csmFromMaxCtrlId != TBaseConstants.META_VALUE_UNDEFINED && nodeInfo.getCsmFromMaxOffsetCtrlId() != csmFromMaxCtrlId) {<NEW_LINE>builder.setCsmFrmMaxOffsetCtrlId(csmFromMaxCtrlId);<NEW_LINE>}<NEW_LINE>ClusterSettingEntity defSetting = defMetaDataService.getClusterDefSetting(false);<NEW_LINE>GroupResCtrlEntity groupResCtrlConf = defMetaDataService.getGroupCtrlConf(nodeInfo.getGroupName());<NEW_LINE>if (defSetting.enableFlowCtrl()) {<NEW_LINE>builder.setDefFlowCheckId(defSetting.getSerialId());<NEW_LINE>if (opsTaskInfo.getDefFlowChkId() != defSetting.getSerialId()) {<NEW_LINE>builder.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (groupResCtrlConf != null && groupResCtrlConf.isFlowCtrlEnable()) {<NEW_LINE>builder.setGroupFlowCheckId(groupResCtrlConf.getSerialId());<NEW_LINE>builder.setQryPriorityId(groupResCtrlConf.getQryPriorityId());<NEW_LINE>if (opsTaskInfo.getGroupFlowChkId() != groupResCtrlConf.getSerialId()) {<NEW_LINE>builder.setGroupFlowControlInfo(groupResCtrlConf.getFlowCtrlInfo());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return builder;<NEW_LINE>} | setDefFlowControlInfo(defSetting.getGloFlowCtrlRuleInfo()); |
229,902 | private // Furthermore, it is guaranteed that for any pair (a, b) that a < b.<NEW_LINE>void reconstructMatching(int[] history) {<NEW_LINE>// A map between pairs of nodes that were matched together.<NEW_LINE>int[] map = new int[n];<NEW_LINE>int[] leftNodes <MASK><NEW_LINE>// Reconstruct the matching of pairs of nodes working backwards through computed states.<NEW_LINE>for (int i = 0, state = END_STATE; state != 0; state = history[state]) {<NEW_LINE>// Isolate the pair used by xoring the state with the state used to generate it.<NEW_LINE>int pairUsed = state ^ history[state];<NEW_LINE>int leftNode = getBitPosition(Integer.lowestOneBit(pairUsed));<NEW_LINE>int rightNode = getBitPosition(Integer.highestOneBit(pairUsed));<NEW_LINE>leftNodes[i++] = leftNode;<NEW_LINE>map[leftNode] = rightNode;<NEW_LINE>}<NEW_LINE>// Sort the left nodes in ascending order.<NEW_LINE>java.util.Arrays.sort(leftNodes);<NEW_LINE>matching = new int[n];<NEW_LINE>for (int i = 0; i < n / 2; i++) {<NEW_LINE>matching[2 * i] = leftNodes[i];<NEW_LINE>int rightNode = map[leftNodes[i]];<NEW_LINE>matching[2 * i + 1] = rightNode;<NEW_LINE>}<NEW_LINE>} | = new int[n / 2]; |
427,625 | private void visualizeMTreeEntry(SVGPlot svgp, Element layer, Projection2D proj, AbstractMTree<?, N, E, ?> mtree, E entry, int depth) {<NEW_LINE>DBID roid = entry.getRoutingObjectID();<NEW_LINE>if (roid != null) {<NEW_LINE>NumberVector ro = rel.get(roid);<NEW_LINE>double rad = entry.getCoveringRadius();<NEW_LINE>final Element r;<NEW_LINE>if (dist == Mode.MANHATTAN) {<NEW_LINE>r = SVGHyperSphere.drawManhattan(<MASK><NEW_LINE>} else if (dist == Mode.EUCLIDEAN) {<NEW_LINE>r = SVGHyperSphere.drawEuclidean(svgp, proj, ro, rad);<NEW_LINE>} else // TODO: add visualizer for infinity norm?<NEW_LINE>{<NEW_LINE>// r = SVGHyperSphere.drawCross(svgp, proj, ro, rad);<NEW_LINE>r = SVGHyperSphere.drawLp(svgp, proj, ro, rad, p);<NEW_LINE>}<NEW_LINE>SVGUtil.setCSSClass(r, INDEX + (depth - 1));<NEW_LINE>layer.appendChild(r);<NEW_LINE>}<NEW_LINE>if (!(entry instanceof LeafEntry)) {<NEW_LINE>N node = mtree.getNode(entry);<NEW_LINE>for (int i = 0; i < node.getNumEntries(); i++) {<NEW_LINE>E child = node.getEntry(i);<NEW_LINE>if (!(child instanceof LeafEntry)) {<NEW_LINE>visualizeMTreeEntry(svgp, layer, proj, mtree, child, depth + 1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | svgp, proj, ro, rad); |
789,138 | private String sendWsReq(HttpServletRequest req, String productId, boolean secured) {<NEW_LINE>Product simpleClient = null;<NEW_LINE>// try {<NEW_LINE>JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();<NEW_LINE>factory.setServiceClass(Product.class);<NEW_LINE>factory.setAddress("http://localhost:8282/ProductServiceCF");<NEW_LINE>simpleClient = (Product) factory.create();<NEW_LINE>java.lang.String _getProduct_productIdVal = productId;<NEW_LINE>javax.xml.ws.Holder<java.lang.String> _getProduct_productId = new javax.xml.ws.Holder<java.lang.String>(_getProduct_productIdVal);<NEW_LINE>javax.xml.ws.Holder<java.lang.String> _getProduct_name = new javax.xml.ws.Holder<<MASK><NEW_LINE>// Attach Authorization header<NEW_LINE>if (secured) {<NEW_LINE>Client clientProxy = ClientProxy.getClient(simpleClient);<NEW_LINE>KeycloakSecurityContext session = (KeycloakSecurityContext) req.getAttribute(KeycloakSecurityContext.class.getName());<NEW_LINE>Map<String, List<String>> headers = new HashMap<String, List<String>>();<NEW_LINE>headers.put("Authorization", Arrays.asList("Bearer " + session.getTokenString()));<NEW_LINE>clientProxy.getRequestContext().put(Message.PROTOCOL_HEADERS, headers);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>simpleClient.getProduct(_getProduct_productId, _getProduct_name);<NEW_LINE>return String.format("Product received: id=%s, name=%s", _getProduct_productId.value, _getProduct_name.value);<NEW_LINE>} catch (UnknownProductFault upf) {<NEW_LINE>return "UnknownProductFault has occurred. Details: " + upf.toString();<NEW_LINE>} catch (WebServiceException wse) {<NEW_LINE>String error = "Can't receive product. Reason: " + wse.getMessage();<NEW_LINE>if (wse.getCause() != null) {<NEW_LINE>Throwable cause = wse.getCause();<NEW_LINE>error = error + " Details: " + cause.getClass().getName() + ": " + cause.getMessage();<NEW_LINE>}<NEW_LINE>return error;<NEW_LINE>}<NEW_LINE>} | java.lang.String>(); |
843,182 | public void showClientMyTasksDue(ActionRequest request, ActionResponse response) {<NEW_LINE>try {<NEW_LINE>ClientViewService clientViewService = Beans.get(ClientViewService.class);<NEW_LINE><MASK><NEW_LINE>if (clientUser.getPartner() == null) {<NEW_LINE>response.setError(I18n.get(ITranslation.CLIENT_PORTAL_NO_PARTNER));<NEW_LINE>} else {<NEW_LINE>Filter filter = clientViewService.getTasksDueOfUser(clientUser).get(0);<NEW_LINE>if (filter != null) {<NEW_LINE>response.setView(ActionView.define(I18n.get("Tasks due")).model(ProjectTask.class.getName()).add("grid", "project-task-grid").add("form", "project-task-form").param("search-filters", "project-task-filters").domain(filter.getQuery()).map());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>TraceBackService.trace(response, e);<NEW_LINE>}<NEW_LINE>} | User clientUser = clientViewService.getClientUser(); |
1,263,995 | public static DescribeDrdsDbInstanceResponse unmarshall(DescribeDrdsDbInstanceResponse describeDrdsDbInstanceResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeDrdsDbInstanceResponse.setRequestId(_ctx.stringValue("DescribeDrdsDbInstanceResponse.RequestId"));<NEW_LINE>describeDrdsDbInstanceResponse.setSuccess(_ctx.booleanValue("DescribeDrdsDbInstanceResponse.Success"));<NEW_LINE>DbInstance dbInstance = new DbInstance();<NEW_LINE>dbInstance.setDBInstanceId(_ctx.stringValue("DescribeDrdsDbInstanceResponse.DbInstance.DBInstanceId"));<NEW_LINE>dbInstance.setDmInstanceId(_ctx.stringValue("DescribeDrdsDbInstanceResponse.DbInstance.DmInstanceId"));<NEW_LINE>dbInstance.setConnectUrl(_ctx.stringValue("DescribeDrdsDbInstanceResponse.DbInstance.ConnectUrl"));<NEW_LINE>dbInstance.setPort(_ctx.integerValue("DescribeDrdsDbInstanceResponse.DbInstance.Port"));<NEW_LINE>dbInstance.setDBInstanceStatus(_ctx.stringValue("DescribeDrdsDbInstanceResponse.DbInstance.DBInstanceStatus"));<NEW_LINE>dbInstance.setDbInstType(_ctx.stringValue("DescribeDrdsDbInstanceResponse.DbInstance.DbInstType"));<NEW_LINE>dbInstance.setReadWeight(_ctx.integerValue("DescribeDrdsDbInstanceResponse.DbInstance.ReadWeight"));<NEW_LINE>dbInstance.setEngine(_ctx.stringValue("DescribeDrdsDbInstanceResponse.DbInstance.Engine"));<NEW_LINE>dbInstance.setEngineVersion(_ctx.stringValue("DescribeDrdsDbInstanceResponse.DbInstance.EngineVersion"));<NEW_LINE>dbInstance.setRdsInstType(_ctx.stringValue("DescribeDrdsDbInstanceResponse.DbInstance.RdsInstType"));<NEW_LINE>dbInstance.setPayType(_ctx.stringValue("DescribeDrdsDbInstanceResponse.DbInstance.PayType"));<NEW_LINE>dbInstance.setExpireTime(_ctx.stringValue("DescribeDrdsDbInstanceResponse.DbInstance.ExpireTime"));<NEW_LINE>dbInstance.setRemainDays(_ctx.stringValue("DescribeDrdsDbInstanceResponse.DbInstance.RemainDays"));<NEW_LINE>dbInstance.setNetworkType(_ctx.stringValue("DescribeDrdsDbInstanceResponse.DbInstance.NetworkType"));<NEW_LINE>List<ReadOnlyInstance> readOnlyInstances = new ArrayList<ReadOnlyInstance>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeDrdsDbInstanceResponse.DbInstance.ReadOnlyInstances.Length"); i++) {<NEW_LINE>ReadOnlyInstance readOnlyInstance = new ReadOnlyInstance();<NEW_LINE>readOnlyInstance.setDBInstanceId(_ctx.stringValue("DescribeDrdsDbInstanceResponse.DbInstance.ReadOnlyInstances[" + i + "].DBInstanceId"));<NEW_LINE>readOnlyInstance.setDmInstanceId(_ctx.stringValue<MASK><NEW_LINE>readOnlyInstance.setConnectUrl(_ctx.stringValue("DescribeDrdsDbInstanceResponse.DbInstance.ReadOnlyInstances[" + i + "].ConnectUrl"));<NEW_LINE>readOnlyInstance.setPort(_ctx.integerValue("DescribeDrdsDbInstanceResponse.DbInstance.ReadOnlyInstances[" + i + "].Port"));<NEW_LINE>readOnlyInstance.setDBInstanceStatus(_ctx.stringValue("DescribeDrdsDbInstanceResponse.DbInstance.ReadOnlyInstances[" + i + "].DBInstanceStatus"));<NEW_LINE>readOnlyInstance.setDbInstType(_ctx.stringValue("DescribeDrdsDbInstanceResponse.DbInstance.ReadOnlyInstances[" + i + "].DbInstType"));<NEW_LINE>readOnlyInstance.setReadWeight(_ctx.integerValue("DescribeDrdsDbInstanceResponse.DbInstance.ReadOnlyInstances[" + i + "].ReadWeight"));<NEW_LINE>readOnlyInstance.setEngine(_ctx.stringValue("DescribeDrdsDbInstanceResponse.DbInstance.ReadOnlyInstances[" + i + "].Engine"));<NEW_LINE>readOnlyInstance.setEngineVersion(_ctx.stringValue("DescribeDrdsDbInstanceResponse.DbInstance.ReadOnlyInstances[" + i + "].EngineVersion"));<NEW_LINE>readOnlyInstance.setRdsInstType(_ctx.stringValue("DescribeDrdsDbInstanceResponse.DbInstance.ReadOnlyInstances[" + i + "].RdsInstType"));<NEW_LINE>readOnlyInstance.setPayType(_ctx.stringValue("DescribeDrdsDbInstanceResponse.DbInstance.ReadOnlyInstances[" + i + "].PayType"));<NEW_LINE>readOnlyInstance.setExpireTime(_ctx.stringValue("DescribeDrdsDbInstanceResponse.DbInstance.ReadOnlyInstances[" + i + "].ExpireTime"));<NEW_LINE>readOnlyInstance.setRemainDays(_ctx.stringValue("DescribeDrdsDbInstanceResponse.DbInstance.ReadOnlyInstances[" + i + "].RemainDays"));<NEW_LINE>readOnlyInstance.setNetworkType(_ctx.stringValue("DescribeDrdsDbInstanceResponse.DbInstance.ReadOnlyInstances[" + i + "].NetworkType"));<NEW_LINE>readOnlyInstance.setVersionAction(_ctx.integerValue("DescribeDrdsDbInstanceResponse.DbInstance.ReadOnlyInstances[" + i + "].VersionAction"));<NEW_LINE>readOnlyInstances.add(readOnlyInstance);<NEW_LINE>}<NEW_LINE>dbInstance.setReadOnlyInstances(readOnlyInstances);<NEW_LINE>describeDrdsDbInstanceResponse.setDbInstance(dbInstance);<NEW_LINE>return describeDrdsDbInstanceResponse;<NEW_LINE>} | ("DescribeDrdsDbInstanceResponse.DbInstance.ReadOnlyInstances[" + i + "].DmInstanceId")); |
1,632,368 | private boolean hasDictionary(Locale locale) {<NEW_LINE>Resources res = getResources();<NEW_LINE>Configuration conf = res.getConfiguration();<NEW_LINE>Locale saveLocale = conf.locale;<NEW_LINE>boolean haveDictionary = false;<NEW_LINE>conf.locale = locale;<NEW_LINE>res.updateConfiguration(conf, res.getDisplayMetrics());<NEW_LINE>int[] dictionaries = LatinIME.getDictionary(res);<NEW_LINE>BinaryDictionary bd = new BinaryDictionary(<MASK><NEW_LINE>// Is the dictionary larger than a placeholder? Arbitrarily chose a lower limit of<NEW_LINE>// 4000-5000 words, whereas the LARGE_DICTIONARY is about 20000+ words.<NEW_LINE>if (bd.getSize() > Suggest.LARGE_DICTIONARY_THRESHOLD / 4) {<NEW_LINE>haveDictionary = true;<NEW_LINE>} else {<NEW_LINE>BinaryDictionary plug = PluginManager.getDictionary(getApplicationContext(), locale.getLanguage());<NEW_LINE>if (plug != null) {<NEW_LINE>bd.close();<NEW_LINE>bd = plug;<NEW_LINE>haveDictionary = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>bd.close();<NEW_LINE>conf.locale = saveLocale;<NEW_LINE>res.updateConfiguration(conf, res.getDisplayMetrics());<NEW_LINE>return haveDictionary;<NEW_LINE>} | this, dictionaries, Suggest.DIC_MAIN); |
1,611,981 | protected void doSelectToHolder(Request request, List<Referer<T>> refersHolder) {<NEW_LINE>List<Referer<T>> referers = getReferers();<NEW_LINE>List<Referer<T>> localReferers = searchLocalReferer(referers, NetUtils.getLocalAddress().getHostAddress());<NEW_LINE>if (!localReferers.isEmpty()) {<NEW_LINE>Collections.sort(localReferers, new LowActivePriorityComparator<T>());<NEW_LINE>refersHolder.addAll(localReferers);<NEW_LINE>}<NEW_LINE>int refererSize = referers.size();<NEW_LINE>int startIndex = ThreadLocalRandom.current().nextInt(refererSize);<NEW_LINE>int currentCursor = 0;<NEW_LINE>int currentAvailableCursor = 0;<NEW_LINE>List<Referer<T>> remoteReferers = new ArrayList<Referer<T>>();<NEW_LINE>while (currentAvailableCursor < MAX_REFERER_COUNT && currentCursor < refererSize) {<NEW_LINE>Referer<T> temp = referers.get(<MASK><NEW_LINE>currentCursor++;<NEW_LINE>if (!temp.isAvailable() || localReferers.contains(temp)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>currentAvailableCursor++;<NEW_LINE>remoteReferers.add(temp);<NEW_LINE>}<NEW_LINE>Collections.sort(remoteReferers, new LowActivePriorityComparator<T>());<NEW_LINE>refersHolder.addAll(remoteReferers);<NEW_LINE>} | (startIndex + currentCursor) % refererSize); |
1,142,235 | public ChangeStreamResultSet changeStreamQuery(String partitionToken, Timestamp startTimestamp, Timestamp endTimestamp, long heartbeatMillis) {<NEW_LINE>// For the initial partition we query with a null partition token<NEW_LINE>final String partitionTokenOrNull = InitialPartition.isInitialPartition(partitionToken) ? null : partitionToken;<NEW_LINE>final String query = "SELECT * FROM READ_" + changeStreamName + "(" + " start_timestamp => @startTimestamp," + " end_timestamp => @endTimestamp," <MASK><NEW_LINE>final ResultSet resultSet = databaseClient.singleUse().executeQuery(Statement.newBuilder(query).bind("startTimestamp").to(startTimestamp).bind("endTimestamp").to(endTimestamp).bind("partitionToken").to(partitionTokenOrNull).bind("heartbeatMillis").to(heartbeatMillis).build(), Options.priority(rpcPriority), Options.tag("job=" + jobName));<NEW_LINE>return new ChangeStreamResultSet(resultSet);<NEW_LINE>} | + " partition_token => @partitionToken," + " read_options => null," + " heartbeat_milliseconds => @heartbeatMillis" + ")"; |
1,482,621 | public SpiSqlUpdate createDelete(SpiEbeanServer server, DeleteMode deleteMode) {<NEW_LINE>BindParams bindParams = new BindParams();<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>if (deleteMode.isHard()) {<NEW_LINE>sb.append("delete from ").append(tableName);<NEW_LINE>} else {<NEW_LINE>sb.append("update ").append(tableName).append(" set ");<NEW_LINE>sb.<MASK><NEW_LINE>}<NEW_LINE>sb.append(" where ");<NEW_LINE>int count = setBindParams(bindParams, sb);<NEW_LINE>if (excludeIds != null) {<NEW_LINE>IdInExpression idIn = new IdInExpression(excludeIds);<NEW_LINE>DefaultExpressionRequest er = new DefaultExpressionRequest(excludeDescriptor);<NEW_LINE>idIn.addSqlNoAlias(er);<NEW_LINE>idIn.addBindValues(er);<NEW_LINE>sb.append(" and not ( ");<NEW_LINE>sb.append(er.getSql());<NEW_LINE>sb.append(" ) ");<NEW_LINE>List<Object> bindValues = er.getBindValues();<NEW_LINE>for (Object bindValue : bindValues) {<NEW_LINE>bindParams.setParameter(++count, bindValue);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new DefaultSqlUpdate(server, sb.toString(), bindParams);<NEW_LINE>} | append(targetDescriptor.softDeleteDbSet()); |
388,636 | private void buildExecParams(TDSWriter tdsWriter) throws SQLServerException {<NEW_LINE>if (getStatementLogger().isLoggable(java.util.logging.Level.FINE))<NEW_LINE>getStatementLogger().fine(toString() + ": calling sp_execute: PreparedHandle:" + <MASK><NEW_LINE>expectPrepStmtHandle = false;<NEW_LINE>executedSqlDirectly = true;<NEW_LINE>expectCursorOutParams = false;<NEW_LINE>outParamIndexAdjustment = 1;<NEW_LINE>// procedure name length -> use ProcIDs<NEW_LINE>tdsWriter.writeShort((short) 0xFFFF);<NEW_LINE>tdsWriter.writeShort(TDS.PROCID_SP_EXECUTE);<NEW_LINE>// RPC procedure option 1<NEW_LINE>tdsWriter.writeByte((byte) 0);<NEW_LINE>// RPC procedure option 2 */<NEW_LINE>tdsWriter.writeByte((byte) 0);<NEW_LINE>tdsWriter.sendEnclavePackage(preparedSQL, enclaveCEKs);<NEW_LINE>// <handle> IN<NEW_LINE>assert hasPreparedStatementHandle();<NEW_LINE>tdsWriter.writeRPCInt(null, getPreparedStatementHandle(), false);<NEW_LINE>} | getPreparedStatementHandle() + ", SQL:" + preparedSQL); |
1,025,567 | public Map<String, Object> createScript(User user, @RemainedPath String path, @RequestBody ScriptCreationParams scriptCreationParams) {<NEW_LINE>String fileName = scriptCreationParams.getFileName();<NEW_LINE>String testUrl = scriptCreationParams.getTestUrl();<NEW_LINE><MASK><NEW_LINE>boolean createLibAndResource = scriptCreationParams.isCreateLibAndResource();<NEW_LINE>fileName = trimToEmpty(fileName);<NEW_LINE>String name = "Test1";<NEW_LINE>if (isEmpty(testUrl)) {<NEW_LINE>testUrl = defaultIfBlank(testUrl, "http://please_modify_this.com");<NEW_LINE>} else {<NEW_LINE>name = UrlUtils.getHost(testUrl);<NEW_LINE>}<NEW_LINE>ScriptHandler scriptHandler = fileEntryService.getScriptHandler(scriptCreationParams.getScriptType());<NEW_LINE>FileEntry entry;<NEW_LINE>if (scriptHandler instanceof ProjectHandler) {<NEW_LINE>path += isEmpty(path) ? "" : "/";<NEW_LINE>if (!fileEntryService.hasFileEntry(user, PathUtils.join(path, fileName))) {<NEW_LINE>fileEntryService.prepareNewEntry(user, path, fileName, name, testUrl, scriptHandler, createLibAndResource, options);<NEW_LINE>return buildMap("message", fileName + " project is created.", "path", "/script/list/" + encodePathWithUTF8(path) + fileName);<NEW_LINE>} else {<NEW_LINE>return buildMap("message", fileName + " is already existing. Please choose the different name", "path", "/script/list/" + encodePathWithUTF8(path));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>String fullPath = PathUtils.join(path, fileName);<NEW_LINE>if (fileEntryService.hasFileEntry(user, fullPath)) {<NEW_LINE>entry = fileEntryService.getOne(user, fullPath);<NEW_LINE>} else {<NEW_LINE>entry = fileEntryService.prepareNewEntry(user, path, fileName, name, testUrl, scriptHandler, createLibAndResource, options);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>save(user, new FileSaveParams(entry, null, "0", createLibAndResource));<NEW_LINE>return buildMap("file", entry);<NEW_LINE>} | String options = scriptCreationParams.getOptions(); |
1,224,592 | public DescribeCertificateResult describeCertificate(DescribeCertificateRequest describeCertificateRequest) throws AmazonServiceException, AmazonClientException {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeCertificateRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<DescribeCertificateRequest> request = null;<NEW_LINE>Response<DescribeCertificateResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeCertificateRequestMarshaller().marshall(describeCertificateRequest);<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>Unmarshaller<DescribeCertificateResult, JsonUnmarshallerContext> unmarshaller = new DescribeCertificateResultJsonUnmarshaller();<NEW_LINE>JsonResponseHandler<DescribeCertificateResult> responseHandler = new JsonResponseHandler<DescribeCertificateResult>(unmarshaller);<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.ClientExecuteTime);<NEW_LINE>endClientExecution(awsRequestMetrics, request, response, LOGGING_AWS_REQUEST_METRIC);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
1,545,006 | private static Vector apply(CompLongDoubleVector v1, LongFloatVector v2, Binary op) {<NEW_LINE>LongDoubleVector[] parts = v1.getPartitions();<NEW_LINE>Storage[] resParts = StorageSwitch.applyComp(v1, v2, op);<NEW_LINE>if (!op.isKeepStorage()) {<NEW_LINE>for (int i = 0; i < parts.length; i++) {<NEW_LINE>if (parts[i].getStorage() instanceof LongDoubleSortedVectorStorage) {<NEW_LINE>resParts[i] = new LongDoubleSparseVectorStorage(parts[i].getDim(), parts[i].getStorage().getIndices(), parts[i].getStorage().getValues());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>long subDim = (v1.getDim() + v1.getNumPartitions() - 1) / v1.getNumPartitions();<NEW_LINE>for (int i = 0; i < v1.getDim(); i++) {<NEW_LINE>int pidx = <MASK><NEW_LINE>long subidx = i % subDim;<NEW_LINE>if (v2.getStorage().hasKey(i)) {<NEW_LINE>((LongDoubleVectorStorage) resParts[pidx]).set(subidx, op.apply(parts[pidx].get(subidx), v2.get(i)));<NEW_LINE>} else {<NEW_LINE>((LongDoubleVectorStorage) resParts[pidx]).set(subidx, op.apply(parts[pidx].get(subidx), 0));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>LongDoubleVector[] res = new LongDoubleVector[parts.length];<NEW_LINE>int i = 0;<NEW_LINE>for (LongDoubleVector part : parts) {<NEW_LINE>res[i] = new LongDoubleVector(part.getMatrixId(), part.getRowId(), part.getClock(), part.getDim(), (LongDoubleVectorStorage) resParts[i]);<NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>return new CompLongDoubleVector(v1.getMatrixId(), v1.getRowId(), v1.getClock(), v1.getDim(), res, v1.getSubDim());<NEW_LINE>} | (int) (i / subDim); |
1,553,502 | public DBClusterMember unmarshall(StaxUnmarshallerContext context) throws Exception {<NEW_LINE>DBClusterMember dBClusterMember = new DBClusterMember();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>if (context.isStartOfDocument())<NEW_LINE>targetDepth += 3;<NEW_LINE>while (true) {<NEW_LINE><MASK><NEW_LINE>if (xmlEvent.isEndDocument())<NEW_LINE>return dBClusterMember;<NEW_LINE>if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {<NEW_LINE>if (context.testExpression("DBInstanceIdentifier", targetDepth)) {<NEW_LINE>dBClusterMember.setDBInstanceIdentifier(StringStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("IsClusterWriter", targetDepth)) {<NEW_LINE>dBClusterMember.setIsClusterWriter(BooleanStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("DBClusterParameterGroupStatus", targetDepth)) {<NEW_LINE>dBClusterMember.setDBClusterParameterGroupStatus(StringStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("PromotionTier", targetDepth)) {<NEW_LINE>dBClusterMember.setPromotionTier(IntegerStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>} else if (xmlEvent.isEndElement()) {<NEW_LINE>if (context.getCurrentDepth() < originalDepth) {<NEW_LINE>return dBClusterMember;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | XMLEvent xmlEvent = context.nextEvent(); |
1,323,807 | public void marshall(SentimentDetectionJobProperties sentimentDetectionJobProperties, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (sentimentDetectionJobProperties == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(sentimentDetectionJobProperties.getJobId(), JOBID_BINDING);<NEW_LINE>protocolMarshaller.marshall(sentimentDetectionJobProperties.getJobArn(), JOBARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(sentimentDetectionJobProperties.getJobName(), JOBNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(sentimentDetectionJobProperties.getJobStatus(), JOBSTATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(sentimentDetectionJobProperties.getMessage(), MESSAGE_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(sentimentDetectionJobProperties.getEndTime(), ENDTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(sentimentDetectionJobProperties.getInputDataConfig(), INPUTDATACONFIG_BINDING);<NEW_LINE>protocolMarshaller.marshall(sentimentDetectionJobProperties.getOutputDataConfig(), OUTPUTDATACONFIG_BINDING);<NEW_LINE>protocolMarshaller.marshall(sentimentDetectionJobProperties.getLanguageCode(), LANGUAGECODE_BINDING);<NEW_LINE>protocolMarshaller.marshall(sentimentDetectionJobProperties.getDataAccessRoleArn(), DATAACCESSROLEARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(sentimentDetectionJobProperties.getVolumeKmsKeyId(), VOLUMEKMSKEYID_BINDING);<NEW_LINE>protocolMarshaller.marshall(sentimentDetectionJobProperties.getVpcConfig(), VPCCONFIG_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | sentimentDetectionJobProperties.getSubmitTime(), SUBMITTIME_BINDING); |
231,167 | public PlanItemInstanceResponse createPlanItemInstanceResponse(PlanItemInstance planItemInstance) {<NEW_LINE>RestUrlBuilder urlBuilder = createUrlBuilder();<NEW_LINE>PlanItemInstanceResponse result = new PlanItemInstanceResponse();<NEW_LINE>result.setId(planItemInstance.getId());<NEW_LINE>result.setUrl(urlBuilder.buildUrl(CmmnRestUrls.URL_PLAN_ITEM_INSTANCE, planItemInstance.getId()));<NEW_LINE>result.setName(planItemInstance.getName());<NEW_LINE>result.setCaseDefinitionId(planItemInstance.getCaseDefinitionId());<NEW_LINE>result.setCaseDefinitionUrl(urlBuilder.buildUrl(CmmnRestUrls.URL_CASE_DEFINITION, planItemInstance.getCaseDefinitionId()));<NEW_LINE>if (planItemInstance.getDerivedCaseDefinitionId() != null) {<NEW_LINE>result.setDerivedCaseDefinitionId(planItemInstance.getDerivedCaseDefinitionId());<NEW_LINE>result.setDerivedCaseDefinitionUrl(urlBuilder.buildUrl(CmmnRestUrls.URL_CASE_DEFINITION, planItemInstance.getDerivedCaseDefinitionId()));<NEW_LINE>}<NEW_LINE>result.setCaseInstanceId(planItemInstance.getCaseInstanceId());<NEW_LINE>result.setCaseInstanceUrl(urlBuilder.buildUrl(CmmnRestUrls.URL_CASE_INSTANCE, planItemInstance.getCaseInstanceId()));<NEW_LINE>if (planItemInstance.getStageInstanceId() != null) {<NEW_LINE>result.setStageInstanceId(planItemInstance.getStageInstanceId());<NEW_LINE>result.setStageInstanceUrl(urlBuilder.buildUrl(CmmnRestUrls.URL_PLAN_ITEM_INSTANCE, planItemInstance.getStageInstanceId()));<NEW_LINE>}<NEW_LINE>result.setPlanItemDefinitionId(planItemInstance.getPlanItemDefinitionId());<NEW_LINE>result.setPlanItemDefinitionType(planItemInstance.getPlanItemDefinitionType());<NEW_LINE>result.setState(planItemInstance.getState());<NEW_LINE>result.setElementId(planItemInstance.getElementId());<NEW_LINE>result.setReferenceId(planItemInstance.getReferenceId());<NEW_LINE>result.setReferenceType(planItemInstance.getReferenceType());<NEW_LINE>result.setCreateTime(planItemInstance.getCreateTime());<NEW_LINE>result.setLastAvailableTime(planItemInstance.getLastAvailableTime());<NEW_LINE>result.setLastEnabledTime(planItemInstance.getLastEnabledTime());<NEW_LINE>result.setLastDisabledTime(planItemInstance.getLastDisabledTime());<NEW_LINE>result.setLastStartedTime(planItemInstance.getLastStartedTime());<NEW_LINE>result.setLastSuspendedTime(planItemInstance.getLastSuspendedTime());<NEW_LINE>result.setCompletedTime(planItemInstance.getCompletedTime());<NEW_LINE>result.setOccurredTime(planItemInstance.getOccurredTime());<NEW_LINE>result.setTerminatedTime(planItemInstance.getTerminatedTime());<NEW_LINE>result.setExitTime(planItemInstance.getExitTime());<NEW_LINE>result.setEndedTime(planItemInstance.getEndedTime());<NEW_LINE>result.setStartUserId(planItemInstance.getStartUserId());<NEW_LINE>result.<MASK><NEW_LINE>result.setCompletable(planItemInstance.isCompletable());<NEW_LINE>result.setEntryCriterionId(planItemInstance.getEntryCriterionId());<NEW_LINE>result.setExitCriterionId(planItemInstance.getExitCriterionId());<NEW_LINE>result.setFormKey(planItemInstance.getFormKey());<NEW_LINE>result.setExtraValue(planItemInstance.getExtraValue());<NEW_LINE>result.setTenantId(planItemInstance.getTenantId());<NEW_LINE>return result;<NEW_LINE>} | setStage(planItemInstance.isStage()); |
1,663,397 | public void copy(File contractsDirectory, File outputDirectory) throws MojoExecutionException {<NEW_LINE>log.info("Copying Spring Cloud Contract Verifier contracts to [" + outputDirectory + "]" + ". Only files matching [" + this.config.<MASK><NEW_LINE>Resource resource = new Resource();<NEW_LINE>String includedRootFolderAntPattern = this.config.getIncludedRootFolderAntPattern() + "*.*";<NEW_LINE>String slashSeparatedGroupIdAntPattern = slashSeparatedGroupIdAntPattern(includedRootFolderAntPattern);<NEW_LINE>String dotSeparatedGroupIdAntPattern = dotSeparatedGroupIdAntPattern(includedRootFolderAntPattern);<NEW_LINE>// by default group id is slash separated...<NEW_LINE>resource.addInclude(slashSeparatedGroupIdAntPattern);<NEW_LINE>if (!slashSeparatedGroupIdAntPattern.equals(dotSeparatedGroupIdAntPattern)) {<NEW_LINE>// ...we also want to allow dot separation<NEW_LINE>resource.addInclude(dotSeparatedGroupIdAntPattern);<NEW_LINE>}<NEW_LINE>if (this.config.isExcludeBuildFolders()) {<NEW_LINE>resource.addExclude("**/target/**");<NEW_LINE>resource.addExclude("**/.mvn/**");<NEW_LINE>resource.addExclude("**/build/**");<NEW_LINE>resource.addExclude("**/.gradle/**");<NEW_LINE>}<NEW_LINE>resource.setDirectory(contractsDirectory.getAbsolutePath());<NEW_LINE>MavenResourcesExecution execution = new MavenResourcesExecution();<NEW_LINE>execution.setResources(Collections.singletonList(resource));<NEW_LINE>execution.setOutputDirectory(outputDirectory);<NEW_LINE>execution.setMavenProject(this.project);<NEW_LINE>execution.setEncoding("UTF-8");<NEW_LINE>execution.setMavenSession(this.mavenSession);<NEW_LINE>execution.setInjectProjectBuildFilters(false);<NEW_LINE>execution.setOverwrite(true);<NEW_LINE>execution.setIncludeEmptyDirs(false);<NEW_LINE>execution.setFilterFilenames(false);<NEW_LINE>execution.setFilters(Collections.emptyList());<NEW_LINE>try {<NEW_LINE>this.mavenResourcesFiltering.filterResources(execution);<NEW_LINE>} catch (MavenFilteringException e) {<NEW_LINE>throw new MojoExecutionException(e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | getIncludedContracts() + "] pattern will end up in " + "the final JAR with stubs."); |
962,079 | public void generateToStringForType(EclipseNode typeNode, EclipseNode errorNode) {<NEW_LINE>if (hasAnnotation(ToString.class, typeNode)) {<NEW_LINE>// The annotation will make it happen, so we can skip it.<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>AnnotationValues<ToString> anno = AnnotationValues.of(ToString.class);<NEW_LINE>boolean includeFieldNames = typeNode.getAst().getBooleanAnnotationValue(anno, "includeFieldNames", ConfigurationKeys.TO_STRING_INCLUDE_FIELD_NAMES);<NEW_LINE>boolean onlyExplicitlyIncluded = typeNode.getAst().getBooleanAnnotationValue(anno, "onlyExplicitlyIncluded", ConfigurationKeys.TO_STRING_ONLY_EXPLICITLY_INCLUDED);<NEW_LINE>Boolean doNotUseGettersConfiguration = typeNode.getAst().readConfiguration(ConfigurationKeys.TO_STRING_DO_NOT_USE_GETTERS);<NEW_LINE>FieldAccess access = doNotUseGettersConfiguration == null || !doNotUseGettersConfiguration ? FieldAccess.GETTER : FieldAccess.PREFER_FIELD;<NEW_LINE>List<Included<EclipseNode, ToString.Include>> members = InclusionExclusionUtils.handleToStringMarking(<MASK><NEW_LINE>generateToString(typeNode, errorNode, members, includeFieldNames, null, false, access);<NEW_LINE>} | typeNode, onlyExplicitlyIncluded, null, null); |
710,158 | public ApplySecurityGroupsToClientVpnTargetNetworkResult unmarshall(StaxUnmarshallerContext context) throws Exception {<NEW_LINE>ApplySecurityGroupsToClientVpnTargetNetworkResult applySecurityGroupsToClientVpnTargetNetworkResult = new ApplySecurityGroupsToClientVpnTargetNetworkResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>if (context.isStartOfDocument())<NEW_LINE>targetDepth += 1;<NEW_LINE>while (true) {<NEW_LINE>XMLEvent xmlEvent = context.nextEvent();<NEW_LINE>if (xmlEvent.isEndDocument())<NEW_LINE>return applySecurityGroupsToClientVpnTargetNetworkResult;<NEW_LINE>if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {<NEW_LINE>if (context.testExpression("securityGroupIds", targetDepth)) {<NEW_LINE>applySecurityGroupsToClientVpnTargetNetworkResult.withSecurityGroupIds(new ArrayList<String>());<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("securityGroupIds/item", targetDepth)) {<NEW_LINE>applySecurityGroupsToClientVpnTargetNetworkResult.withSecurityGroupIds(StringStaxUnmarshaller.getInstance<MASK><NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>} else if (xmlEvent.isEndElement()) {<NEW_LINE>if (context.getCurrentDepth() < originalDepth) {<NEW_LINE>return applySecurityGroupsToClientVpnTargetNetworkResult;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ().unmarshall(context)); |
1,059,482 | public AuditLog toData() {<NEW_LINE>AuditLog auditLog = new AuditLog(new AuditLogId(this.getUuid()));<NEW_LINE>auditLog.setCreatedTime(createdTime);<NEW_LINE>if (tenantId != null) {<NEW_LINE>auditLog.setTenantId(TenantId.fromUUID(tenantId));<NEW_LINE>}<NEW_LINE>if (customerId != null) {<NEW_LINE>auditLog.setCustomerId(new CustomerId(customerId));<NEW_LINE>}<NEW_LINE>if (entityId != null) {<NEW_LINE>auditLog.setEntityId(EntityIdFactory.getByTypeAndUuid(entityType.name(), entityId));<NEW_LINE>}<NEW_LINE>if (userId != null) {<NEW_LINE>auditLog.setUserId(new UserId(userId));<NEW_LINE>}<NEW_LINE>auditLog.setEntityName(this.entityName);<NEW_LINE>auditLog.setUserName(this.userName);<NEW_LINE>auditLog.setActionType(this.actionType);<NEW_LINE>auditLog.setActionData(this.actionData);<NEW_LINE>auditLog.setActionStatus(this.actionStatus);<NEW_LINE><MASK><NEW_LINE>return auditLog;<NEW_LINE>} | auditLog.setActionFailureDetails(this.actionFailureDetails); |
937,357 | public List<DataFetcherResult<MLFeatureTable>> batchLoad(final List<String> urns, final QueryContext context) throws Exception {<NEW_LINE>final List<Urn> mlFeatureTableUrns = urns.stream().map(UrnUtils::getUrn).collect(Collectors.toList());<NEW_LINE>try {<NEW_LINE>final Map<Urn, EntityResponse> mlFeatureTableMap = _entityClient.batchGetV2(ML_FEATURE_TABLE_ENTITY_NAME, new HashSet<>(mlFeatureTableUrns), null, context.getAuthentication());<NEW_LINE>final List<EntityResponse> gmsResults = mlFeatureTableUrns.stream().map(featureTableUrn -> mlFeatureTableMap.getOrDefault(featureTableUrn, null)).collect(Collectors.toList());<NEW_LINE>return gmsResults.stream().map(gmsMlFeatureTable -> gmsMlFeatureTable == null ? null : DataFetcherResult.<MLFeatureTable>newResult().data(MLFeatureTableMapper.map(gmsMlFeatureTable)).build()).collect(Collectors.toList());<NEW_LINE>} catch (Exception e) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | throw new RuntimeException("Failed to batch load MLFeatureTables", e); |
1,450,776 | public static double regularizedIncompleteBetaFunction(double alpha, double beta, double x) {<NEW_LINE>// This function is often used to calculate p-value of model fitting.<NEW_LINE>// Due to floating error, the model may provide a x that could be slightly<NEW_LINE>// greater than 1 or less than 0. We allow tiny slack here to avoid brute exception.<NEW_LINE>if (x < 0.0 && abs(x) < EPS) {<NEW_LINE>return 0.0;<NEW_LINE>}<NEW_LINE>if (x > 1.0 && abs(x - 1.0) < EPS) {<NEW_LINE>return 1.0;<NEW_LINE>}<NEW_LINE>if (x < 0.0 || x > 1.0) {<NEW_LINE>throw new IllegalArgumentException("Invalid x: " + x);<NEW_LINE>}<NEW_LINE>if (x == 0.0)<NEW_LINE>return 0.0;<NEW_LINE>if (x == 1.0)<NEW_LINE>return 1.0;<NEW_LINE>// Term before continued fraction<NEW_LINE>double ibeta = exp(lgamma(alpha + beta) - lgamma(alpha) - lgamma(beta) + alpha * log(x) + beta * log(1.0D - x));<NEW_LINE>// Continued fraction<NEW_LINE>if (x < (alpha + 1.0) / (alpha + beta + 2.0)) {<NEW_LINE>ibeta = ibeta * incompleteFractionSummation(alpha, beta, x) / alpha;<NEW_LINE>} else {<NEW_LINE>// Use symmetry relationship<NEW_LINE>ibeta = 1.0 - ibeta * incompleteFractionSummation(beta, <MASK><NEW_LINE>}<NEW_LINE>return ibeta;<NEW_LINE>} | alpha, 1.0 - x) / beta; |
606,536 | final ListFirewallRuleGroupsResult executeListFirewallRuleGroups(ListFirewallRuleGroupsRequest listFirewallRuleGroupsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listFirewallRuleGroupsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListFirewallRuleGroupsRequest> request = null;<NEW_LINE>Response<ListFirewallRuleGroupsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListFirewallRuleGroupsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listFirewallRuleGroupsRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Route53Resolver");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListFirewallRuleGroupsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListFirewallRuleGroupsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListFirewallRuleGroups"); |
225,085 | public static void grayToArray(GrayF32 input, byte[] output, Bitmap.Config config) {<NEW_LINE>final int h = input.height;<NEW_LINE>final int w = input.width;<NEW_LINE>int indexDst = 0;<NEW_LINE>switch(config) {<NEW_LINE>case ARGB_8888:<NEW_LINE>for (int y = 0; y < h; y++) {<NEW_LINE>int indexSrc = input.startIndex + y * input.stride;<NEW_LINE>for (int x = 0; x < w; x++) {<NEW_LINE>int value = (int) input.data[indexSrc++];<NEW_LINE>output[indexDst++] = (byte) value;<NEW_LINE>output[indexDst++] = (byte) value;<NEW_LINE>output[indexDst++] = (byte) value;<NEW_LINE>output[indexDst++] = (byte) 0xFF;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case RGB_565:<NEW_LINE>for (int y = 0; y < h; y++) {<NEW_LINE>int indexSrc = input.startIndex + y * input.stride;<NEW_LINE>for (int x = 0; x < w; x++) {<NEW_LINE>int value = (int) input.data[indexSrc++];<NEW_LINE>int value5 = table5[value];<NEW_LINE>int value6 = table6[value];<NEW_LINE>int rgb565 = (value5 << 11) | (value6 << 5) | value5;<NEW_LINE>output[<MASK><NEW_LINE>output[indexDst++] = (byte) (rgb565 >> 8);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case ALPHA_8:<NEW_LINE>throw new RuntimeException("ALPHA_8 seems to have some weired internal format and is not currently supported");<NEW_LINE>case ARGB_4444:<NEW_LINE>throw new RuntimeException("Isn't 4444 deprecated?");<NEW_LINE>default:<NEW_LINE>throw new RuntimeException("Unsupported format: " + config);<NEW_LINE>}<NEW_LINE>} | indexDst++] = (byte) rgb565; |
1,444,687 | public ImportLayoutStyle build() {<NEW_LINE>assert (blocks.stream().anyMatch(it -> it instanceof Block.AllOthers && ((Block.AllOthers) it).isStatic())) : "There must be at least one block that accepts all static imports, but no such block was found in the specified layout";<NEW_LINE>assert (blocks.stream().anyMatch(it -> it instanceof Block.AllOthers && !((Block.AllOthers) it).isStatic())) : "There must be at least one block that accepts all non-static imports, but no such block was found in the specified layout";<NEW_LINE>for (Block block : blocks) {<NEW_LINE>if (block instanceof Block.AllOthers) {<NEW_LINE>((Block.AllOthers) block).setPackageImports(blocks.stream().filter(b -> b.getClass().equals(Block.ImportPackage.class)).map(Block.ImportPackage.class::cast).collect(toList()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new ImportLayoutStyle(<MASK><NEW_LINE>} | classCountToUseStarImport, nameCountToUseStarImport, blocks, packagesToFold); |
178,919 | public void run(RegressionEnvironment env) {<NEW_LINE>String[] fields = "c0,c1,c2,c3,c4,c5,c6,c7".split(",");<NEW_LINE>SupportEvalBuilder builder = new SupportEvalBuilder("SupportCollection");<NEW_LINE>builder.expression(fields[0], "strvals.min(v => extractNum(v))");<NEW_LINE>builder.expression(fields[1], "strvals.max(v => extractNum(v))");<NEW_LINE>builder.expression(fields[2], "strvals.min(v => v)");<NEW_LINE>builder.expression(fields[3], "strvals.max(v => v)");<NEW_LINE>builder.expression(fields[4], "strvals.min( (v, i) => extractNum(v) + i*10)");<NEW_LINE>builder.expression(fields[5], "strvals.max( (v, i) => extractNum(v) + i*10)");<NEW_LINE>builder.expression<MASK><NEW_LINE>builder.expression(fields[7], "strvals.max( (v, i, s) => extractNum(v) + i*10 + s*100)");<NEW_LINE>builder.statementConsumer(stmt -> assertTypes(stmt.getEventType(), fields, new EPTypeClass[] { INTEGERBOXED.getEPType(), INTEGERBOXED.getEPType(), STRING.getEPType(), STRING.getEPType(), INTEGERBOXED.getEPType(), INTEGERBOXED.getEPType(), INTEGERBOXED.getEPType(), INTEGERBOXED.getEPType() }));<NEW_LINE>builder.assertion(SupportCollection.makeString("E2,E1,E5,E4")).expect(fields, 1, 5, "E1", "E5", 2, 34, 402, 434);<NEW_LINE>builder.assertion(SupportCollection.makeString("E1")).expect(fields, 1, 1, "E1", "E1", 1, 1, 101, 101);<NEW_LINE>builder.assertion(SupportCollection.makeString(null)).expect(fields, null, null, null, null, null, null, null, null);<NEW_LINE>builder.assertion(SupportCollection.makeString("")).expect(fields, null, null, null, null, null, null, null, null);<NEW_LINE>builder.run(env);<NEW_LINE>} | (fields[6], "strvals.min( (v, i, s) => extractNum(v) + i*10 + s*100)"); |
1,465,013 | private void initUI() {<NEW_LINE>setUndecorated(true);<NEW_LINE>try {<NEW_LINE>if (GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().isWindowTranslucencySupported(WindowTranslucency.TRANSLUCENT)) {<NEW_LINE>if (!Config.getInstance().isNoTransparency()) {<NEW_LINE>setOpacity(0.85f);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>Logger.log(e);<NEW_LINE>}<NEW_LINE>setIconImage(ImageResource.getImage("icon.png"));<NEW_LINE>setSize(getScaledInt(400), getScaledInt(300));<NEW_LINE>setLocationRelativeTo(null);<NEW_LINE>setAlwaysOnTop(true);<NEW_LINE>getContentPane().setLayout(null);<NEW_LINE>getContentPane().setBackground(ColorResource.getDarkestBgColor());<NEW_LINE>JPanel titlePanel = new TitlePanel(null, this);<NEW_LINE>titlePanel.setOpaque(false);<NEW_LINE>titlePanel.setBounds(0, 0, getScaledInt(400), getScaledInt(50));<NEW_LINE>JButton closeBtn = new CustomButton();<NEW_LINE>closeBtn.setBounds(getScaledInt(365), getScaledInt(5), getScaledInt(30), getScaledInt(30));<NEW_LINE>closeBtn.setBackground(ColorResource.getDarkestBgColor());<NEW_LINE>closeBtn.setBorderPainted(false);<NEW_LINE>closeBtn.setFocusPainted(false);<NEW_LINE>closeBtn.setName("CLOSE");<NEW_LINE>closeBtn.setIcon(ImageResource.getIcon("title_close.png", 20, 20));<NEW_LINE>closeBtn.addActionListener(this);<NEW_LINE>titlePanel.add(closeBtn);<NEW_LINE>JLabel titleLbl = new JLabel(StringResource.get("BROWSER_MONITORING"));<NEW_LINE>titleLbl.setFont(FontResource.getBiggerFont());<NEW_LINE>titleLbl.setForeground(ColorResource.getSelectionColor());<NEW_LINE>titleLbl.setBounds(getScaledInt(25), getScaledInt(15), getScaledInt(200), getScaledInt(30));<NEW_LINE>titlePanel.add(titleLbl);<NEW_LINE>JLabel lineLbl = new JLabel();<NEW_LINE>lineLbl.setBackground(ColorResource.getSelectionColor());<NEW_LINE>lineLbl.setBounds(0, getScaledInt(55), getScaledInt(400), 1);<NEW_LINE>lineLbl.setOpaque(true);<NEW_LINE>add(lineLbl);<NEW_LINE>add(titlePanel);<NEW_LINE>int y = getScaledInt(65);<NEW_LINE>int h = getScaledInt(50);<NEW_LINE>JTextArea lblMonitoringTitle = new JTextArea();<NEW_LINE>lblMonitoringTitle.setOpaque(false);<NEW_LINE>lblMonitoringTitle.setWrapStyleWord(true);<NEW_LINE>lblMonitoringTitle.setLineWrap(true);<NEW_LINE>lblMonitoringTitle.setEditable(false);<NEW_LINE>lblMonitoringTitle.setForeground(Color.WHITE);<NEW_LINE>lblMonitoringTitle.setText(this.desc);<NEW_LINE>lblMonitoringTitle.<MASK><NEW_LINE>lblMonitoringTitle.setBounds(getScaledInt(15), y, getScaledInt(370) - getScaledInt(30), h);<NEW_LINE>add(lblMonitoringTitle);<NEW_LINE>y += h;<NEW_LINE>JButton btViewMonitoring = createButton1("CTX_COPY_URL", getScaledInt(15), y);<NEW_LINE>btViewMonitoring.setName("COPY");<NEW_LINE>add(btViewMonitoring);<NEW_LINE>y += btViewMonitoring.getHeight();<NEW_LINE>} | setFont(FontResource.getNormalFont()); |
1,222,878 | public void send(Event event, String stream) {<NEW_LINE>String app = configuration.appName();<NEW_LINE>String jobCluster = jobDiscovery.getJobCluster(app, stream);<NEW_LINE>Optional<JobDiscoveryInfo> <MASK><NEW_LINE>if (jobDiscoveryInfo.isPresent()) {<NEW_LINE>List<MantisWorker> workers = jobDiscoveryInfo.get().getIngestStageWorkers().getWorkers();<NEW_LINE>int numWorkers = workers.size();<NEW_LINE>if (numWorkers > 0) {<NEW_LINE>MantisWorker nextWorker = workers.get(Integer.remainderUnsigned(nextWorkerIdx++, numWorkers));<NEW_LINE>final long start = registry.clock().wallTime();<NEW_LINE>// TODO: propagate feedback - check for Retryable or NonRetryable Exception.<NEW_LINE>Future<Void> future = eventChannel.send(nextWorker, event);<NEW_LINE>final long end = registry.clock().wallTime();<NEW_LINE>channelSendTime.record(end - start, TimeUnit.MILLISECONDS);<NEW_LINE>} else {<NEW_LINE>LOG.trace("No workers for job cluster {}, dropping event", jobCluster);<NEW_LINE>noWorkersDroppedCount.increment();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>LOG.trace("No job discovery info for job cluster {}, dropping event", jobCluster);<NEW_LINE>noDiscoveryDroppedCount.increment();<NEW_LINE>}<NEW_LINE>} | jobDiscoveryInfo = jobDiscovery.getCurrentJobWorkers(jobCluster); |
1,382,086 | final DBCluster executeCreateDBCluster(CreateDBClusterRequest createDBClusterRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createDBClusterRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateDBClusterRequest> request = null;<NEW_LINE>Response<DBCluster> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateDBClusterRequestMarshaller().marshall(super.beforeMarshalling(createDBClusterRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Neptune");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateDBCluster");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DBCluster> responseHandler = new StaxResponseHandler<DBCluster>(new DBClusterStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); |
580,068 | public void accept(BakedModel model) {<NEW_LINE>final Supplier<Random> random = blockInfo.randomSupplier;<NEW_LINE>final Value defaultMaterial = blockInfo.defaultAo && model.useAmbientOcclusion() ? MATERIAL_SHADED : MATERIAL_FLAT;<NEW_LINE>final BlockState blockState = blockInfo.blockState;<NEW_LINE>for (int i = 0; i < 6; i++) {<NEW_LINE>final Direction face = ModelHelper.faceFromIndex(i);<NEW_LINE>final List<BakedQuad> quads = model.getQuads(blockState, face, random.get());<NEW_LINE>final int count = quads.size();<NEW_LINE>if (count != 0) {<NEW_LINE>for (int j = 0; j < count; j++) {<NEW_LINE>final BakedQuad q = quads.get(j);<NEW_LINE>renderQuad(q, face, defaultMaterial);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final List<BakedQuad> quads = model.getQuads(blockState, null, random.get());<NEW_LINE>final int count = quads.size();<NEW_LINE>if (count != 0) {<NEW_LINE>for (int j = 0; j < count; j++) {<NEW_LINE>final BakedQuad <MASK><NEW_LINE>renderQuad(q, null, defaultMaterial);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | q = quads.get(j); |
1,203,213 | public void insertRows(final int index, final int numberOfRows) {<NEW_LINE>if (index < 0 || index > getRowCount()) {<NEW_LINE>throw new IndexOutOfBoundsException("The given index (" + index + <MASK><NEW_LINE>}<NEW_LINE>if (numberOfRows < 1) {<NEW_LINE>throw new IllegalArgumentException("Number of rows must be 1 or greater (was " + numberOfRows + ")");<NEW_LINE>}<NEW_LINE>rows += numberOfRows;<NEW_LINE>if (isAttached()) {<NEW_LINE>paintInsertRows(index, numberOfRows);<NEW_LINE>if (rows == numberOfRows) {<NEW_LINE>Map<Integer, Double> colWidths = new HashMap<Integer, Double>();<NEW_LINE>for (int i = 0; i < getColumnConfiguration().getColumnCount(); i++) {<NEW_LINE>Double width = Double.valueOf(getColumnConfiguration().getColumnWidth(i));<NEW_LINE>Integer col = Integer.valueOf(i);<NEW_LINE>colWidths.put(col, width);<NEW_LINE>}<NEW_LINE>getColumnConfiguration().setColumnWidths(colWidths);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ") was outside of the current number of rows (0.." + getRowCount() + ")"); |
1,360,067 | private boolean backupGroupCtrlConfig(StringBuilder strBuff) {<NEW_LINE>logger.info("[Backup Group Ctrl] begin ");<NEW_LINE>Map<String, GroupResCtrlEntity> groupCtrlMap = getGroupResCtrlInfos(strBuff);<NEW_LINE>if (groupCtrlMap == null) {<NEW_LINE>logger.error(" download group-control configurations are null!");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>logger.info("[Backup Group Ctrl] store group-control configurations to local file");<NEW_LINE>storeObjectToFile(groupCtrlMap, backupAndRecoveryPath, storeFileNameGroupCtrl);<NEW_LINE>logger.info("[Backup Group Ctrl] verify configurations");<NEW_LINE>Map<String, GroupResCtrlEntity> storedGroupCtrlMap = (Map<String, GroupResCtrlEntity>) readObjectFromFile(backupAndRecoveryPath, storeFileNameGroupCtrl);<NEW_LINE>if (storedGroupCtrlMap == null) {<NEW_LINE>logger.error(strBuff.append(" read configure file ").append(backupAndRecoveryPath).append("/").append(storeFileNameGroupCtrl).append<MASK><NEW_LINE>strBuff.delete(0, strBuff.length());<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (storedGroupCtrlMap.size() != groupCtrlMap.size()) {<NEW_LINE>logger.error(" verify failure, stored group-control configurations size not equal!");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>for (Map.Entry<String, GroupResCtrlEntity> qryEntry : groupCtrlMap.entrySet()) {<NEW_LINE>GroupResCtrlEntity targetEntity = storedGroupCtrlMap.get(qryEntry.getKey());<NEW_LINE>if (targetEntity == null || !targetEntity.isDataEquals(qryEntry.getValue())) {<NEW_LINE>logger.error(strBuff.append(" verify failure, stored group-control value not equal!").append(" data in server is ").append(qryEntry.getValue().toString()).append(", data stored is ").append((targetEntity == null) ? null : targetEntity.toString()).toString());<NEW_LINE>strBuff.delete(0, strBuff.length());<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>logger.info("[Backup Group Ctrl] end, success!");<NEW_LINE>return true;<NEW_LINE>} | (" failure!").toString()); |
876,571 | private PsiMethod rebuildMethod(@NotNull Project project, @NotNull PsiMethod fromMethod) {<NEW_LINE>final PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(project);<NEW_LINE>final PsiMethod resultMethod;<NEW_LINE>final PsiType returnType = fromMethod.getReturnType();<NEW_LINE>if (null == returnType) {<NEW_LINE>resultMethod = elementFactory.createConstructor(fromMethod.getName());<NEW_LINE>} else {<NEW_LINE>resultMethod = elementFactory.createMethod(fromMethod.getName(), returnType);<NEW_LINE>}<NEW_LINE>rebuildTypeParameter(fromMethod, resultMethod);<NEW_LINE>final PsiClassType[] referencedTypes = fromMethod.getThrowsList().getReferencedTypes();<NEW_LINE>if (referencedTypes.length > 0) {<NEW_LINE>PsiJavaCodeReferenceElement[] refs = new PsiJavaCodeReferenceElement[referencedTypes.length];<NEW_LINE>for (int i = 0; i < refs.length; i++) {<NEW_LINE>refs[i] = elementFactory.createReferenceElementByType(referencedTypes[i]);<NEW_LINE>}<NEW_LINE>resultMethod.getThrowsList().replace(elementFactory.createReferenceList(refs));<NEW_LINE>}<NEW_LINE>for (PsiParameter fromParameter : fromMethod.getParameterList().getParameters()) {<NEW_LINE>PsiParameter toParameter = elementFactory.createParameter(fromParameter.getName(<MASK><NEW_LINE>final PsiModifierList fromParameterModifierList = fromParameter.getModifierList();<NEW_LINE>if (fromParameterModifierList != null) {<NEW_LINE>final PsiModifierList toParameterModifierList = toParameter.getModifierList();<NEW_LINE>copyAnnotations(fromParameterModifierList, toParameterModifierList);<NEW_LINE>toParameterModifierList.setModifierProperty(PsiModifier.FINAL, fromParameterModifierList.hasModifierProperty(PsiModifier.FINAL));<NEW_LINE>}<NEW_LINE>resultMethod.getParameterList().add(toParameter);<NEW_LINE>}<NEW_LINE>final PsiModifierList fromMethodModifierList = fromMethod.getModifierList();<NEW_LINE>final PsiModifierList resultMethodModifierList = resultMethod.getModifierList();<NEW_LINE>copyModifiers(fromMethodModifierList, resultMethodModifierList);<NEW_LINE>copyAnnotations(fromMethodModifierList, resultMethodModifierList);<NEW_LINE>PsiCodeBlock body = fromMethod.getBody();<NEW_LINE>if (null != body) {<NEW_LINE>resultMethod.getBody().replace(body);<NEW_LINE>} else {<NEW_LINE>resultMethod.getBody().delete();<NEW_LINE>}<NEW_LINE>return (PsiMethod) CodeStyleManager.getInstance(project).reformat(resultMethod);<NEW_LINE>} | ), fromParameter.getType()); |
588,425 | private static String dumpAccessor(ElementAccessor accessor, int indent) {<NEW_LINE>StringBuffer sb = new StringBuffer();<NEW_LINE>String indentString = createIndentString(indent);<NEW_LINE>if (accessor instanceof SplitAccessor) {<NEW_LINE>SplitAccessor splitAccessor = (SplitAccessor) accessor;<NEW_LINE>// NOI18N<NEW_LINE>sb.append(indentString + "split=" + splitAccessor);<NEW_LINE>indent++;<NEW_LINE>ElementAccessor[] children = splitAccessor.getChildren();<NEW_LINE>for (int i = 0; i < children.length; i++) {<NEW_LINE>// NOI18N<NEW_LINE>sb.append("\n" + dumpAccessor(<MASK><NEW_LINE>}<NEW_LINE>} else if (accessor instanceof ModeAccessor) {<NEW_LINE>// NOI18N<NEW_LINE>sb.append(indentString + "mode=" + accessor);<NEW_LINE>} else if (accessor instanceof EditorAccessor) {<NEW_LINE>// NOI18N<NEW_LINE>sb.append(indentString + "editor=" + accessor);<NEW_LINE>sb.append(dumpAccessor(((EditorAccessor) accessor).getEditorAreaAccessor(), ++indent));<NEW_LINE>}<NEW_LINE>return sb.toString();<NEW_LINE>} | children[i], indent)); |
1,831,925 | public void serializeToResValuesXml(XmlSerializer serializer, ResResource res) throws IOException, AndrolibException {<NEW_LINE><MASK><NEW_LINE>serializer.attribute(null, "name", res.getResSpec().getName());<NEW_LINE>if (!mParent.isNull() && !mParent.referentIsNull()) {<NEW_LINE>serializer.attribute(null, "parent", mParent.encodeAsResXmlAttr());<NEW_LINE>} else if (res.getResSpec().getName().indexOf('.') != -1) {<NEW_LINE>serializer.attribute(null, "parent", "");<NEW_LINE>}<NEW_LINE>for (Duo<ResReferenceValue, ResScalarValue> mItem : mItems) {<NEW_LINE>ResResSpec spec = mItem.m1.getReferent();<NEW_LINE>if (spec == null) {<NEW_LINE>LOGGER.fine(String.format("null reference: m1=0x%08x(%s), m2=0x%08x(%s)", mItem.m1.getRawIntValue(), mItem.m1.getType(), mItem.m2.getRawIntValue(), mItem.m2.getType()));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String name;<NEW_LINE>String value = null;<NEW_LINE>ResValue resource = spec.getDefaultResource().getValue();<NEW_LINE>if (resource instanceof ResReferenceValue) {<NEW_LINE>continue;<NEW_LINE>} else if (resource instanceof ResAttr) {<NEW_LINE>ResAttr attr = (ResAttr) resource;<NEW_LINE>value = attr.convertToResXmlFormat(mItem.m2);<NEW_LINE>name = spec.getFullName(res.getResSpec().getPackage(), true);<NEW_LINE>} else {<NEW_LINE>name = "@" + spec.getFullName(res.getResSpec().getPackage(), false);<NEW_LINE>}<NEW_LINE>if (value == null) {<NEW_LINE>value = mItem.m2.encodeAsResXmlValue();<NEW_LINE>}<NEW_LINE>if (value == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>serializer.startTag(null, "item");<NEW_LINE>serializer.attribute(null, "name", name);<NEW_LINE>serializer.text(value);<NEW_LINE>serializer.endTag(null, "item");<NEW_LINE>}<NEW_LINE>serializer.endTag(null, "style");<NEW_LINE>} | serializer.startTag(null, "style"); |
1,286,237 | private void parse() throws IOException {<NEW_LINE>try {<NEW_LINE>final byte[] formatIdentifier = new byte[BPM_IDENTIFIER.length()];<NEW_LINE>for (int i = 0; i < formatIdentifier.length; i++) {<NEW_LINE>formatIdentifier[i] = parseByte();<NEW_LINE>}<NEW_LINE>final String identifier = new String(formatIdentifier);<NEW_LINE>setIdentifier(identifier);<NEW_LINE>if (!identifier.equals(BPM_IDENTIFIER)) {<NEW_LINE>throw new PicardException("Invalid identifier '" + identifier + "' for BPM file");<NEW_LINE>}<NEW_LINE>setFileVersion(parseByte());<NEW_LINE>if (getFileVersion() != 1) {<NEW_LINE>throw new PicardException(<MASK><NEW_LINE>}<NEW_LINE>int version = parseInt();<NEW_LINE>final int versionFlag = 0x1000;<NEW_LINE>if ((version & versionFlag) == versionFlag) {<NEW_LINE>version ^= versionFlag;<NEW_LINE>}<NEW_LINE>if (version > 5 || version < 3) {<NEW_LINE>throw new PicardException("Unsupported BPM version (" + version + ")");<NEW_LINE>}<NEW_LINE>manifestName = parseString();<NEW_LINE>controlConfig = parseString();<NEW_LINE>numLoci = parseInt();<NEW_LINE>readData();<NEW_LINE>} finally {<NEW_LINE>stream.close();<NEW_LINE>}<NEW_LINE>} | "Unknown BPM version (" + getFileVersion() + ")"); |
539,334 | final DeactivateKeySigningKeyResult executeDeactivateKeySigningKey(DeactivateKeySigningKeyRequest deactivateKeySigningKeyRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deactivateKeySigningKeyRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeactivateKeySigningKeyRequest> request = null;<NEW_LINE>Response<DeactivateKeySigningKeyResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeactivateKeySigningKeyRequestMarshaller().marshall(super.beforeMarshalling(deactivateKeySigningKeyRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Route 53");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeactivateKeySigningKey");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DeactivateKeySigningKeyResult> responseHandler = new StaxResponseHandler<DeactivateKeySigningKeyResult>(new DeactivateKeySigningKeyResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
1,271,455 | @Produces(MediaType.TEXT_HTML)<NEW_LINE>public Response updateAuthToken(@PathParam("name") String name, @QueryParam("code") String code) {<NEW_LINE>try {<NEW_LINE>if (storage.getPlugin(name).getConfig() instanceof AbstractSecuredStoragePluginConfig) {<NEW_LINE>AbstractSecuredStoragePluginConfig securedStoragePluginConfig = (AbstractSecuredStoragePluginConfig) storage.<MASK><NEW_LINE>CredentialsProvider credentialsProvider = securedStoragePluginConfig.getCredentialsProvider();<NEW_LINE>String callbackURL = this.request.getRequestURL().toString();<NEW_LINE>// Now exchange the authorization token for an access token<NEW_LINE>Builder builder = new OkHttpClient.Builder();<NEW_LINE>OkHttpClient client = builder.build();<NEW_LINE>Request accessTokenRequest = OAuthUtils.getAccessTokenRequest(credentialsProvider, code, callbackURL);<NEW_LINE>Map<String, String> updatedTokens = OAuthUtils.getOAuthTokens(client, accessTokenRequest);<NEW_LINE>// Add to token registry<NEW_LINE>TokenRegistry tokenRegistry = ((AbstractStoragePlugin) storage.getPlugin(name)).getContext().getoAuthTokenProvider().getOauthTokenRegistry();<NEW_LINE>// Add a token registry table if none exists<NEW_LINE>tokenRegistry.createTokenTable(name);<NEW_LINE>PersistentTokenTable tokenTable = tokenRegistry.getTokenTable(name);<NEW_LINE>// Add tokens to persistent storage<NEW_LINE>tokenTable.setAccessToken(updatedTokens.get(OAuthTokenCredentials.ACCESS_TOKEN));<NEW_LINE>tokenTable.setRefreshToken(updatedTokens.get(OAuthTokenCredentials.REFRESH_TOKEN));<NEW_LINE>// Get success page<NEW_LINE>String successPage = null;<NEW_LINE>try (InputStream inputStream = Resource.newClassPathResource(OAUTH_SUCCESS_PAGE).getInputStream()) {<NEW_LINE>InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8);<NEW_LINE>BufferedReader bufferedReader = new BufferedReader(reader);<NEW_LINE>successPage = bufferedReader.lines().collect(Collectors.joining("\n"));<NEW_LINE>bufferedReader.close();<NEW_LINE>reader.close();<NEW_LINE>} catch (IOException e) {<NEW_LINE>Response.status(Status.OK).entity("You may close this window.").build();<NEW_LINE>}<NEW_LINE>return Response.status(Status.OK).entity(successPage).build();<NEW_LINE>} else {<NEW_LINE>logger.error("{} is not a HTTP plugin. You can only add auth code to HTTP plugins.", name);<NEW_LINE>return Response.status(Status.INTERNAL_SERVER_ERROR).entity(message("Unable to add authorization code: %s", name)).build();<NEW_LINE>}<NEW_LINE>} catch (PluginException e) {<NEW_LINE>logger.error("Error when adding auth token to {}", name);<NEW_LINE>return Response.status(Status.INTERNAL_SERVER_ERROR).entity(message("Unable to add authorization code: %s", e.getMessage())).build();<NEW_LINE>}<NEW_LINE>} | getPlugin(name).getConfig(); |
1,274,275 | public Long queryCount(IndexQuery query, KeyInformation.IndexRetriever information, BaseTransaction tx) throws BackendException {<NEW_LINE>// Construct query<NEW_LINE>final String store = query.getStore();<NEW_LINE>final LuceneCustomAnalyzer delegatingAnalyzer = delegatingAnalyzerFor(store, information);<NEW_LINE>final SearchParams searchParams = convertQuery(query.getCondition(), information.get(store), delegatingAnalyzer);<NEW_LINE>try {<NEW_LINE>final IndexSearcher searcher = ((Transaction) tx).<MASK><NEW_LINE>if (searcher == null) {<NEW_LINE>// Index does not yet exist<NEW_LINE>return 0L;<NEW_LINE>}<NEW_LINE>Query q = searchParams.getQuery();<NEW_LINE>final long time = System.currentTimeMillis();<NEW_LINE>// We ignore offset and limit for totals<NEW_LINE>final TopDocs docs = searcher.search(q, 1);<NEW_LINE>log.debug("Executed query [{}] in {} ms", q, System.currentTimeMillis() - time);<NEW_LINE>return docs.totalHits.value;<NEW_LINE>} catch (final IOException e) {<NEW_LINE>throw new TemporaryBackendException("Could not execute Lucene query", e);<NEW_LINE>}<NEW_LINE>} | getSearcher(query.getStore()); |
436,239 | public Builder mergeFrom(io.kubernetes.client.proto.V1.ResourceQuotaList other) {<NEW_LINE>if (other == io.kubernetes.client.proto.V1.ResourceQuotaList.getDefaultInstance())<NEW_LINE>return this;<NEW_LINE>if (other.hasMetadata()) {<NEW_LINE>mergeMetadata(other.getMetadata());<NEW_LINE>}<NEW_LINE>if (itemsBuilder_ == null) {<NEW_LINE>if (!other.items_.isEmpty()) {<NEW_LINE>if (items_.isEmpty()) {<NEW_LINE>items_ = other.items_;<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>ensureItemsIsMutable();<NEW_LINE>items_.addAll(other.items_);<NEW_LINE>}<NEW_LINE>onChanged();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (!other.items_.isEmpty()) {<NEW_LINE>if (itemsBuilder_.isEmpty()) {<NEW_LINE>itemsBuilder_.dispose();<NEW_LINE>itemsBuilder_ = null;<NEW_LINE>items_ = other.items_;<NEW_LINE>bitField0_ = (bitField0_ & ~0x00000002);<NEW_LINE>itemsBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getItemsFieldBuilder() : null;<NEW_LINE>} else {<NEW_LINE>itemsBuilder_.addAllMessages(other.items_);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>this.mergeUnknownFields(other.unknownFields);<NEW_LINE>onChanged();<NEW_LINE>return this;<NEW_LINE>} | bitField0_ = (bitField0_ & ~0x00000002); |
1,781,982 | /*<NEW_LINE>* verify the signature in in against the file fileName.<NEW_LINE>*/<NEW_LINE>private static void verifySignature(String fileName, InputStream in, InputStream keyIn) throws GeneralSecurityException, IOException, PGPException, SignatureException {<NEW_LINE>in = PGPUtil.getDecoderStream(in);<NEW_LINE>PGPObjectFactory pgpFact = new PGPObjectFactory(in, new BcKeyFingerprintCalculator());<NEW_LINE>PGPSignatureList p3;<NEW_LINE>Object o = pgpFact.nextObject();<NEW_LINE>if (o instanceof PGPCompressedData) {<NEW_LINE>PGPCompressedData c1 = (PGPCompressedData) o;<NEW_LINE>pgpFact = new PGPObjectFactory(c1.getDataStream(), new BcKeyFingerprintCalculator());<NEW_LINE>p3 = (PGPSignatureList) pgpFact.nextObject();<NEW_LINE>} else {<NEW_LINE>p3 = (PGPSignatureList) o;<NEW_LINE>}<NEW_LINE>PGPPublicKeyRingCollection pgpPubRingCollection = new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(keyIn), new BcKeyFingerprintCalculator());<NEW_LINE>InputStream dIn = new <MASK><NEW_LINE>PGPSignature sig = p3.get(0);<NEW_LINE>PGPPublicKey key = pgpPubRingCollection.getPublicKey(sig.getKeyID());<NEW_LINE>sig.init(new JcaPGPContentVerifierBuilderProvider().setProvider("BC"), key);<NEW_LINE>int ch;<NEW_LINE>while ((ch = dIn.read()) >= 0) {<NEW_LINE>sig.update((byte) ch);<NEW_LINE>}<NEW_LINE>dIn.close();<NEW_LINE>if (sig.verify()) {<NEW_LINE>System.out.println("signature verified.");<NEW_LINE>} else {<NEW_LINE>System.out.println("signature verification failed.");<NEW_LINE>}<NEW_LINE>} | BufferedInputStream(new FileInputStream(fileName)); |
1,852,994 | private static ExplicitGroup explicitGroupFromString(String input, Character keywordSeparator) throws ParseException {<NEW_LINE>if (!input.startsWith(MetadataSerializationConfiguration.EXPLICIT_GROUP_ID)) {<NEW_LINE>throw new IllegalArgumentException("ExplicitGroup cannot be created from \"" + input + "\".");<NEW_LINE>}<NEW_LINE>QuotedStringTokenizer tok = new QuotedStringTokenizer(input.substring(MetadataSerializationConfiguration.EXPLICIT_GROUP_ID.length()), <MASK><NEW_LINE>String name = StringUtil.unquote(tok.nextToken(), MetadataSerializationConfiguration.GROUP_QUOTE_CHAR);<NEW_LINE>try {<NEW_LINE>int context = Integer.parseInt(tok.nextToken());<NEW_LINE>ExplicitGroup newGroup = new ExplicitGroup(name, GroupHierarchyType.getByNumberOrDefault(context), keywordSeparator);<NEW_LINE>addGroupDetails(tok, newGroup);<NEW_LINE>return newGroup;<NEW_LINE>} catch (NumberFormatException exception) {<NEW_LINE>throw new ParseException("Could not parse context in " + input);<NEW_LINE>}<NEW_LINE>} | MetadataSerializationConfiguration.GROUP_UNIT_SEPARATOR, MetadataSerializationConfiguration.GROUP_QUOTE_CHAR); |
1,814,947 | private static IntermediateOperation importOperation(String name, Onnx.GraphProto onnxGraph, IntermediateGraph intermediateGraph) {<NEW_LINE>if (intermediateGraph.alreadyImported(name)) {<NEW_LINE>return intermediateGraph.get(name);<NEW_LINE>}<NEW_LINE>IntermediateOperation operation;<NEW_LINE>if (isArgumentTensor(name, onnxGraph)) {<NEW_LINE>Onnx.ValueInfoProto valueInfoProto = getArgumentTensor(name, onnxGraph);<NEW_LINE>if (valueInfoProto == null)<NEW_LINE>throw new IllegalArgumentException("Could not find argument tensor '" + name + "'");<NEW_LINE>OrderedTensorType type = TypeConverter.typeFrom(valueInfoProto.getType());<NEW_LINE>operation = new Argument(intermediateGraph.name(), valueInfoProto.getName(), type);<NEW_LINE>intermediateGraph.inputs(intermediateGraph.defaultSignature()).put(IntermediateOperation.namePartOf(name), operation.vespaName());<NEW_LINE>} else if (isConstantTensor(name, onnxGraph)) {<NEW_LINE>Onnx.TensorProto <MASK><NEW_LINE>OrderedTensorType defaultType = TypeConverter.typeFrom(tensorProto);<NEW_LINE>operation = new Constant(intermediateGraph.name(), name, defaultType);<NEW_LINE>operation.setConstantValueFunction(type -> new TensorValue(TensorConverter.toVespaTensor(tensorProto, type)));<NEW_LINE>} else {<NEW_LINE>Onnx.NodeProto node = getNodeFromGraph(name, onnxGraph);<NEW_LINE>int outputIndex = getOutputIndex(node, name);<NEW_LINE>List<IntermediateOperation> inputs = importOperationInputs(node, onnxGraph, intermediateGraph);<NEW_LINE>operation = mapOperation(node, inputs, intermediateGraph, outputIndex);<NEW_LINE>// propagate constant values if all inputs are constant<NEW_LINE>if (operation.isConstant()) {<NEW_LINE>operation.setConstantValueFunction(operation::evaluateAsConstant);<NEW_LINE>}<NEW_LINE>if (isOutputNode(name, onnxGraph)) {<NEW_LINE>intermediateGraph.outputs(intermediateGraph.defaultSignature()).put(IntermediateOperation.namePartOf(name), operation.name());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>intermediateGraph.put(operation.name(), operation);<NEW_LINE>intermediateGraph.put(name, operation);<NEW_LINE>return operation;<NEW_LINE>} | tensorProto = getConstantTensor(name, onnxGraph); |
688,844 | public static void expandObjectArrayToStackValues(MethodVisitor mv, ImmutableList<ClassName> expectedTypesOnOperandStack) {<NEW_LINE>int numOfValuesExpandedOnOperandStack = expectedTypesOnOperandStack.size();<NEW_LINE>for (int i = 0; i < numOfValuesExpandedOnOperandStack; i++) {<NEW_LINE>ClassName operandTypeName = expectedTypesOnOperandStack.get(i);<NEW_LINE>// Pre-duplicates the array reference for next loop iteration use.<NEW_LINE>// Post-operation stack bottom to top:<NEW_LINE>// ..., arrayref, arrayref<NEW_LINE>mv.visitInsn(Opcodes.DUP);<NEW_LINE>// Pushes the current array index on stack.<NEW_LINE>// Post-operation stack bottom to top:<NEW_LINE>// ..., arrayref, arrayref, i<NEW_LINE>visitPushInstr(mv, i);<NEW_LINE>// Post-operation stack bottom to top:<NEW_LINE>// ..., arrayref, obj_value_i<NEW_LINE>mv.visitInsn(Opcodes.AALOAD);<NEW_LINE>// Post-operation stack bottom to top:<NEW_LINE>// ..., arrayref, cast_and_unboxed_value_i<NEW_LINE>if (operandTypeName.isPrimitive()) {<NEW_LINE>ClassName boxedTypeName = operandTypeName.toBoxedType();<NEW_LINE>mv.visitTypeInsn(Opcodes.CHECKCAST, boxedTypeName.binaryName());<NEW_LINE>createBoxedTypeToPrimitiveInvocationSite(boxedTypeName).accept(mv);<NEW_LINE>} else if (!ClassName.create(Object.class).equals(operandTypeName)) {<NEW_LINE>mv.visitTypeInsn(Opcodes.CHECKCAST, operandTypeName.binaryName());<NEW_LINE>}<NEW_LINE>// ..., cast_and_unboxed_value_i, arrayref<NEW_LINE>if (operandTypeName.isWideType()) {<NEW_LINE><MASK><NEW_LINE>mv.visitInsn(Opcodes.POP2);<NEW_LINE>} else {<NEW_LINE>mv.visitInsn(Opcodes.SWAP);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// pops out the original arrayref.<NEW_LINE>mv.visitInsn(Opcodes.POP);<NEW_LINE>} | mv.visitInsn(Opcodes.DUP2_X1); |
29,693 | private void vendorSpecificMemoryMetrics(MetricRegistry registry) {<NEW_LINE>MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();<NEW_LINE>Metadata meta = Metadata.builder().withName(MEMORY_COMMITTED_NON_HEAP).withType(MetricType.GAUGE).withUnit(MetricUnits.BYTES).withDisplayName("Committed Non Heap Memory").<MASK><NEW_LINE>registry.register(meta, new Gauge() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Number getValue() {<NEW_LINE>return memoryMXBean.getNonHeapMemoryUsage().getCommitted();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>meta = Metadata.builder().withName(MEMORY_MAX_NON_HEAP).withType(MetricType.GAUGE).withUnit(MetricUnits.BYTES).withDisplayName("Max Non Heap Memory").withDescription("Displays the maximum amount of used non-heap memory in bytes.").build();<NEW_LINE>registry.register(meta, new Gauge() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Number getValue() {<NEW_LINE>return memoryMXBean.getNonHeapMemoryUsage().getMax();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>meta = Metadata.builder().withName(MEMORY_USED_NON_HEAP).withType(MetricType.GAUGE).withUnit(MetricUnits.BYTES).withDisplayName("Used Non Heap Memory").withDescription("Displays the amount of used non-heap memory in bytes.").build();<NEW_LINE>registry.register(meta, new Gauge() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Number getValue() {<NEW_LINE>return memoryMXBean.getNonHeapMemoryUsage().getUsed();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | withDescription("Displays the amount of non heap memory in bytes that is committed for the Java virtual machine to use.").build(); |
1,345,699 | private void handleError(Throwable throwable) {<NEW_LINE>if (throwable instanceof BlockHashNotConnectingException || throwable instanceof BlockHeightNotConnectingException) {<NEW_LINE>// We do not escalate that exception as it is handled with the snapshot manager to recover its state.<NEW_LINE>log.<MASK><NEW_LINE>} else {<NEW_LINE>String errorMessage = "An error occurred: Error=" + throwable.toString();<NEW_LINE>log.error(errorMessage);<NEW_LINE>throwable.printStackTrace();<NEW_LINE>if (throwable instanceof RpcException) {<NEW_LINE>Throwable cause = throwable.getCause();<NEW_LINE>if (cause != null) {<NEW_LINE>if (cause instanceof ConnectException) {<NEW_LINE>if (warnMessageHandler != null)<NEW_LINE>warnMessageHandler.accept("You have configured Bisq to run as DAO full node but there is no " + "localhost Bitcoin Core node detected. You need to have Bitcoin Core started and synced before " + "starting Bisq. Please restart Bisq with proper DAO full node setup or switch to lite node mode.");<NEW_LINE>return;<NEW_LINE>} else if (cause instanceof NotificationHandlerException) {<NEW_LINE>log.error("Error from within block notification daemon: {}", cause.getCause().toString());<NEW_LINE>startReOrgFromLastSnapshot();<NEW_LINE>return;<NEW_LINE>} else if (cause instanceof Error) {<NEW_LINE>throw (Error) cause;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (errorMessageHandler != null)<NEW_LINE>errorMessageHandler.accept(errorMessage);<NEW_LINE>}<NEW_LINE>} | warn(throwable.toString()); |
633,638 | public GetAccountSettingsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>GetAccountSettingsResult getAccountSettingsResult = new GetAccountSettingsResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return getAccountSettingsResult;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("accountSettings", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>getAccountSettingsResult.setAccountSettings(AccountSettingsJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return getAccountSettingsResult;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
1,437,076 | public static String loadFromReg() {<NEW_LINE>String hKey = "global";<NEW_LINE>String servername = UserPreferences.get(hKey, "ServerName");<NEW_LINE>if (servername == null)<NEW_LINE>servername = "";<NEW_LINE>for (int i = 0; i < parameterArray.length; i++) {<NEW_LINE>if (parameterArray[i] instanceof StringParameter) {<NEW_LINE>if (UserPreferences.get(hKey, parameterArray[i].getName()) != null) {<NEW_LINE>String stringValue = UserPreferences.get(hKey, parameterArray[i].getName());<NEW_LINE>((StringParameter) parameterArray[<MASK><NEW_LINE>}<NEW_LINE>} else if (parameterArray[i] instanceof IntParameter) {<NEW_LINE>if (UserPreferences.get(hKey, parameterArray[i].getName()) != null) {<NEW_LINE>int intValue = UserPreferences.getInt(hKey, parameterArray[i].getName());<NEW_LINE>((IntParameter) parameterArray[i]).setParam(intValue);<NEW_LINE>}<NEW_LINE>} else if (parameterArray[i] instanceof BoolParameter) {<NEW_LINE>if (UserPreferences.get(hKey, parameterArray[i].getName()) != null) {<NEW_LINE>boolean booleanValue = UserPreferences.getBool(hKey, parameterArray[i].getName());<NEW_LINE>((BoolParameter) parameterArray[i]).setParam(booleanValue);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>vlog.error(String.format("Unknown parameter type for parameter %s", parameterArray[i].getName()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return servername;<NEW_LINE>} | i]).setParam(stringValue); |
575,906 | public void start(int listenPort) throws Exception {<NEW_LINE>if (this.started.get()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>bootstrap.childHandler(new ChannelInitializer<SocketChannel>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void initChannel(SocketChannel socketChannel) {<NEW_LINE>if (isOverTLS) {<NEW_LINE>try {<NEW_LINE>SSLEngine sslEngine = TSSLEngineUtil.createSSLEngine(keyStorePath, trustStorePath, keyStorePassword, trustStorePassword, false, needTwoWayAuthentic);<NEW_LINE>socketChannel.pipeline().addLast("ssl", new SslHandler(sslEngine));<NEW_LINE>} catch (Throwable t) {<NEW_LINE>logger.error("TLS NettyRpcServer init SSLEngine error, system auto exit!", t);<NEW_LINE>System.exit(1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Encode the data handler<NEW_LINE>socketChannel.pipeline().addLast("protocolEncoder", new NettyProtocolDecoder());<NEW_LINE>// Decode the bytes into a Rpc Data Pack<NEW_LINE>socketChannel.pipeline().addLast("protocolDecoder", new NettyProtocolEncoder());<NEW_LINE>// tube netty Server handler<NEW_LINE>socketChannel.pipeline().addLast(<MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>bootstrap.bind(new InetSocketAddress(listenPort)).sync();<NEW_LINE>this.started.set(true);<NEW_LINE>if (isOverTLS) {<NEW_LINE>logger.info(new StringBuilder(256).append("TLS RpcServer started, listen port: ").append(listenPort).toString());<NEW_LINE>} else {<NEW_LINE>logger.info(new StringBuilder(256).append("TCP RpcServer started, listen port: ").append(listenPort).toString());<NEW_LINE>}<NEW_LINE>} | "serverHandler", new NettyServerHandler(protocolType)); |
1,532,898 | public ResourceServer findById(String id) {<NEW_LINE>if (id == null)<NEW_LINE>return null;<NEW_LINE>CachedResourceServer cached = cache.get(id, CachedResourceServer.class);<NEW_LINE>if (cached != null) {<NEW_LINE>logger.tracev("by id cache hit: {0}", cached.getId());<NEW_LINE>}<NEW_LINE>if (cached == null) {<NEW_LINE>Long loaded = cache.getCurrentRevision(id);<NEW_LINE>if (!modelMightExist(id))<NEW_LINE>return null;<NEW_LINE>ResourceServer model = <MASK><NEW_LINE>if (model == null) {<NEW_LINE>setModelDoesNotExists(id, loaded);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (invalidations.contains(id))<NEW_LINE>return model;<NEW_LINE>cached = new CachedResourceServer(loaded, model);<NEW_LINE>cache.addRevisioned(cached, startupRevision);<NEW_LINE>} else if (invalidations.contains(id)) {<NEW_LINE>return getResourceServerStoreDelegate().findById(id);<NEW_LINE>} else if (managedResourceServers.containsKey(id)) {<NEW_LINE>return managedResourceServers.get(id);<NEW_LINE>}<NEW_LINE>ResourceServerAdapter adapter = new ResourceServerAdapter(cached, StoreFactoryCacheSession.this);<NEW_LINE>managedResourceServers.put(id, adapter);<NEW_LINE>return adapter;<NEW_LINE>} | getResourceServerStoreDelegate().findById(id); |
1,202,297 | private boolean subdivide(AABB b) {<NEW_LINE>double w = aabb.width / 2d;<NEW_LINE>double h = aabb.height / 2d;<NEW_LINE>if (w < minWidth || h < minHeight)<NEW_LINE>return false;<NEW_LINE>AxisAlignedBoundingBox aabbNW = new <MASK><NEW_LINE>northWest = new MxCifQuadNode<AABB>(aabbNW);<NEW_LINE>XYPoint xyNE = new XYPoint(aabb.x + w, aabb.y);<NEW_LINE>AxisAlignedBoundingBox aabbNE = new AxisAlignedBoundingBox(xyNE, w, h);<NEW_LINE>northEast = new MxCifQuadNode<AABB>(aabbNE);<NEW_LINE>XYPoint xySW = new XYPoint(aabb.x, aabb.y + h);<NEW_LINE>AxisAlignedBoundingBox aabbSW = new AxisAlignedBoundingBox(xySW, w, h);<NEW_LINE>southWest = new MxCifQuadNode<AABB>(aabbSW);<NEW_LINE>XYPoint xySE = new XYPoint(aabb.x + w, aabb.y + h);<NEW_LINE>AxisAlignedBoundingBox aabbSE = new AxisAlignedBoundingBox(xySE, w, h);<NEW_LINE>southEast = new MxCifQuadNode<AABB>(aabbSE);<NEW_LINE>return insertIntoChildren(b);<NEW_LINE>} | AxisAlignedBoundingBox(aabb, w, h); |
815,017 | private static int quickTest2DPolylinePoint(Polyline geomA, Point2D ptB, double tolerance, int testType) {<NEW_LINE>int mask = Relation.Touches | Relation.Contains | Relation.Within | Relation.Disjoint | Relation.Intersects;<NEW_LINE>if ((testType & mask) == 0)<NEW_LINE>return Relation.NoThisRelation;<NEW_LINE>int res = quickTest2DMVPointRasterOnly(geomA, ptB, tolerance);<NEW_LINE>if (res > 0)<NEW_LINE>return res;<NEW_LINE>// Go through the segments:<NEW_LINE>double toleranceSqr = tolerance * tolerance;<NEW_LINE>MultiPathImpl mpImpl = (MultiPathImpl) geomA._getImpl();<NEW_LINE>SegmentIteratorImpl iter = mpImpl.querySegmentIterator();<NEW_LINE>while (iter.nextPath()) {<NEW_LINE><MASK><NEW_LINE>if (!geomA.isClosedPath(pathIndex)) {<NEW_LINE>int pathSize = geomA.getPathSize(pathIndex);<NEW_LINE>int pathStart = geomA.getPathStart(pathIndex);<NEW_LINE>if (pathSize == 0)<NEW_LINE>continue;<NEW_LINE>if (Point2D.sqrDistance(geomA.getXY(pathStart), ptB) <= toleranceSqr || (pathSize > 1 && Point2D.sqrDistance(geomA.getXY(pathStart + pathSize - 1), ptB) <= toleranceSqr)) {<NEW_LINE>return (int) Relation.Touches;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (testType != Relation.Touches) {<NEW_LINE>while (iter.hasNextSegment()) {<NEW_LINE>Segment segment = iter.nextSegment();<NEW_LINE>double t = segment.getClosestCoordinate(ptB, false);<NEW_LINE>Point2D pt = segment.getCoord2D(t);<NEW_LINE>if (Point2D.sqrDistance(pt, ptB) <= toleranceSqr) {<NEW_LINE>if ((testType & Relation.IntersectsOrDisjoint) != 0) {<NEW_LINE>return Relation.Intersects;<NEW_LINE>}<NEW_LINE>return (int) Relation.Contains;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return (testType & Relation.IntersectsOrDisjoint) != 0 ? Relation.Disjoint : Relation.NoThisRelation;<NEW_LINE>} | int pathIndex = iter.getPathIndex(); |
1,146,747 | public static APIUpdateVolumeEvent __example__() {<NEW_LINE>APIUpdateVolumeEvent event = new APIUpdateVolumeEvent();<NEW_LINE>String volumeUuid = uuid();<NEW_LINE>VolumeInventory vol = new VolumeInventory();<NEW_LINE>vol.setName("test-volume");<NEW_LINE>vol.setCreateDate(new Timestamp(org.zstack.header.message.DocUtils.date));<NEW_LINE>vol.setLastOpDate(new Timestamp(org.zstack.header.message.DocUtils.date));<NEW_LINE>vol.setType(VolumeType.Root.toString());<NEW_LINE>vol.setUuid(volumeUuid);<NEW_LINE>vol.setSize(SizeUnit.GIGABYTE.toByte(100));<NEW_LINE>vol.setActualSize(SizeUnit.GIGABYTE.toByte(20));<NEW_LINE>vol.setDeviceId(0);<NEW_LINE>vol.setState(VolumeState.Enabled.toString());<NEW_LINE>vol.setFormat("qcow2");<NEW_LINE>vol.setDiskOfferingUuid(uuid());<NEW_LINE>vol.setInstallPath(String.format<MASK><NEW_LINE>vol.setStatus(VolumeStatus.Ready.toString());<NEW_LINE>vol.setPrimaryStorageUuid(uuid());<NEW_LINE>vol.setVmInstanceUuid(uuid());<NEW_LINE>vol.setRootImageUuid(uuid());<NEW_LINE>event.setInventory(vol);<NEW_LINE>return event;<NEW_LINE>} | ("/zstack_ps/rootVolumes/acct-36c27e8ff05c4780bf6d2fa65700f22e/vol-%s/%s.qcow2", volumeUuid, volumeUuid)); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.