idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,803,511 | private void exportTheEmptyBinaryNamespaceAt(Node atNode, AddAt addAt, NodeTraversal t) {<NEW_LINE>if (currentScript.declareLegacyNamespace) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String binaryNamespaceString = currentScript.getBinaryNamespace();<NEW_LINE>AstFactory.Type moduleType = type(currentScript.rootNode);<NEW_LINE>Node binaryNamespaceName = <MASK><NEW_LINE>binaryNamespaceName.setOriginalName(currentScript.namespaceId);<NEW_LINE>this.declareGlobalVariable(binaryNamespaceName, t);<NEW_LINE>Node binaryNamespaceExportNode = IR.var(binaryNamespaceName, astFactory.createObjectLit());<NEW_LINE>if (addAt == AddAt.BEFORE) {<NEW_LINE>binaryNamespaceExportNode.insertBefore(atNode);<NEW_LINE>} else if (addAt == AddAt.AFTER) {<NEW_LINE>binaryNamespaceExportNode.insertAfter(atNode);<NEW_LINE>}<NEW_LINE>binaryNamespaceExportNode.putBooleanProp(Node.IS_NAMESPACE, true);<NEW_LINE>binaryNamespaceExportNode.srcrefTree(atNode);<NEW_LINE>markConst(binaryNamespaceExportNode);<NEW_LINE>compiler.reportChangeToEnclosingScope(binaryNamespaceExportNode);<NEW_LINE>currentScript.hasCreatedExportObject = true;<NEW_LINE>} | astFactory.createName(binaryNamespaceString, moduleType); |
1,720,262 | final CancelJobResult executeCancelJob(CancelJobRequest cancelJobRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(cancelJobRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CancelJobRequest> request = null;<NEW_LINE>Response<CancelJobResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CancelJobRequestMarshaller().marshall(super.beforeMarshalling(cancelJobRequest));<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, "ImportExport");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CancelJob");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<CancelJobResult> responseHandler = new StaxResponseHandler<CancelJobResult>(new CancelJobResultStaxUnmarshaller());<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | invoke(request, responseHandler, executionContext); |
1,224,070 | private void zoneFailurePathToSlime(Cursor object, CapacityChecker.HostFailurePath failurePath) {<NEW_LINE>object.setLong("totalHosts", capacityChecker.getHosts().size());<NEW_LINE>object.setLong("couldLoseHosts", failurePath.hostsCausingFailure.size());<NEW_LINE>failurePath.failureReason.host.ifPresent(host -> object.setString("failedTenantParent", host.hostname()));<NEW_LINE>failurePath.failureReason.tenant.ifPresent(tenant -> {<NEW_LINE>object.setString("failedTenant", tenant.hostname());<NEW_LINE>object.setString("failedTenantResources", tenant.resources().toString());<NEW_LINE>tenant.allocation().ifPresent(allocation -> object.setString("failedTenantAllocation", allocation.toString()));<NEW_LINE>var explanation = object.setObject("hostCandidateRejectionReasons");<NEW_LINE>allocationFailureReasonListToSlime(explanation.setObject("singularReasonFailures"), failurePath.failureReason.allocationFailures.singularReasonFailures());<NEW_LINE>allocationFailureReasonListToSlime(explanation.setObject("totalFailures"<MASK><NEW_LINE>});<NEW_LINE>var details = object.setObject("details");<NEW_LINE>hostLossPossibleToSlime(details, Optional.of(failurePath), failurePath.hostsCausingFailure);<NEW_LINE>} | ), failurePath.failureReason.allocationFailures); |
898,855 | public int encodeString(KrollDict args) {<NEW_LINE>if (!args.containsKey(TiC.PROPERTY_DEST)) {<NEW_LINE>throw new IllegalArgumentException("dest was not specified for encodeString");<NEW_LINE>}<NEW_LINE>if (!args.containsKey(TiC.PROPERTY_SOURCE) || args.get(TiC.PROPERTY_SOURCE) == null) {<NEW_LINE>throw new IllegalArgumentException("source was not specified for encodeString");<NEW_LINE>}<NEW_LINE>BufferProxy dest = (BufferProxy) <MASK><NEW_LINE>String src = (String) args.get(TiC.PROPERTY_SOURCE);<NEW_LINE>int destPosition = 0;<NEW_LINE>if (args.containsKey(TiC.PROPERTY_DEST_POSITION)) {<NEW_LINE>destPosition = TiConvert.toInt(args, TiC.PROPERTY_DEST_POSITION);<NEW_LINE>}<NEW_LINE>int srcPosition = 0;<NEW_LINE>if (args.containsKey(TiC.PROPERTY_SOURCE_POSITION)) {<NEW_LINE>srcPosition = TiConvert.toInt(args, TiC.PROPERTY_SOURCE_POSITION);<NEW_LINE>}<NEW_LINE>int srcLength = src.length();<NEW_LINE>if (args.containsKey(TiC.PROPERTY_SOURCE_LENGTH)) {<NEW_LINE>srcLength = TiConvert.toInt(args, TiC.PROPERTY_SOURCE_LENGTH);<NEW_LINE>}<NEW_LINE>String charset = validateCharset(args);<NEW_LINE>byte[] destBuffer = dest.getBuffer();<NEW_LINE>validatePositionAndLength(srcPosition, srcLength, src.length());<NEW_LINE>if (srcPosition != 0 || srcLength != src.length()) {<NEW_LINE>src = src.substring(srcPosition, srcPosition + srcLength);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>byte[] encoded = src.getBytes(charset);<NEW_LINE>System.arraycopy(encoded, 0, destBuffer, destPosition, encoded.length);<NEW_LINE>return destPosition + encoded.length;<NEW_LINE>} catch (UnsupportedEncodingException e) {<NEW_LINE>Log.w(TAG, e.getMessage(), e);<NEW_LINE>throw new IllegalArgumentException("Unsupported Encoding: " + charset);<NEW_LINE>}<NEW_LINE>} | args.get(TiC.PROPERTY_DEST); |
671,078 | public ValidateResult validate(Object value) {<NEW_LINE>if (value == null) {<NEW_LINE>return SUCCESS;<NEW_LINE>}<NEW_LINE>if (value instanceof Byte || value instanceof Short || value instanceof Integer || value instanceof Long || value instanceof BigInteger || value instanceof AtomicInteger || value instanceof AtomicLong) {<NEW_LINE>if (this.value != ((Number) value).longValue()) {<NEW_LINE>return new ValidateResult(false, "const not match, expect %s, but %s", this.value, value);<NEW_LINE>}<NEW_LINE>} else if (value instanceof BigDecimal) {<NEW_LINE>BigDecimal decimal = (BigDecimal) value;<NEW_LINE>if (decimal.compareTo(BigDecimal.valueOf(this.value)) != 0) {<NEW_LINE>return new ValidateResult(false, "const not match, expect %s, but %s", this.value, value);<NEW_LINE>}<NEW_LINE>} else if (value instanceof Float) {<NEW_LINE>float floatValue = ((Float) value).floatValue();<NEW_LINE>if (this.value != floatValue) {<NEW_LINE>return new ValidateResult(false, "const not match, expect %s, but %s", this.value, value);<NEW_LINE>}<NEW_LINE>} else if (value instanceof Double) {<NEW_LINE>double doubleValue = ((Double) value).doubleValue();<NEW_LINE>if (this.value != doubleValue) {<NEW_LINE>return new ValidateResult(false, <MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>return new ValidateResult(false, "const not match, expect %s, but %s", this.value, value);<NEW_LINE>}<NEW_LINE>return SUCCESS;<NEW_LINE>} | "const not match, expect %s, but %s", this.value, value); |
1,844,233 | protected Node visitShowRoles(ShowRoles node, Void context) {<NEW_LINE>Optional<String> catalog = processRoleCommandCatalog(metadata, session, node, node.getCatalog().map(c -> c.getValue().toLowerCase(ENGLISH)));<NEW_LINE>if (node.isCurrent()) {<NEW_LINE>accessControl.checkCanShowCurrentRoles(session.toSecurityContext(), catalog);<NEW_LINE>Set<String> enabledRoles = catalog.map(c -> metadata.listEnabledRoles(session, c)).orElseGet(() -> session.<MASK><NEW_LINE>List<Expression> rows = enabledRoles.stream().map(role -> row(new StringLiteral(role))).collect(toList());<NEW_LINE>return singleColumnValues(rows, "Role");<NEW_LINE>} else {<NEW_LINE>accessControl.checkCanShowRoles(session.toSecurityContext(), catalog);<NEW_LINE>List<Expression> rows = metadata.listRoles(session, catalog).stream().map(role -> row(new StringLiteral(role))).collect(toList());<NEW_LINE>return singleColumnValues(rows, "Role");<NEW_LINE>}<NEW_LINE>} | getIdentity().getEnabledRoles()); |
148,018 | public void run() {<NEW_LINE>try {<NEW_LINE>ThreadMXBean bean = ManagementFactory.getThreadMXBean();<NEW_LINE>for (int i = 0; i < repeat; i++) {<NEW_LINE>List<String> list = new ArrayList<>();<NEW_LINE>int deadLockedCount = bean.findDeadlockedThreads() == null ? 0 : bean.findDeadlockedThreads().length;<NEW_LINE>list.add(String.format("thread total started:%d, count:%d, peak:%d, daemon:%d, dead:%d.", bean.getTotalStartedThreadCount(), bean.getThreadCount(), bean.getPeakThreadCount(), bean.getDaemonThreadCount(), deadLockedCount));<NEW_LINE>if (BooleanUtils.isTrue(Servers.centerServerIsRunning())) {<NEW_LINE>File file = new File(Config.dir_logs(true), "centerServer_" + DateTools.compact(new Date()) + ".txt");<NEW_LINE>list.add(String.format(" +++ center server thread pool size:%d, idle:%d, detail:%s.", Servers.centerServer.getThreadPool().getThreads(), Servers.centerServer.getThreadPool().getIdleThreads(), file.getAbsolutePath()));<NEW_LINE>try (FileOutputStream stream = new FileOutputStream(file);<NEW_LINE>OutputStreamWriter writer = new OutputStreamWriter(stream)) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (BooleanUtils.isTrue(Servers.applicationServerIsRunning())) {<NEW_LINE>File file = new File(Config.dir_logs(true), "applicationServer_" + DateTools.compact(new Date()) + ".txt");<NEW_LINE>list.add(String.format(" +++ application server thread pool size:%d, idle:%d, detail:%s.", Servers.applicationServer.getThreadPool().getThreads(), Servers.applicationServer.getThreadPool().getIdleThreads(), file.getAbsolutePath()));<NEW_LINE>try (FileOutputStream stream = new FileOutputStream(file);<NEW_LINE>OutputStreamWriter writer = new OutputStreamWriter(stream)) {<NEW_LINE>Servers.applicationServer.dump(writer);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (BooleanUtils.isTrue(Servers.webServerIsRunning())) {<NEW_LINE>File file = new File(Config.dir_logs(true), "webServer_" + DateTools.compact(new Date()) + ".txt");<NEW_LINE>list.add(String.format(" +++ web server thread pool size:%d, idle:%d, detail:%s.", Servers.webServer.getThreadPool().getThreads(), Servers.webServer.getThreadPool().getIdleThreads(), file.getAbsolutePath()));<NEW_LINE>try (FileOutputStream stream = new FileOutputStream(file);<NEW_LINE>OutputStreamWriter writer = new OutputStreamWriter(stream)) {<NEW_LINE>Servers.webServer.dump(writer);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>System.out.println(StringUtils.join(list, StringUtils.LF));<NEW_LINE>Thread.sleep(2000);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>} | Servers.centerServer.dump(writer); |
618,069 | public final void run() {<NEW_LINE>if (!Display.getInstance().isEdt()) {<NEW_LINE>throw new IllegalStateException("This method should not be invoked by external code!");<NEW_LINE>}<NEW_LINE>if (styleListenerArray) {<NEW_LINE>Object[] <MASK><NEW_LINE>fireStyleChangeSync((StyleListener[]) iPending, (String) p[0], (Style) p[1]);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (actionListenerArray) {<NEW_LINE>fireActionSync((ActionListener[]) iPending, (ActionEvent) iPendingEvent);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (focusListenerArray) {<NEW_LINE>fireFocusSync((FocusListener[]) iPending, (Component) iPendingEvent);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (dataChangeListenerArray) {<NEW_LINE>fireDataChangeSync((DataChangedListener[]) iPending, ((int[]) iPendingEvent)[0], ((int[]) iPendingEvent)[1]);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (selectionListenerArray) {<NEW_LINE>fireSelectionSync((SelectionListener[]) iPending, ((int[]) iPendingEvent)[0], ((int[]) iPendingEvent)[1]);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (scrollListenerArray) {<NEW_LINE>fireScrollSync((ScrollListener[]) iPending, ((int[]) iPendingEvent)[0], ((int[]) iPendingEvent)[1], ((int[]) iPendingEvent)[2], ((int[]) iPendingEvent)[3]);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (bindTargetArray) {<NEW_LINE>Object[] a = (Object[]) iPendingEvent;<NEW_LINE>fireBindTargetChangeSync((BindTarget[]) iPending, (Component) a[0], (String) a[1], a[2], a[3]);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} | p = (Object[]) iPendingEvent; |
487,988 | public StepExecutionResult execute(ExecutionContext context) throws IOException {<NEW_LINE>Path inputFile = filesystem.getPathForRelativePath(inputPath);<NEW_LINE>Path outputFile = filesystem.getPathForRelativePath(outputPath);<NEW_LINE>try (ZipInputStream in = new ZipInputStream(new BufferedInputStream(Files.newInputStream(inputFile)));<NEW_LINE>CustomZipOutputStream out = ZipOutputStreams.newOutputStream(outputFile)) {<NEW_LINE>for (ZipEntry entry = in.getNextEntry(); entry != null; entry = in.getNextEntry()) {<NEW_LINE><MASK><NEW_LINE>if (entries.contains(customEntry.getName())) {<NEW_LINE>customEntry.setCompressionLevel(compressionLevel.getValue());<NEW_LINE>}<NEW_LINE>InputStream toUse;<NEW_LINE>// If we're using STORED files, we must pre-calculate the CRC.<NEW_LINE>if (customEntry.getMethod() == ZipEntry.STORED) {<NEW_LINE>try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {<NEW_LINE>ByteStreams.copy(in, bos);<NEW_LINE>byte[] bytes = bos.toByteArray();<NEW_LINE>customEntry.setCrc(Hashing.crc32().hashBytes(bytes).padToLong());<NEW_LINE>customEntry.setSize(bytes.length);<NEW_LINE>customEntry.setCompressedSize(bytes.length);<NEW_LINE>toUse = new ByteArrayInputStream(bytes);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>toUse = in;<NEW_LINE>}<NEW_LINE>out.putNextEntry(customEntry);<NEW_LINE>ByteStreams.copy(toUse, out);<NEW_LINE>out.closeEntry();<NEW_LINE>}<NEW_LINE>return StepExecutionResults.SUCCESS;<NEW_LINE>}<NEW_LINE>} | CustomZipEntry customEntry = new CustomZipEntry(entry); |
398,802 | public void begin(int timeout) throws NotSupportedException, SystemException {<NEW_LINE>// Check if tx already exists<NEW_LINE>if (transactions.get() != null) {<NEW_LINE>throw new NotSupportedException(sm.getString("enterprise_distributedtx.notsupported_nested_transaction"));<NEW_LINE>}<NEW_LINE>setDelegate();<NEW_LINE>// Check if JTS tx exists, without starting JTS tx.<NEW_LINE>// This is needed in case the JTS tx was imported from a client.<NEW_LINE>if (getStatus() != Status.STATUS_NO_TRANSACTION) {<NEW_LINE>throw new NotSupportedException<MASK><NEW_LINE>}<NEW_LINE>// START IASRI 4662745<NEW_LINE>if (monitoringEnabled) {<NEW_LINE>// XXX acquireReadLock();<NEW_LINE>getDelegate().getReadLock().lock();<NEW_LINE>try {<NEW_LINE>JavaEETransactionImpl tx = initJavaEETransaction(timeout);<NEW_LINE>activeTransactions.add(tx);<NEW_LINE>monitor.transactionActivatedEvent();<NEW_LINE>ComponentInvocation inv = invMgr.getCurrentInvocation();<NEW_LINE>if (inv != null && inv.getInstance() != null) {<NEW_LINE>tx.setComponentName(inv.getInstance().getClass().getName());<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>// XXX releaseReadLock();<NEW_LINE>getDelegate().getReadLock().unlock();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>initJavaEETransaction(timeout);<NEW_LINE>}<NEW_LINE>// START IASRI 4662745<NEW_LINE>} | (sm.getString("enterprise_distributedtx.notsupported_nested_transaction")); |
159,724 | public void submit() throws LinkisClientRuntimeException {<NEW_LINE>StringBuilder infoBuilder = new StringBuilder();<NEW_LINE>infoBuilder.append("connecting to linkis gateway:").append(getJobOperator().getServerUrl());<NEW_LINE>LogUtils.getInformationLogger().info(infoBuilder.toString());<NEW_LINE>data.updateByOperResult(getJobOperator().submit(jobDesc));<NEW_LINE>CommonUtils.doSleepQuietly(2000l);<NEW_LINE>LinkisJobManDesc jobManDesc = new LinkisJobManDesc();<NEW_LINE>jobManDesc.setJobId(data.getJobID());<NEW_LINE>jobManDesc.setUser(data.getUser());<NEW_LINE>manageJob.setJobDesc(jobManDesc);<NEW_LINE>data.updateByOperResult(getJobOperator().queryJobInfo(data.getUser(), data.getJobID()));<NEW_LINE>infoBuilder.setLength(0);<NEW_LINE>infoBuilder.append("JobId:").append(data.getJobID()).append(System.lineSeparator()).append("TaskId:").append(data.getJobID()).append(System.lineSeparator()).append("ExecId:").append(data.getExecID());<NEW_LINE>LogUtils.getPlaintTextLogger().<MASK><NEW_LINE>if (isAsync) {<NEW_LINE>data.setSuccess(data.getJobStatus() != null && data.getJobStatus().isJobSubmitted());<NEW_LINE>}<NEW_LINE>} | info(infoBuilder.toString()); |
1,329,761 | public List<Integer> execute(final ConcurrentSkipListSet<Integer> workersOnDisabledVms, final int numRunningWorkers, final int totalNumWorkers, final long lastWorkerMigrationTimestamp) {<NEW_LINE>if (lastWorkerMigrationTimestamp > (clock.now() - configuration.getIntervalMs())) {<NEW_LINE>return Collections.emptyList();<NEW_LINE>}<NEW_LINE>if (workersOnDisabledVms.isEmpty()) {<NEW_LINE>return Collections.emptyList();<NEW_LINE>}<NEW_LINE>final <MASK><NEW_LINE>final int numInactiveWorkers = totalNumWorkers - numRunningWorkers;<NEW_LINE>int numWorkersToMigrate = Math.min(numWorkersOnDisabledVM, Math.max(1, (int) Math.ceil(totalNumWorkers * configuration.getPercentToMove() / 100.0)));<NEW_LINE>// If we already have inactive workers for the job, don't migrate more workers as we could end up with all workers in not running state for a job<NEW_LINE>if (numInactiveWorkers >= numWorkersToMigrate) {<NEW_LINE>logger.debug("[{}] num inactive workers {} > num workers to migrate {}, suppressing percent migrate", jobId, numInactiveWorkers, numWorkersToMigrate);<NEW_LINE>return Collections.emptyList();<NEW_LINE>} else {<NEW_LINE>// ensure no more than percentToMove workers for the job are in inactive state<NEW_LINE>numWorkersToMigrate = numWorkersToMigrate - numInactiveWorkers;<NEW_LINE>}<NEW_LINE>final List<Integer> workersToMigrate = new ArrayList<>(numWorkersToMigrate);<NEW_LINE>for (int i = numWorkersToMigrate; i > 0; i--) {<NEW_LINE>final Integer workerToMigrate = workersOnDisabledVms.pollFirst();<NEW_LINE>if (workerToMigrate != null) {<NEW_LINE>workersToMigrate.add(workerToMigrate);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (workersToMigrate.size() > 0) {<NEW_LINE>logger.debug("migrating jobId {} workers {}", jobId, workersToMigrate);<NEW_LINE>}<NEW_LINE>return workersToMigrate;<NEW_LINE>} | int numWorkersOnDisabledVM = workersOnDisabledVms.size(); |
1,294,111 | protected void initGoalState(ClusterModel clusterModel, OptimizationOptions optimizationOptions) throws OptimizationFailureException {<NEW_LINE>_brokersAllowedReplicaMove = GoalUtils.aliveBrokersNotExcludedForReplicaMove(clusterModel, optimizationOptions);<NEW_LINE>if (_brokersAllowedReplicaMove.isEmpty()) {<NEW_LINE>// Handle the case when all alive brokers are excluded from replica moves.<NEW_LINE>ProvisionRecommendation recommendation = new ProvisionRecommendation.Builder(ProvisionStatus.UNDER_PROVISIONED).numBrokers(clusterModel.maxReplicationFactor()).build();<NEW_LINE>throw new OptimizationFailureException(String.format("[%s] All alive brokers are excluded from replica moves.", name()), recommendation);<NEW_LINE>}<NEW_LINE>_meanLeaderBytesIn = 0.0;<NEW_LINE>_overLimitBrokerIds = new HashSet<>();<NEW_LINE>// Sort leader replicas for each broker.<NEW_LINE>Set<String<MASK><NEW_LINE>new SortedReplicasHelper().addSelectionFunc(ReplicaSortFunctionFactory.selectLeaders()).maybeAddSelectionFunc(ReplicaSortFunctionFactory.selectReplicasBasedOnExcludedTopics(excludedTopics), !excludedTopics.isEmpty()).setScoreFunc(ReplicaSortFunctionFactory.reverseSortByMetricGroupValue(Resource.NW_IN.toString())).trackSortedReplicasFor(replicaSortName(this, true, true), clusterModel);<NEW_LINE>} | > excludedTopics = optimizationOptions.excludedTopics(); |
829,878 | String parseString() throws IOException {<NEW_LINE>final String dataString;<NEW_LINE>int totalLength = 0;<NEW_LINE>byte partialLength = stream.readByte();<NEW_LINE>int numBytes = 0;<NEW_LINE>while ((partialLength & 0x80) > 0) {<NEW_LINE>totalLength += (partialLength & 0x7F) << (7 * numBytes);<NEW_LINE>partialLength = stream.readByte();<NEW_LINE>numBytes += 1;<NEW_LINE>}<NEW_LINE>totalLength += partialLength << (7 * numBytes);<NEW_LINE>if (totalLength != 0) {<NEW_LINE>final byte[<MASK><NEW_LINE>final int bytesRead = stream.read(stringBytes);<NEW_LINE>if (bytesRead != stringBytes.length) {<NEW_LINE>throw new IOException("Did not fully read string. Read " + bytesRead + " out of " + stringBytes.length + ".");<NEW_LINE>}<NEW_LINE>dataString = new String(byteArrayToCharArray(stringBytes));<NEW_LINE>} else {<NEW_LINE>dataString = "";<NEW_LINE>}<NEW_LINE>return dataString;<NEW_LINE>} | ] stringBytes = new byte[totalLength]; |
1,822,417 | private void compareAndWriteQuota(String bundle, ResourceQuota oldQuota, ResourceQuota newQuota) throws Exception {<NEW_LINE>boolean needUpdate = true;<NEW_LINE>if (!oldQuota.getDynamic() || (Math.abs(newQuota.getMsgRateIn() - oldQuota.getMsgRateIn()) < RESOURCE_QUOTA_MIN_MSGRATE_IN && Math.abs(newQuota.getMsgRateOut() - oldQuota.getMsgRateOut()) < RESOURCE_QUOTA_MIN_MSGRATE_OUT && Math.abs(newQuota.getBandwidthIn() - oldQuota.getBandwidthOut()) < RESOURCE_QUOTA_MIN_BANDWIDTH_IN && Math.abs(newQuota.getBandwidthOut() - oldQuota.getBandwidthOut()) < RESOURCE_QUOTA_MIN_BANDWIDTH_OUT && Math.abs(newQuota.getMemory() - oldQuota.getMemory()) < RESOURCE_QUOTA_MIN_MEMORY)) {<NEW_LINE>needUpdate = false;<NEW_LINE>}<NEW_LINE>if (needUpdate) {<NEW_LINE>log.info(String.format("Update quota %s - msgRateIn: %.1f, msgRateOut: %.1f, bandwidthIn: %.1f," + " bandwidthOut: %.1f, memory: %.1f", (bundle == null) ? "default" : bundle, newQuota.getMsgRateIn(), newQuota.getMsgRateOut(), newQuota.getBandwidthIn(), newQuota.getBandwidthOut(), newQuota.getMemory()));<NEW_LINE>if (bundle == null) {<NEW_LINE>pulsar.getBrokerService().getBundlesQuotas().setDefaultResourceQuota(newQuota).join();<NEW_LINE>} else {<NEW_LINE>pulsar.getBrokerService().getBundlesQuotas().setResourceQuota(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | bundle, newQuota).join(); |
514,496 | public StandardResponseDocument saveLocation(LocationDocument req) throws XFireFault {<NEW_LINE>authenticate(webServiceName, "saveLocation");<NEW_LINE>StandardResponseDocument ret = StandardResponseDocument.Factory.newInstance();<NEW_LINE>StandardResponse resp = ret.addNewStandardResponse();<NEW_LINE>Location rloc = req.getLocation();<NEW_LINE>MLocation location = new MLocation(m_cs.getM_ctx(), rloc.getCLocationID(), null);<NEW_LINE>// log.fine("doPost updating C_Location_ID=" + C_Location_ID + " - " + targetBase);<NEW_LINE>location.setAddress1(rloc.getAddress1());<NEW_LINE>location.setAddress2(rloc.getAddress2());<NEW_LINE>location.setCity(rloc.getCity());<NEW_LINE>location.setPostal(rloc.getPostalCode());<NEW_LINE>location.<MASK><NEW_LINE>location.setC_Region_ID(rloc.getCRegionID());<NEW_LINE>// Save Location<NEW_LINE>location.save();<NEW_LINE>resp.setRecordID(location.getC_Location_ID());<NEW_LINE>return ret;<NEW_LINE>} | setC_Country_ID(rloc.getCCountryID()); |
1,478,211 | public static Application toV4Application(final com.netflix.genie.common.dto.Application v3Application) throws IllegalArgumentException {<NEW_LINE>final ApplicationMetadata.Builder metadataBuilder = new ApplicationMetadata.Builder(v3Application.getName(), v3Application.getUser(), v3Application.getVersion(), toV4ApplicationStatus(v3Application.getStatus())).withTags(toV4Tags(v3Application.getTags()));<NEW_LINE>v3Application.getMetadata().ifPresent(metadataBuilder::withMetadata);<NEW_LINE>v3Application.getType(<MASK><NEW_LINE>v3Application.getDescription().ifPresent(metadataBuilder::withDescription);<NEW_LINE>return new Application(v3Application.getId().orElseThrow(IllegalArgumentException::new), v3Application.getCreated().orElse(Instant.now()), v3Application.getUpdated().orElse(Instant.now()), new ExecutionEnvironment(v3Application.getConfigs(), v3Application.getDependencies(), v3Application.getSetupFile().orElse(null)), metadataBuilder.build());<NEW_LINE>} | ).ifPresent(metadataBuilder::withType); |
933,645 | protected Object decode(Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {<NEW_LINE>String sentence = (String) msg;<NEW_LINE>if (sentence.equals("AA55,HB")) {<NEW_LINE>if (channel != null) {<NEW_LINE>channel.writeAndFlush(new NetworkMessage("55AA,HB,OK\r\n", remoteAddress));<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Parser parser = new Parser(PATTERN, (String) msg);<NEW_LINE>if (!parser.matches()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next());<NEW_LINE>if (deviceSession == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Position position = new Position(getProtocolName());<NEW_LINE>position.setDeviceId(deviceSession.getDeviceId());<NEW_LINE>position.setValid(true);<NEW_LINE>position.<MASK><NEW_LINE>position.setLatitude(parser.nextDouble());<NEW_LINE>position.setLongitude(parser.nextDouble());<NEW_LINE>position.setAltitude(parser.nextDouble(0));<NEW_LINE>position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble(0)));<NEW_LINE>position.setCourse(parser.nextDouble(0));<NEW_LINE>position.set(Position.KEY_INPUT, parser.nextBinInt());<NEW_LINE>position.set(Position.KEY_OUTPUT, parser.nextBinInt());<NEW_LINE>position.set(Position.KEY_BATTERY, parser.nextInt() * 0.001);<NEW_LINE>position.set(Position.PREFIX_ADC + 1, parser.nextInt() * 0.001);<NEW_LINE>position.set(Position.PREFIX_ADC + 2, parser.nextInt() * 0.001);<NEW_LINE>position.set(Position.KEY_DRIVER_UNIQUE_ID, parser.next());<NEW_LINE>return position;<NEW_LINE>} | setTime(parser.nextDateTime()); |
266,307 | public static PasswdRuleConfig parse(JSONObject config) {<NEW_LINE>Short min = config.getShort("min");<NEW_LINE>Short max = config.getShort("max");<NEW_LINE>Short letter = config.getShort("letter");<NEW_LINE>Short digit = config.getShort("digit");<NEW_LINE>Short upperCase = config.getShort("upperCase");<NEW_LINE>Short lowerCase = config.getShort("lowerCase");<NEW_LINE>Short specialChar = config.getShort("special");<NEW_LINE>final int minLength = (min != null) ? min.intValue() : 6;<NEW_LINE>final int maxLength = (max != null) ? max.intValue() : 20;<NEW_LINE>final int minLetter = (letter != null) ? letter.intValue() : 0;<NEW_LINE>final int minDigit = (digit != null) ? digit.intValue() : 0;<NEW_LINE>final int upperLetter = (upperCase != null) ? upperCase.intValue() : 0;<NEW_LINE>final int lowerLetter = (lowerCase != null) ? lowerCase.intValue() : 0;<NEW_LINE>if (minLength < 0) {<NEW_LINE>throw new IllegalArgumentException("Invalid password rule config: min = " + minLength);<NEW_LINE>}<NEW_LINE>if (maxLength < minLength) {<NEW_LINE>throw new IllegalArgumentException("Invalid password rule config: min = " + minLength + ", max = " + maxLength);<NEW_LINE>}<NEW_LINE>if (minLetter < 0) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (minDigit < 0) {<NEW_LINE>throw new IllegalArgumentException("Invalid password rule config: digit = " + minDigit);<NEW_LINE>}<NEW_LINE>if (upperLetter < 0) {<NEW_LINE>throw new IllegalArgumentException("Invalid password rule config: upperCase = " + upperLetter);<NEW_LINE>}<NEW_LINE>if (lowerLetter < 0) {<NEW_LINE>throw new IllegalArgumentException("Invalid password rule config: lowerCase = " + lowerLetter);<NEW_LINE>}<NEW_LINE>return new PasswdRuleConfig(minLength, maxLength, upperLetter, lowerLetter, minLetter, minDigit, specialChar);<NEW_LINE>} | throw new IllegalArgumentException("Invalid password rule config: letter = " + minLetter); |
596,041 | public void init() throws TaskInitException {<NEW_LINE>super.init();<NEW_LINE>if (Util.isNullOrNil(config.getApkPath())) {<NEW_LINE>throw new TaskInitException(TAG + "---APK-FILE-PATH can not be null!");<NEW_LINE>}<NEW_LINE>Log.i(TAG, "inputPath:%s", config.getApkPath());<NEW_LINE>inputFile = new File(config.getApkPath());<NEW_LINE>if (!inputFile.exists()) {<NEW_LINE>throw new TaskInitException(TAG + "---'" + <MASK><NEW_LINE>}<NEW_LINE>if (Util.isNullOrNil(config.getUnzipPath())) {<NEW_LINE>throw new TaskInitException(TAG + "---APK-UNZIP-PATH can not be null!");<NEW_LINE>}<NEW_LINE>Log.i(TAG, "outputPath:%s", config.getUnzipPath());<NEW_LINE>outputFile = new File(config.getUnzipPath());<NEW_LINE>if (!Util.isNullOrNil(config.getMappingFilePath())) {<NEW_LINE>mappingTxt = new File(config.getMappingFilePath());<NEW_LINE>if (!FileUtil.isLegalFile(mappingTxt)) {<NEW_LINE>throw new TaskInitException(TAG + "---mapping file " + config.getMappingFilePath() + " is not legal!");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!Util.isNullOrNil(config.getResMappingFilePath())) {<NEW_LINE>resMappingTxt = new File(config.getResMappingFilePath());<NEW_LINE>if (!FileUtil.isLegalFile(resMappingTxt)) {<NEW_LINE>throw new TaskInitException(TAG + "---resguard mapping file " + config.getResMappingFilePath() + " is not legal!");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | config.getApkPath() + "' is not exist!"); |
1,757,099 | private void outputAllRowsPerMatch(PageBuilder pageBuilder, MatchResult matchResult, int searchStart, int searchEnd) {<NEW_LINE>// window functions are not allowed with ALL ROWS PER MATCH<NEW_LINE>checkState(windowFunctions.isEmpty(), "invalid node: window functions specified with ALL ROWS PER MATCH");<NEW_LINE>ArrayView labels = matchResult.getLabels();<NEW_LINE>ArrayView exclusions = matchResult.getExclusions();<NEW_LINE>int start = 0;<NEW_LINE>for (int index = 0; index < exclusions.length(); index += 2) {<NEW_LINE>int end = exclusions.get(index);<NEW_LINE>for (int i = start; i < end; i++) {<NEW_LINE>outputRow(pageBuilder, labels, currentPosition + i, searchStart, searchEnd);<NEW_LINE>}<NEW_LINE>start = <MASK><NEW_LINE>}<NEW_LINE>for (int i = start; i < labels.length(); i++) {<NEW_LINE>outputRow(pageBuilder, labels, currentPosition + i, searchStart, searchEnd);<NEW_LINE>}<NEW_LINE>} | exclusions.get(index + 1); |
1,730,605 | private String runProcess(final ProcessInfo pi) throws Exception {<NEW_LINE>log.debug("Run process: {}", pi);<NEW_LINE>final ProcessExecutionResult result = // .switchContextWhenRunning() // NOTE: not needed, context was already switched in caller method<NEW_LINE>ProcessExecutor.builder(pi).executeSync().getResult();<NEW_LINE>final boolean ok = !result.isError();<NEW_LINE>// notify supervisor if error<NEW_LINE>// metas: c.ghita@metas.ro: start<NEW_LINE>final int adPInstanceTableId = Services.get(IADTableDAO.class).retrieveTableId(I_AD_PInstance.Table_Name);<NEW_LINE>notify(ok, pi.getTitle(), result.getSummary(), result.getLogInfo(), adPInstanceTableId, PInstanceId.toRepoId<MASK><NEW_LINE>// metas: c.ghita@metas.ro: end<NEW_LINE>// stored it, so we can persist it in the scheduler log<NEW_LINE>m_success = ok;<NEW_LINE>return result.getSummary();<NEW_LINE>} | (result.getPinstanceId())); |
978,167 | public void underlineText(int color, float width, AnnotationType type) {<NEW_LINE>if (ctr == null || ctr.getDocumentController() == null || ctr.getDocumentModel() == null) {<NEW_LINE>LOG.d("Can't underlineText");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final int first = ctr.getDocumentController().getFirstVisiblePage();<NEW_LINE>final int last = ctr.getDocumentController().getLastVisiblePage();<NEW_LINE>for (int i = first; i < last + 1; i++) {<NEW_LINE>final Page page = ctr.getDocumentModel().getPageByDocIndex(i);<NEW_LINE>if (page == null || page.selectedText == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>List<TextWord> texts = page.selectedText;<NEW_LINE>final ArrayList<PointF> quadPoints = new ArrayList<PointF>();<NEW_LINE>for (TextWord text : texts) {<NEW_LINE>RectF rect = text.getOriginal();<NEW_LINE>quadPoints.add(new PointF(rect.left, rect.bottom));<NEW_LINE>quadPoints.add(new PointF(rect.right, rect.bottom));<NEW_LINE>quadPoints.add(new PointF(rect<MASK><NEW_LINE>quadPoints.add(new PointF(rect.left, rect.top));<NEW_LINE>}<NEW_LINE>PointF[] array = quadPoints.toArray(new PointF[quadPoints.size()]);<NEW_LINE>ctr.getDecodeService().underlineText(i, array, color, type, new ResultResponse<List<Annotation>>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean onResultRecive(List<Annotation> arg0) {<NEW_LINE>page.annotations = arg0;<NEW_LINE>page.selectedText = new ArrayList<TextWord>();<NEW_LINE>ctr.getDocumentController().toggleRenderingEffects();<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | .right, rect.top)); |
555,070 | public void marshall(JournalKinesisStreamDescription journalKinesisStreamDescription, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (journalKinesisStreamDescription == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(journalKinesisStreamDescription.getLedgerName(), LEDGERNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(journalKinesisStreamDescription.getCreationTime(), CREATIONTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(journalKinesisStreamDescription.getInclusiveStartTime(), INCLUSIVESTARTTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(journalKinesisStreamDescription.getRoleArn(), ROLEARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(journalKinesisStreamDescription.getStreamId(), STREAMID_BINDING);<NEW_LINE>protocolMarshaller.marshall(journalKinesisStreamDescription.getArn(), ARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(journalKinesisStreamDescription.getStatus(), STATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(journalKinesisStreamDescription.getKinesisConfiguration(), KINESISCONFIGURATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(journalKinesisStreamDescription.getErrorCause(), ERRORCAUSE_BINDING);<NEW_LINE>protocolMarshaller.marshall(journalKinesisStreamDescription.getStreamName(), STREAMNAME_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | journalKinesisStreamDescription.getExclusiveEndTime(), EXCLUSIVEENDTIME_BINDING); |
1,048,482 | public static void validateGsiColumns(String schemaName, String sourceTableName, boolean isSingle, boolean isBroadcast, SqlNode dbPartitionBy, SqlNode tablePartitionBy, ExecutionContext executionContext) {<NEW_LINE>List<TableMeta> gsiTableMeta = GlobalIndexMeta.getIndex(sourceTableName, schemaName, IndexStatus.ALL, executionContext);<NEW_LINE>if (CollectionUtils.isNotEmpty(gsiTableMeta)) {<NEW_LINE>Set<String> expectedPkSkList = getExpectedPrimaryAndShardingKeys(schemaName, sourceTableName, isSingle, isBroadcast, dbPartitionBy, tablePartitionBy);<NEW_LINE>for (TableMeta tableMeta : gsiTableMeta) {<NEW_LINE>if (!GlobalIndexMeta.isPublished(executionContext, tableMeta)) {<NEW_LINE>String errMsg = "Please make sure all the Global Indexes are public";<NEW_LINE>LOGGER.warn(errMsg);<NEW_LINE>throw new TddlRuntimeException(ERR_PARTITION_WITH_NON_PUBLIC_GSI, errMsg);<NEW_LINE>}<NEW_LINE>Set<String> gsiColumnNameSet = tableMeta.getAllColumns().stream().map(e -> e.getName().toLowerCase()).collect(Collectors.toSet());<NEW_LINE>if (!CollectionUtils.isSubCollection(expectedPkSkList, gsiColumnNameSet)) {<NEW_LINE>String columnsThatGsiMustHave = String.join(",", expectedPkSkList);<NEW_LINE>String errMsg = String.format("Please make sure all the Global Indexes contain column: [%s]", columnsThatGsiMustHave);<NEW_LINE>LOGGER.warn(errMsg);<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | TddlRuntimeException(ErrorCode.ERR_PARTITION_GSI_MISSING_COLUMN, errMsg); |
624,343 | public static void execute(ManagerConnection c) {<NEW_LINE>ByteBufferHolder buffer = c.allocate();<NEW_LINE>IPacketOutputProxy proxy = PacketOutputProxyFactory.getInstance().createProxy(c, buffer);<NEW_LINE>proxy.packetBegin();<NEW_LINE>// write header<NEW_LINE>proxy = header.write(proxy);<NEW_LINE>// write fields<NEW_LINE>for (FieldPacket field : fields) {<NEW_LINE>proxy = field.write(proxy);<NEW_LINE>}<NEW_LINE>// write eof<NEW_LINE>proxy = eof.write(proxy);<NEW_LINE>// write rows<NEW_LINE>byte packetId = eof.packetId;<NEW_LINE>for (SchemaConfig schema : CobarServer.getInstance().getConfig().getSchemas().values()) {<NEW_LINE>if (!schema.getDataSource().isInited()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>RowDataPacket row = getRow(schema.getDataSource(), c.getCharset());<NEW_LINE>row.packetId = ++packetId;<NEW_LINE>proxy = row.write(proxy);<NEW_LINE>}<NEW_LINE>// write last eof<NEW_LINE>EOFPacket lastEof = new EOFPacket();<NEW_LINE>lastEof.packetId = ++packetId;<NEW_LINE><MASK><NEW_LINE>// write buffer<NEW_LINE>proxy.packetEnd();<NEW_LINE>} | proxy = lastEof.write(proxy); |
1,748,478 | private List<ValidationEvent> validateResource(Model model, ResourceShape resource) {<NEW_LINE>List<ValidationEvent> events = new ArrayList<>();<NEW_LINE>// Note: Whether or not these use a valid bindings is validated in ResourceIdentifierBindingValidator.<NEW_LINE>resource.getPut().flatMap(model::getShape).flatMap(Shape::asOperationShape).ifPresent(operation -> {<NEW_LINE>validateReadonly(resource, operation, "put", false).ifPresent(events::add);<NEW_LINE>validateIdempotent(resource, operation, "put", "").ifPresent(events::add);<NEW_LINE>});<NEW_LINE>resource.getCreate().flatMap(model::getShape).flatMap(Shape::asOperationShape).ifPresent(operation -> {<NEW_LINE>validateReadonly(resource, operation, "create", false).ifPresent(events::add);<NEW_LINE>});<NEW_LINE>resource.getRead().flatMap(model::getShape).flatMap(Shape::asOperationShape).ifPresent(operation -> {<NEW_LINE>validateReadonly(resource, operation, "read", true).ifPresent(events::add);<NEW_LINE>});<NEW_LINE>resource.getUpdate().flatMap(model::getShape).flatMap(Shape::asOperationShape).ifPresent(operation -> {<NEW_LINE>validateReadonly(resource, operation, "update", false).ifPresent(events::add);<NEW_LINE>});<NEW_LINE>resource.getDelete().flatMap(model::getShape).flatMap(Shape::asOperationShape).ifPresent(operation -> {<NEW_LINE>validateReadonly(resource, operation, "delete", false<MASK><NEW_LINE>validateIdempotent(resource, operation, "delete", "").ifPresent(events::add);<NEW_LINE>});<NEW_LINE>resource.getList().flatMap(model::getShape).flatMap(Shape::asOperationShape).ifPresent(operation -> {<NEW_LINE>validateReadonly(resource, operation, "list", true).ifPresent(events::add);<NEW_LINE>});<NEW_LINE>return events;<NEW_LINE>} | ).ifPresent(events::add); |
275,091 | private static void sub(final int[] result, final int[] x, final int[] y) {<NEW_LINE>int index;<NEW_LINE>int borrow;<NEW_LINE>// Subtract y from x to generate the intermediate result.<NEW_LINE>borrow = 0;<NEW_LINE>for (index = 0; index < NUM_LIMBS_255BIT; ++index) {<NEW_LINE>borrow = x[index] - y[index] - ((borrow >> 26) & 0x01);<NEW_LINE>result[index] = borrow & 0x03FFFFFF;<NEW_LINE>}<NEW_LINE>// If we had a borrow, then the result has gone negative and we<NEW_LINE>// have to add 2^255 - 19 to the result to make it positive again.<NEW_LINE>// The top bits of "borrow" will be all 1's if there is a borrow<NEW_LINE>// or it will be all 0's if there was no borrow. Easiest is to<NEW_LINE>// conditionally subtract 19 and then mask off the high bits.<NEW_LINE>borrow = result[0] - ((-((borrow >> 26<MASK><NEW_LINE>result[0] = borrow & 0x03FFFFFF;<NEW_LINE>for (index = 1; index < NUM_LIMBS_255BIT; ++index) {<NEW_LINE>borrow = result[index] - ((borrow >> 26) & 0x01);<NEW_LINE>result[index] = borrow & 0x03FFFFFF;<NEW_LINE>}<NEW_LINE>result[NUM_LIMBS_255BIT - 1] &= 0x001FFFFF;<NEW_LINE>} | ) & 0x01)) & 19); |
525,637 | public void onScrolled(@NonNull final RecyclerView rv, final int dx, final int dy) {<NEW_LINE>boolean currentlyAtBottom = !rv.canScrollVertically(1);<NEW_LINE>boolean currentlyAtZoomScrollHeight = isAtZoomScrollHeight();<NEW_LINE>int positionId = getHeaderPositionId();<NEW_LINE>if (currentlyAtBottom && !wasAtBottom) {<NEW_LINE>ViewUtil.fadeOut(<MASK><NEW_LINE>} else if (!currentlyAtBottom && wasAtBottom) {<NEW_LINE>ViewUtil.fadeIn(composeDivider, 500);<NEW_LINE>}<NEW_LINE>if (currentlyAtBottom) {<NEW_LINE>conversationViewModel.setShowScrollButtons(false);<NEW_LINE>} else if (currentlyAtZoomScrollHeight) {<NEW_LINE>conversationViewModel.setShowScrollButtons(true);<NEW_LINE>}<NEW_LINE>if (positionId != lastPositionId) {<NEW_LINE>bindScrollHeader(conversationDateHeader, positionId);<NEW_LINE>}<NEW_LINE>wasAtBottom = currentlyAtBottom;<NEW_LINE>lastPositionId = positionId;<NEW_LINE>postMarkAsReadRequest();<NEW_LINE>} | composeDivider, 50, View.INVISIBLE); |
988,006 | private void addOrUpdateClickHouseSinkFunction(DataFlowInfo dataFlowInfo) throws Exception {<NEW_LINE>long dataFlowId = dataFlowInfo.getId();<NEW_LINE>SinkInfo sinkInfo = dataFlowInfo.getSinkInfo();<NEW_LINE>if (!(sinkInfo instanceof ClickHouseSinkInfo)) {<NEW_LINE>LOG.error("SinkInfo type {} of dataFlow {} doesn't match application sink type 'clickhouse'!", sinkInfo.getClass(), dataFlowId);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ClickHouseSinkInfo clickHouseSinkInfo = (ClickHouseSinkInfo) sinkInfo;<NEW_LINE>ClickHouseSinkFunction clickHouseSinkFunction = new ClickHouseSinkFunction(clickHouseSinkInfo);<NEW_LINE><MASK><NEW_LINE>clickHouseSinkFunction.open(new org.apache.flink.configuration.Configuration());<NEW_LINE>// Close the old one if exist<NEW_LINE>ClickHouseSinkFunction oldClickHouseSinkFunction = clickHouseSinkFunctionMap.put(dataFlowId, clickHouseSinkFunction);<NEW_LINE>if (oldClickHouseSinkFunction != null) {<NEW_LINE>oldClickHouseSinkFunction.close();<NEW_LINE>}<NEW_LINE>} | clickHouseSinkFunction.setRuntimeContext(getRuntimeContext()); |
539,737 | public void visitToken(DetailAST ast) {<NEW_LINE>if (isInTypeBlock(ast)) {<NEW_LINE>final DetailAST modifiers = <MASK><NEW_LINE>switch(ast.getType()) {<NEW_LINE>case TokenTypes.ENUM_DEF:<NEW_LINE>if (violateImpliedStaticOnNestedEnum && modifiers.findFirstToken(TokenTypes.LITERAL_STATIC) == null) {<NEW_LINE>log(ast, MSG_KEY, STATIC_KEYWORD);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case TokenTypes.INTERFACE_DEF:<NEW_LINE>if (violateImpliedStaticOnNestedInterface && modifiers.findFirstToken(TokenTypes.LITERAL_STATIC) == null) {<NEW_LINE>log(ast, MSG_KEY, STATIC_KEYWORD);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case TokenTypes.RECORD_DEF:<NEW_LINE>if (violateImpliedStaticOnNestedRecord && modifiers.findFirstToken(TokenTypes.LITERAL_STATIC) == null) {<NEW_LINE>log(ast, MSG_KEY, STATIC_KEYWORD);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new IllegalStateException(ast.toString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ast.findFirstToken(TokenTypes.MODIFIERS); |
619,863 | public void announceSegments(Iterable<DataSegment> segments) throws IOException {<NEW_LINE>SegmentZNode segmentZNode = new SegmentZNode(makeServedSegmentPath());<NEW_LINE>Set<DataSegment> <MASK><NEW_LINE>List<DataSegmentChangeRequest> changesBatch = new ArrayList<>();<NEW_LINE>int byteSize = 0;<NEW_LINE>int count = 0;<NEW_LINE>synchronized (lock) {<NEW_LINE>for (DataSegment ds : segments) {<NEW_LINE>if (segmentLookup.containsKey(ds)) {<NEW_LINE>log.info("Skipping announcement of segment [%s]. Announcement exists already.", ds.getId());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>DataSegment segment = segmentTransformer.apply(ds);<NEW_LINE>changesBatch.add(new SegmentChangeRequestLoad(segment));<NEW_LINE>if (isSkipSegmentAnnouncementOnZk) {<NEW_LINE>segmentLookup.put(segment, dummyZnode);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>int newBytesLen = jsonMapper.writeValueAsBytes(segment).length;<NEW_LINE>if (newBytesLen > config.getMaxBytesPerNode()) {<NEW_LINE>throw new ISE("byte size %,d exceeds %,d", newBytesLen, config.getMaxBytesPerNode());<NEW_LINE>}<NEW_LINE>if (count >= config.getSegmentsPerNode() || byteSize + newBytesLen > config.getMaxBytesPerNode()) {<NEW_LINE>segmentZNode.addSegments(batch);<NEW_LINE>announcer.announce(segmentZNode.getPath(), segmentZNode.getBytes());<NEW_LINE>segmentZNode = new SegmentZNode(makeServedSegmentPath());<NEW_LINE>batch = new HashSet<>();<NEW_LINE>count = 0;<NEW_LINE>byteSize = 0;<NEW_LINE>}<NEW_LINE>log.info("Announcing segment[%s] at path[%s]", segment.getId(), segmentZNode.getPath());<NEW_LINE>segmentLookup.put(segment, segmentZNode);<NEW_LINE>batch.add(segment);<NEW_LINE>count++;<NEW_LINE>byteSize += newBytesLen;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>changes.addChangeRequests(changesBatch);<NEW_LINE>if (!isSkipSegmentAnnouncementOnZk) {<NEW_LINE>segmentZNode.addSegments(batch);<NEW_LINE>announcer.announce(segmentZNode.getPath(), segmentZNode.getBytes());<NEW_LINE>}<NEW_LINE>} | batch = new HashSet<>(); |
642,787 | public RelNode visit(QueryOperation other) {<NEW_LINE>if (other instanceof PlannerQueryOperation) {<NEW_LINE>return ((PlannerQueryOperation) other).getCalciteTree();<NEW_LINE>} else if (other instanceof DataStreamQueryOperation) {<NEW_LINE>return convertToDataStreamScan((DataStreamQueryOperation<?>) other);<NEW_LINE>} else if (other instanceof JavaDataStreamQueryOperation) {<NEW_LINE>JavaDataStreamQueryOperation<?> dataStreamQueryOperation <MASK><NEW_LINE>return convertToDataStreamScan(dataStreamQueryOperation.getDataStream(), dataStreamQueryOperation.getFieldIndices(), dataStreamQueryOperation.getTableSchema(), dataStreamQueryOperation.getIdentifier());<NEW_LINE>} else if (other instanceof ScalaDataStreamQueryOperation) {<NEW_LINE>ScalaDataStreamQueryOperation dataStreamQueryOperation = (ScalaDataStreamQueryOperation<?>) other;<NEW_LINE>return convertToDataStreamScan(dataStreamQueryOperation.getDataStream(), dataStreamQueryOperation.getFieldIndices(), dataStreamQueryOperation.getTableSchema(), dataStreamQueryOperation.getIdentifier());<NEW_LINE>}<NEW_LINE>throw new TableException("Unknown table operation: " + other);<NEW_LINE>} | = (JavaDataStreamQueryOperation<?>) other; |
486,301 | public static QueryDeviceResponse unmarshall(QueryDeviceResponse queryDeviceResponse, UnmarshallerContext _ctx) {<NEW_LINE>queryDeviceResponse.setRequestId<MASK><NEW_LINE>queryDeviceResponse.setSuccess(_ctx.booleanValue("QueryDeviceResponse.Success"));<NEW_LINE>queryDeviceResponse.setCode(_ctx.stringValue("QueryDeviceResponse.Code"));<NEW_LINE>queryDeviceResponse.setErrorMessage(_ctx.stringValue("QueryDeviceResponse.ErrorMessage"));<NEW_LINE>queryDeviceResponse.setTotal(_ctx.integerValue("QueryDeviceResponse.Total"));<NEW_LINE>queryDeviceResponse.setPageSize(_ctx.integerValue("QueryDeviceResponse.PageSize"));<NEW_LINE>queryDeviceResponse.setPageCount(_ctx.integerValue("QueryDeviceResponse.PageCount"));<NEW_LINE>queryDeviceResponse.setPage(_ctx.integerValue("QueryDeviceResponse.Page"));<NEW_LINE>queryDeviceResponse.setNextToken(_ctx.stringValue("QueryDeviceResponse.NextToken"));<NEW_LINE>List<DeviceInfo> data = new ArrayList<DeviceInfo>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("QueryDeviceResponse.Data.Length"); i++) {<NEW_LINE>DeviceInfo deviceInfo = new DeviceInfo();<NEW_LINE>deviceInfo.setDeviceId(_ctx.stringValue("QueryDeviceResponse.Data[" + i + "].DeviceId"));<NEW_LINE>deviceInfo.setDeviceSecret(_ctx.stringValue("QueryDeviceResponse.Data[" + i + "].DeviceSecret"));<NEW_LINE>deviceInfo.setProductKey(_ctx.stringValue("QueryDeviceResponse.Data[" + i + "].ProductKey"));<NEW_LINE>deviceInfo.setDeviceStatus(_ctx.stringValue("QueryDeviceResponse.Data[" + i + "].DeviceStatus"));<NEW_LINE>deviceInfo.setDeviceName(_ctx.stringValue("QueryDeviceResponse.Data[" + i + "].DeviceName"));<NEW_LINE>deviceInfo.setDeviceType(_ctx.stringValue("QueryDeviceResponse.Data[" + i + "].DeviceType"));<NEW_LINE>deviceInfo.setGmtCreate(_ctx.stringValue("QueryDeviceResponse.Data[" + i + "].GmtCreate"));<NEW_LINE>deviceInfo.setGmtModified(_ctx.stringValue("QueryDeviceResponse.Data[" + i + "].GmtModified"));<NEW_LINE>deviceInfo.setUtcCreate(_ctx.stringValue("QueryDeviceResponse.Data[" + i + "].UtcCreate"));<NEW_LINE>deviceInfo.setUtcModified(_ctx.stringValue("QueryDeviceResponse.Data[" + i + "].UtcModified"));<NEW_LINE>deviceInfo.setIotId(_ctx.stringValue("QueryDeviceResponse.Data[" + i + "].IotId"));<NEW_LINE>deviceInfo.setNickname(_ctx.stringValue("QueryDeviceResponse.Data[" + i + "].Nickname"));<NEW_LINE>data.add(deviceInfo);<NEW_LINE>}<NEW_LINE>queryDeviceResponse.setData(data);<NEW_LINE>return queryDeviceResponse;<NEW_LINE>} | (_ctx.stringValue("QueryDeviceResponse.RequestId")); |
486,908 | private boolean performVersionCheck(final MetaModel meta, final Component component) {<NEW_LINE>final UnirestInstance ui = UnirestFactory.getUnirestInstance();<NEW_LINE>final String url = String.format(baseUrl + VERSION_QUERY_URL, component.getPurl().getName().toLowerCase());<NEW_LINE>try {<NEW_LINE>final HttpResponse<JsonNode> response = ui.get(url).header(<MASK><NEW_LINE>if (response.getStatus() == 200) {<NEW_LINE>if (response.getBody() != null && response.getBody().getObject() != null) {<NEW_LINE>final JSONArray versions = response.getBody().getObject().getJSONArray("versions");<NEW_LINE>// get the last version in the array<NEW_LINE>final String latest = versions.getString(versions.length() - 1);<NEW_LINE>meta.setLatestVersion(latest);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>handleUnexpectedHttpResponse(LOGGER, url, response.getStatus(), response.getStatusText(), component);<NEW_LINE>}<NEW_LINE>} catch (UnirestException e) {<NEW_LINE>handleRequestException(LOGGER, e);<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | "accept", "application/json").asJson(); |
718,290 | public void derivByGaussGausThenDeriv() {<NEW_LINE>System.out.println("Dx*(G*(G*I))");<NEW_LINE>ImageGradient<T, T> funcDeriv = FactoryDerivative.three(imageType, imageType);<NEW_LINE>T blur = GeneralizedImageOps.createSingleBand(imageType, width, height);<NEW_LINE>T blur2 = GeneralizedImageOps.createSingleBand(imageType, width, height);<NEW_LINE>T blurDeriv = GeneralizedImageOps.<MASK><NEW_LINE>for (int sigma = 1; sigma <= 3; sigma++) {<NEW_LINE>BlurStorageFilter<T> funcBlur = FactoryBlurFilter.gaussian(ImageType.single(imageType), sigma, -1);<NEW_LINE>funcBlur.process(input, blur);<NEW_LINE>funcBlur.process(blur, blur2);<NEW_LINE>funcDeriv.process(blur2, blurDeriv, derivY);<NEW_LINE>printIntensity("Sigma " + sigma, blurDeriv);<NEW_LINE>}<NEW_LINE>} | createSingleBand(imageType, width, height); |
997,405 | public static boolean verifySignature(InputStream imgIn, X509Certificate cert) {<NEW_LINE>try {<NEW_LINE>// Read the header for size<NEW_LINE>byte[] hdr = new byte[BOOT_IMAGE_HEADER_SIZE_MAXIMUM];<NEW_LINE>if (fullRead(imgIn, hdr) != hdr.length) {<NEW_LINE>System.err.println("Unable to read image header");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>int signableSize = getSignableImageSize(hdr);<NEW_LINE>// Read the rest of the image<NEW_LINE>byte[] rawImg = Arrays.copyOf(hdr, signableSize);<NEW_LINE>int remain = signableSize - hdr.length;<NEW_LINE>if (fullRead(imgIn, rawImg, hdr.length, remain) != remain) {<NEW_LINE>System.err.println("Unable to read image");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// Read footer, which contains the signature<NEW_LINE>byte[] signature = new byte[4096];<NEW_LINE>if (imgIn.read(signature) == -1 || Arrays.equals(signature, new byte[signature.length])) {<NEW_LINE>System.err.println("Invalid image: not signed");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>BootSignature bootsig = new BootSignature(signature);<NEW_LINE>if (cert != null) {<NEW_LINE>bootsig.setCertificate(cert);<NEW_LINE>}<NEW_LINE>if (bootsig.verify(rawImg, signableSize)) {<NEW_LINE><MASK><NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>System.err.println("Signature is INVALID");<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | System.err.println("Signature is VALID"); |
183,486 | private void resetBinaryColumn(int i, ResultSetMetaData md, int bufferSize, TColumn col) throws SQLException {<NEW_LINE>col.nulls.clear();<NEW_LINE>switch(md.getColumnType(i)) {<NEW_LINE>case java.sql.Types.TINYINT:<NEW_LINE>case java.sql.Types.SMALLINT:<NEW_LINE>case java.sql.Types.INTEGER:<NEW_LINE>case java.sql.Types.BIGINT:<NEW_LINE>case java.sql.Types.TIME:<NEW_LINE>case java.sql.Types.TIMESTAMP:<NEW_LINE>case // deal with postgress treating boolean as bit... this will bite me<NEW_LINE>java.sql.Types.BIT:<NEW_LINE>case java.sql.Types.BOOLEAN:<NEW_LINE>case java.sql.Types.DATE:<NEW_LINE>case java.sql.Types.DECIMAL:<NEW_LINE>case java.sql.Types.NUMERIC:<NEW_LINE>col.data.int_col.clear();<NEW_LINE>break;<NEW_LINE>case java.sql.Types.FLOAT:<NEW_LINE>case java.sql.Types.DOUBLE:<NEW_LINE>case java.sql.Types.REAL:<NEW_LINE>col<MASK><NEW_LINE>break;<NEW_LINE>case java.sql.Types.NVARCHAR:<NEW_LINE>case java.sql.Types.VARCHAR:<NEW_LINE>case java.sql.Types.NCHAR:<NEW_LINE>case java.sql.Types.CHAR:<NEW_LINE>case java.sql.Types.LONGVARCHAR:<NEW_LINE>case java.sql.Types.LONGNVARCHAR:<NEW_LINE>case java.sql.Types.OTHER:<NEW_LINE>col.data.str_col.clear();<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new AssertionError("Column type " + md.getColumnType(i) + " not Supported");<NEW_LINE>}<NEW_LINE>} | .data.real_col.clear(); |
396,881 | public void onViewCreated(final View view, @Nullable Bundle savedInstanceState) {<NEW_LINE>mUri = sampleUris().createSampleUri(ImageUriProvider.ImageSize.L, ImageUriProvider.Orientation.LANDSCAPE);<NEW_LINE>mFullDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view_full);<NEW_LINE>mFullDraweeView.setController(Fresco.newDraweeControllerBuilder().setUri(mUri).setControllerListener(mControllerListener).build());<NEW_LINE>mSelectedParentBounds = (ResizableFrameLayout) view.findViewById(R.id.frame_parent_bounds);<NEW_LINE>mSelectedParentBounds.init(view.findViewById<MASK><NEW_LINE>mSelectedParentBounds.setSizeChangedListener(mSizeChangedListener);<NEW_LINE>mSelectedFocusPoint = (ResizableFrameLayout) view.findViewById(R.id.frame_focus_point);<NEW_LINE>mSelectedFocusPoint.init(view.findViewById(R.id.btn_resize_focus_point));<NEW_LINE>mSelectedFocusPoint.setSizeChangedListener(mSizeChangedListener);<NEW_LINE>mRegionDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view_region);<NEW_LINE>mRegionDraweeView.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>updateRegion();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | (R.id.btn_resize_parent_bounds)); |
1,317,085 | public void actionPerformed(@Nonnull AnActionEvent e) {<NEW_LINE>final LayoutTreeComponent treeComponent = myArtifactEditor.getLayoutTreeComponent();<NEW_LINE>final LayoutTreeSelection selection = treeComponent.getSelection();<NEW_LINE>final CompositePackagingElement<?> parent = selection.getCommonParentElement();<NEW_LINE>if (parent == null)<NEW_LINE>return;<NEW_LINE>final PackagingElementNode<?> parentNode = selection.getNodes().get(0).getParentNode();<NEW_LINE>if (parentNode == null)<NEW_LINE>return;<NEW_LINE>if (!treeComponent.checkCanModifyChildren(parent, parentNode, selection.getNodes())) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final Collection<? extends PackagingElement> selectedElements = selection.getElements();<NEW_LINE>String initialName = "artifact";<NEW_LINE>if (selectedElements.size() == 1) {<NEW_LINE>initialName = PathUtil.suggestFileName(ContainerUtil.getFirstItem(selectedElements, null).createPresentation(myArtifactEditor.getContext()).getPresentableName());<NEW_LINE>}<NEW_LINE>IExtractArtifactDialog dialog = showDialog(treeComponent, initialName);<NEW_LINE>if (dialog == null)<NEW_LINE>return;<NEW_LINE>final Project project = myArtifactEditor.getContext().getProject();<NEW_LINE>final ModifiableArtifactModel model = myArtifactEditor.getContext().getOrCreateModifiableArtifactModel();<NEW_LINE>final ModifiableArtifact artifact = model.addArtifact(dialog.getArtifactName(<MASK><NEW_LINE>treeComponent.editLayout(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>for (PackagingElement<?> element : selectedElements) {<NEW_LINE>artifact.getRootElement().addOrFindChild(ArtifactUtil.copyWithChildren(element, project));<NEW_LINE>}<NEW_LINE>for (PackagingElement element : selectedElements) {<NEW_LINE>parent.removeChild(element);<NEW_LINE>}<NEW_LINE>ArtifactPointerManager pointerManager = ArtifactPointerUtil.getPointerManager(project);<NEW_LINE>parent.addOrFindChild(new ArtifactPackagingElement(pointerManager, pointerManager.create(artifact, myArtifactEditor.getContext().getArtifactModel())));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>treeComponent.rebuildTree();<NEW_LINE>} | ), dialog.getArtifactType()); |
1,178,418 | private static byte[] MFcrypt(byte[] P, byte[] S, int N, int r, int p, int dkLen) {<NEW_LINE>int MFLenBytes = r * 128;<NEW_LINE>byte[] bytes = SingleIterationPBKDF2(<MASK><NEW_LINE>int[] B = null;<NEW_LINE>try {<NEW_LINE>int BLen = bytes.length >>> 2;<NEW_LINE>B = new int[BLen];<NEW_LINE>Pack.littleEndianToInt(bytes, 0, B);<NEW_LINE>int d = 0, total = N * r;<NEW_LINE>while ((N - d) > 2 && total > (1 << 10)) {<NEW_LINE>++d;<NEW_LINE>total >>>= 1;<NEW_LINE>}<NEW_LINE>int MFLenWords = MFLenBytes >>> 2;<NEW_LINE>for (int BOff = 0; BOff < BLen; BOff += MFLenWords) {<NEW_LINE>// TODO These can be done in parallel threads<NEW_LINE>SMix(B, BOff, N, d, r);<NEW_LINE>}<NEW_LINE>Pack.intToLittleEndian(B, bytes, 0);<NEW_LINE>return SingleIterationPBKDF2(P, bytes, dkLen);<NEW_LINE>} finally {<NEW_LINE>Clear(bytes);<NEW_LINE>Clear(B);<NEW_LINE>}<NEW_LINE>} | P, S, p * MFLenBytes); |
847,648 | private EntityDef addDisplayDataFieldEntity() {<NEW_LINE>final String guid = "46f9ea33-996e-4c62-a67d-803df75ef9d4";<NEW_LINE>final String name = "DisplayDataField";<NEW_LINE>final String description = "A data display field.";<NEW_LINE>final String descriptionGUID = null;<NEW_LINE>final String superTypeName = "SchemaAttribute";<NEW_LINE>EntityDef entityDef = archiveHelper.getDefaultEntityDef(guid, name, this.archiveBuilder.getEntityDef<MASK><NEW_LINE>List<TypeDefAttribute> properties = new ArrayList<>();<NEW_LINE>TypeDefAttribute property;<NEW_LINE>final String attribute2Name = "inputField";<NEW_LINE>final String attribute2Description = "Is this data field accepting new data from the end user or not.";<NEW_LINE>final String attribute2DescriptionGUID = null;<NEW_LINE>property = archiveHelper.getBooleanTypeDefAttribute(attribute2Name, attribute2Description, attribute2DescriptionGUID);<NEW_LINE>properties.add(property);<NEW_LINE>entityDef.setPropertiesDefinition(properties);<NEW_LINE>return entityDef;<NEW_LINE>} | (superTypeName), description, descriptionGUID); |
1,273,974 | public static Bitmap centerCrop(@NonNull BitmapPool pool, @NonNull Bitmap inBitmap, int width, int height) {<NEW_LINE>if (inBitmap.getWidth() == width && inBitmap.getHeight() == height) {<NEW_LINE>return inBitmap;<NEW_LINE>}<NEW_LINE>// From ImageView/Bitmap.createScaledBitmap.<NEW_LINE>final float scale;<NEW_LINE>final float dx;<NEW_LINE>final float dy;<NEW_LINE>Matrix m = new Matrix();<NEW_LINE>if (inBitmap.getWidth() * height > width * inBitmap.getHeight()) {<NEW_LINE>scale = (float) height / (float) inBitmap.getHeight();<NEW_LINE>dx = (width - inBitmap.getWidth() * scale) * 0.5f;<NEW_LINE>dy = 0;<NEW_LINE>} else {<NEW_LINE>scale = (float) width / (float) inBitmap.getWidth();<NEW_LINE>dx = 0;<NEW_LINE>dy = (height - inBitmap.getHeight() * scale) * 0.5f;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>m.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));<NEW_LINE>Bitmap result = pool.get(width, height, getNonNullConfig(inBitmap));<NEW_LINE>// We don't add or remove alpha, so keep the alpha setting of the Bitmap we were given.<NEW_LINE>TransformationUtils.setAlpha(inBitmap, result);<NEW_LINE>applyMatrix(inBitmap, result, m);<NEW_LINE>return result;<NEW_LINE>} | m.setScale(scale, scale); |
1,130,428 | public void commitBlobBlocks(String container, String blob, BlockList blockList, CommitBlobBlocksOptions options) throws ServiceException {<NEW_LINE>String path = createPathFromContainer(container);<NEW_LINE>WebResource webResource = getResource(options).path(path).path(blob).queryParam("comp", "blocklist");<NEW_LINE>Builder builder = webResource.header("x-ms-version", API_VERSION);<NEW_LINE>builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId());<NEW_LINE>builder = addOptionalHeader(builder, "x-ms-blob-cache-control", options.getBlobCacheControl());<NEW_LINE>builder = addOptionalHeader(builder, "x-ms-blob-content-type", options.getBlobContentType());<NEW_LINE>builder = addOptionalHeader(builder, "x-ms-blob-content-encoding", options.getBlobContentEncoding());<NEW_LINE>builder = addOptionalHeader(builder, "x-ms-blob-content-language", options.getBlobContentLanguage());<NEW_LINE>builder = addOptionalHeader(builder, "x-ms-blob-content-md5", options.getBlobContentMD5());<NEW_LINE>builder = addOptionalMetadataHeader(<MASK><NEW_LINE>builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition());<NEW_LINE>builder.put(blockList);<NEW_LINE>} | builder, options.getMetadata()); |
1,078,302 | public ThemeValue unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ThemeValue themeValue = new ThemeValue();<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 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("children", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>themeValue.setChildren(new ListUnmarshaller<ThemeValues>(ThemeValuesJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("value", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>themeValue.setValue(context.getUnmarshaller(String.<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 themeValue;<NEW_LINE>} | class).unmarshall(context)); |
1,457,069 | // Submit a group of tasks to timed invokeAny, where all are able to complete successfully.<NEW_LINE>// Verify that invokeAny returns the result of one of the successful tasks.<NEW_LINE>@Test<NEW_LINE>public void testInvokeAnyTimedAllSuccessful() throws Exception {<NEW_LINE>PolicyExecutor executor = provider.create("testInvokeAnyTimedAllSuccessful").startTimeout(TimeUnit.NANOSECONDS.toMillis(TIMEOUT_NS));<NEW_LINE>final int numTasks = 3;<NEW_LINE>AtomicInteger counter = new AtomicInteger();<NEW_LINE>List<Callable<Integer>> tasks = new LinkedList<Callable<Integer>>();<NEW_LINE>for (int i = 0; i < numTasks; i++) tasks.add(new SharedIncrementTask(counter));<NEW_LINE>long start = System.nanoTime();<NEW_LINE>int result = executor.invokeAny(tasks, TIMEOUT_NS * 2, TimeUnit.NANOSECONDS);<NEW_LINE>long duration = System.nanoTime() - start;<NEW_LINE>assertTrue(Integer.toString(result), result >= 1 && result <= numTasks);<NEW_LINE>assertTrue(<MASK><NEW_LINE>int count = counter.get();<NEW_LINE>assertTrue(Integer.toString(count), count >= 1 && count <= numTasks);<NEW_LINE>List<Runnable> canceledFromQueue = executor.shutdownNow();<NEW_LINE>assertEquals(0, canceledFromQueue.size());<NEW_LINE>} | duration + "ns", duration < TIMEOUT_NS); |
1,796,009 | protected boolean prepareStart(SimpleTypeInformation<V> in) {<NEW_LINE>if (scalingreference == ScalingReference.MINMAX && minima.length != 0 && maxima.length != 0) {<NEW_LINE>dimensionality = minima.length;<NEW_LINE>scalingreferencevalues = new double[dimensionality];<NEW_LINE>randomPerAttribute = new Random[dimensionality];<NEW_LINE>for (int d = 0; d < dimensionality; d++) {<NEW_LINE>scalingreferencevalues[d] = (maxima[d] - minima[d]) * percentage;<NEW_LINE>if (scalingreferencevalues[d] == 0 || Double.isNaN(scalingreferencevalues[d])) {<NEW_LINE>scalingreferencevalues[d] = percentage;<NEW_LINE>}<NEW_LINE>randomPerAttribute[d] = new Random(RANDOM.nextLong());<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (scalingreference == ScalingReference.UNITCUBE) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>} | return (scalingreferencevalues.length == 0); |
356,356 | public void update(DefinitionLoader loader) throws Exception {<NEW_LINE>definitionCache = reinit(container);<NEW_LINE>String baseUri = loader.getBaseURI();<NEW_LINE>definitionCache.setType(DefinitionCacheTypeConfig.TEXT);<NEW_LINE>Map<String, XmlObject> urls = SchemaUtils.getDefinitionParts(loader);<NEW_LINE>definitionCache.setRootPart(baseUri);<NEW_LINE>for (Map.Entry<String, XmlObject> entry : urls.entrySet()) {<NEW_LINE>DefintionPartConfig definitionPart = definitionCache.addNewPart();<NEW_LINE>String url = entry.getKey();<NEW_LINE>definitionPart.setUrl(url);<NEW_LINE>XmlObject xmlObject = entry.getValue();<NEW_LINE>Node domNode = xmlObject.getDomNode();<NEW_LINE>if (domNode.getNodeType() == Node.DOCUMENT_FRAGMENT_NODE) {<NEW_LINE>Node node = ((<MASK><NEW_LINE>if (node.getNodeType() == Node.TEXT_NODE) {<NEW_LINE>domNode = XmlUtils.parseXml(node.getNodeValue());<NEW_LINE>// xmlObject = XmlObject.Factory.parse( domNode );<NEW_LINE>xmlObject = XmlUtils.createXmlObject(domNode);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Element contentElement = ((Document) domNode).getDocumentElement();<NEW_LINE>Node newDomNode = definitionPart.addNewContent().getDomNode();<NEW_LINE>newDomNode.appendChild(newDomNode.getOwnerDocument().createTextNode(xmlObject.toString()));<NEW_LINE>definitionPart.setType(contentElement.getNamespaceURI());<NEW_LINE>}<NEW_LINE>initParts();<NEW_LINE>} | DocumentFragment) domNode).getFirstChild(); |
274,185 | private void printInterleaveAverage(AutoTypeImage imageIn) {<NEW_LINE><MASK><NEW_LINE>String outputName = imageIn.getSingleBandName();<NEW_LINE>out.print("\t/**\n" + "\t * Converts a {@link " + inputName + "} into a {@link " + outputName + "} by computing the average value of each pixel\n" + "\t * across all the bands.\n" + "\t * \n" + "\t * @param input (Input) The ImageInterleaved that is being converted. Not modified.\n" + "\t * @param output (Optional) The single band output image. If null a new image is created. Modified.\n" + "\t * @return Converted image.\n" + "\t */\n" + "\tpublic static " + outputName + " average( " + inputName + " input , " + outputName + " output ) {\n" + "\t\tif (output == null) {\n" + "\t\t\toutput = new " + outputName + "(input.width, input.height);\n" + "\t\t} else {\n" + "\t\t\toutput.reshapeTo(input);\n" + "\t\t}\n" + "\n" + "\t\tif (BoofConcurrency.USE_CONCURRENT) {\n" + "\t\t\tConvertInterleavedToSingle_MT.average(input, output);\n" + "\t\t} else {\n" + "\t\t\tConvertInterleavedToSingle.average(input, output);\n" + "\t\t}\n" + "\n" + "\t\treturn output;\n" + "\t}\n\n");<NEW_LINE>} | String inputName = imageIn.getInterleavedName(); |
1,613,585 | private void acquire0(T object, CompletableFuture<T> res) {<NEW_LINE>if (object != null) {<NEW_LINE>idleCount.decrementAndGet();<NEW_LINE>if (isTestOnAcquire()) {<NEW_LINE>factory.validate(object).whenComplete((state, throwable) -> {<NEW_LINE>if (!isPoolActive()) {<NEW_LINE>res.completeExceptionally(POOL_SHUTDOWN);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (state != null && state) {<NEW_LINE>completeAcquire(res, object);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>destroy0(object).whenComplete((aVoid, th) -> makeObject0(res));<NEW_LINE>});<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (isPoolActive()) {<NEW_LINE>completeAcquire(res, object);<NEW_LINE>} else {<NEW_LINE>res.completeExceptionally(POOL_SHUTDOWN);<NEW_LINE>}<NEW_LINE>createIdle();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>long objects = (long) (<MASK><NEW_LINE>if ((long) getActualMaxTotal() >= (objects + 1)) {<NEW_LINE>makeObject0(res);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>res.completeExceptionally(POOL_EXHAUSTED);<NEW_LINE>} | getObjectCount() + getCreationInProgress()); |
1,620,153 | final GetPermissionPolicyResult executeGetPermissionPolicy(GetPermissionPolicyRequest getPermissionPolicyRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getPermissionPolicyRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetPermissionPolicyRequest> request = null;<NEW_LINE>Response<GetPermissionPolicyResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetPermissionPolicyRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getPermissionPolicyRequest));<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, "WAF Regional");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetPermissionPolicy");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetPermissionPolicyResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetPermissionPolicyResultJsonUnmarshaller());<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | invoke(request, responseHandler, executionContext); |
1,313,482 | public boolean visit(SQLSetStatement x) {<NEW_LINE>print0(ucase ? "SET " : "set ");<NEW_LINE>SQLSetStatement.<MASK><NEW_LINE>if (option != null) {<NEW_LINE>print(option.name());<NEW_LINE>print(' ');<NEW_LINE>}<NEW_LINE>List<SQLAssignItem> items = x.getItems();<NEW_LINE>for (int i = 0; i < items.size(); i++) {<NEW_LINE>if (i != 0) {<NEW_LINE>print0(", ");<NEW_LINE>}<NEW_LINE>SQLAssignItem item = x.getItems().get(i);<NEW_LINE>item.getTarget().accept(this);<NEW_LINE>SQLExpr value = item.getValue();<NEW_LINE>if (value instanceof SQLIdentifierExpr && (((SQLIdentifierExpr) value).nameHashCode64() == FnvHash.Constants.ON || ((SQLIdentifierExpr) value).nameHashCode64() == FnvHash.Constants.OFF)) {<NEW_LINE>print(' ');<NEW_LINE>} else {<NEW_LINE>print0(" = ");<NEW_LINE>}<NEW_LINE>value.accept(this);<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | Option option = x.getOption(); |
1,247,004 | public static FitData<Circle2D_F64> averageCircle_F64(List<Point2D_F64> points, @Nullable DogArray_F64 optional, @Nullable FitData<Circle2D_F64> outputStorage) {<NEW_LINE>if (outputStorage == null) {<NEW_LINE>outputStorage = new FitData<>(new Circle2D_F64());<NEW_LINE>}<NEW_LINE>if (optional == null) {<NEW_LINE>optional = new DogArray_F64();<NEW_LINE>}<NEW_LINE>Circle2D_F64 circle = outputStorage.shape;<NEW_LINE>int N = points.size();<NEW_LINE>// find center of the circle by computing the mean x and y<NEW_LINE>double sumX = 0, sumY = 0;<NEW_LINE>for (int i = 0; i < N; i++) {<NEW_LINE>Point2D_F64 p = points.get(i);<NEW_LINE>sumX += p.x;<NEW_LINE>sumY += p.y;<NEW_LINE>}<NEW_LINE>optional.reset();<NEW_LINE>double centerX = circle.center.<MASK><NEW_LINE>double centerY = circle.center.y = sumY / (double) N;<NEW_LINE>double meanR = 0;<NEW_LINE>for (int i = 0; i < N; i++) {<NEW_LINE>Point2D_F64 p = points.get(i);<NEW_LINE>double dx = p.x - centerX;<NEW_LINE>double dy = p.y - centerY;<NEW_LINE>double r = Math.sqrt(dx * dx + dy * dy);<NEW_LINE>optional.push(r);<NEW_LINE>meanR += r;<NEW_LINE>}<NEW_LINE>meanR /= N;<NEW_LINE>circle.radius = meanR;<NEW_LINE>// compute radius variance<NEW_LINE>double variance = 0;<NEW_LINE>for (int i = 0; i < N; i++) {<NEW_LINE>double diff = optional.get(i) - meanR;<NEW_LINE>variance += diff * diff;<NEW_LINE>}<NEW_LINE>outputStorage.error = variance / N;<NEW_LINE>return outputStorage;<NEW_LINE>} | x = sumX / (double) N; |
605,852 | // End of method isNeedleSafe<NEW_LINE>private void printPositions() {<NEW_LINE>int column = 1;<NEW_LINE>// Loop iterator<NEW_LINE>int ii = 0;<NEW_LINE>int numSpaces = 0;<NEW_LINE>int row = 1;<NEW_LINE>// Begin loop through all rows<NEW_LINE>for (row = 1; row <= MAX_NUM_ROWS; row++) {<NEW_LINE>numSpaces = 9;<NEW_LINE>// Begin loop through all columns<NEW_LINE>for (column = 1; column <= MAX_NUM_COLUMNS; column++) {<NEW_LINE>// No disk at the current position<NEW_LINE>if (positions[row][column] == 0) {<NEW_LINE>System.out.print(" ".repeat(numSpaces) + "*");<NEW_LINE>numSpaces = 20;<NEW_LINE>} else // Draw a disk at the current position<NEW_LINE>{<NEW_LINE>System.out.print(" ".repeat(numSpaces - ((int) (positions[row][column] / 2))));<NEW_LINE>for (ii = 1; ii <= positions[row][column]; ii++) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>numSpaces = 20 - ((int) (positions[row][column] / 2));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// End loop through all columns<NEW_LINE>System.out.println("");<NEW_LINE>}<NEW_LINE>// End loop through all rows<NEW_LINE>} | System.out.print("*"); |
981,980 | private static String addCommentsToDDL(DBRProgressMonitor monitor, OracleTableBase object, String ddl) {<NEW_LINE>StringBuilder ddlBuilder = new StringBuilder(ddl);<NEW_LINE>String objectFullName = object.getFullyQualifiedName(DBPEvaluationContext.DDL);<NEW_LINE>String objectComment = object.getComment(monitor);<NEW_LINE>if (!CommonUtils.isEmpty(objectComment)) {<NEW_LINE>String objectTypeName = "TABLE";<NEW_LINE>if (object instanceof OracleMaterializedView) {<NEW_LINE>objectTypeName = "MATERIALIZED VIEW";<NEW_LINE>}<NEW_LINE>ddlBuilder.append("\n\n").append("COMMENT ON ").append(objectTypeName).append(" ").append(objectFullName).append(" IS ").append(SQLUtils.quoteString(object.getDataSource(), objectComment)<MASK><NEW_LINE>}<NEW_LINE>try {<NEW_LINE>List<OracleTableColumn> attributes = object.getAttributes(monitor);<NEW_LINE>if (!CommonUtils.isEmpty(attributes)) {<NEW_LINE>List<DBEPersistAction> actions = new ArrayList<>();<NEW_LINE>if (CommonUtils.isEmpty(objectComment)) {<NEW_LINE>ddlBuilder.append("\n");<NEW_LINE>}<NEW_LINE>for (OracleTableColumn column : CommonUtils.safeCollection(attributes)) {<NEW_LINE>String columnComment = column.getComment(monitor);<NEW_LINE>if (!CommonUtils.isEmpty(columnComment)) {<NEW_LINE>OracleTableColumnManager.addColumnCommentAction(actions, column, column.getTable());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!CommonUtils.isEmpty(actions)) {<NEW_LINE>for (DBEPersistAction action : actions) {<NEW_LINE>ddlBuilder.append("\n").append(action.getScript()).append(SQLConstants.DEFAULT_STATEMENT_DELIMITER);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (DBException e) {<NEW_LINE>log.debug("Error reading object columns", e);<NEW_LINE>}<NEW_LINE>return ddlBuilder.toString();<NEW_LINE>} | ).append(SQLConstants.DEFAULT_STATEMENT_DELIMITER); |
954,113 | public static void boot(boolean cli) {<NEW_LINE>// delete files in the temp folder<NEW_LINE>cleanupAsync();<NEW_LINE>// shutdown hooks<NEW_LINE>Runtime.getRuntime().addShutdownHook(new Thread(() -> {<NEW_LINE>for (Process proc : createdProcesses) proc.destroy();<NEW_LINE>SettingsSerializer.saveSettings();<NEW_LINE>cleanup();<NEW_LINE>}, "Shutdown Hook"));<NEW_LINE>// setup the viewer<NEW_LINE>viewer.calledAfterLoad();<NEW_LINE>// setup the recent files<NEW_LINE>Settings.resetRecentFilesMenu();<NEW_LINE>// ping back once on first boot to add to global user count<NEW_LINE>if (!Configuration.pingback) {<NEW_LINE>pingBack.start();<NEW_LINE>Configuration.pingback = true;<NEW_LINE>}<NEW_LINE>// version checking<NEW_LINE>if (viewer.updateCheck.isSelected() && !DEV_MODE)<NEW_LINE>versionChecker.start();<NEW_LINE>// show the main UI<NEW_LINE>if (!cli)<NEW_LINE>viewer.setVisible(true);<NEW_LINE>// print startup time<NEW_LINE>System.out.println("Start up took " + ((System.currentTimeMillis() - Configuration.start) / 1000) + " seconds");<NEW_LINE>// request focus on GUI for hotkeys on start<NEW_LINE>if (!cli)<NEW_LINE>viewer.requestFocus();<NEW_LINE>// open files from launch args<NEW_LINE>if (!cli)<NEW_LINE>if (launchArgs.length >= 1)<NEW_LINE>for (String s : launchArgs) openFiles(new File[] { new <MASK><NEW_LINE>} | File(s) }, true); |
522,216 | private void handle(APIGetCandidateBackupStorageForCreatingImageMsg msg) {<NEW_LINE>PrimaryStorageVO ps;<NEW_LINE>if (msg.getVolumeUuid() != null) {<NEW_LINE>String sql = "select ps from PrimaryStorageVO ps, VolumeVO vol where ps.uuid = vol.primaryStorageUuid" + " and vol.uuid = :uuid";<NEW_LINE>TypedQuery<PrimaryStorageVO> q = dbf.getEntityManager().createQuery(sql, PrimaryStorageVO.class);<NEW_LINE>q.setParameter("uuid", msg.getVolumeUuid());<NEW_LINE>List<PrimaryStorageVO> pss = q.getResultList();<NEW_LINE>ps = pss.isEmpty() ? null : pss.get(0);<NEW_LINE>} else if (msg.getVolumeSnapshotUuid() != null) {<NEW_LINE>String sql = "select ps from PrimaryStorageVO ps, VolumeSnapshotVO sp where ps.uuid = sp.primaryStorageUuid" + " and sp.uuid = :uuid";<NEW_LINE>TypedQuery<PrimaryStorageVO> q = dbf.getEntityManager().createQuery(sql, PrimaryStorageVO.class);<NEW_LINE>q.setParameter("uuid", msg.getVolumeSnapshotUuid());<NEW_LINE>List<PrimaryStorageVO> pss = q.getResultList();<NEW_LINE>ps = pss.isEmpty() ? null : pss.get(0);<NEW_LINE>} else {<NEW_LINE>throw new CloudRuntimeException("cannot be there");<NEW_LINE>}<NEW_LINE>if (ps == null) {<NEW_LINE>throw new CloudRuntimeException("cannot find primary storage");<NEW_LINE>}<NEW_LINE>List<String> backupStorageTypes = getBackupStorageTypesByPrimaryStorageTypeFromMetrics(ps.getType());<NEW_LINE>String sql = "select bs from BackupStorageVO bs, BackupStorageZoneRefVO ref, PrimaryStorageVO ps" + " where bs.uuid = ref.backupStorageUuid and ps.zoneUuid = ref.zoneUuid and ps.uuid = :psUuid" + " and bs.type in (:bsTypes) and bs.state = :bsState and bs.status = :bsStatus";<NEW_LINE>TypedQuery<BackupStorageVO> q = dbf.getEntityManager().createQuery(sql, BackupStorageVO.class);<NEW_LINE>q.setParameter("psUuid", ps.getUuid());<NEW_LINE>q.setParameter("bsTypes", backupStorageTypes);<NEW_LINE>q.<MASK><NEW_LINE>q.setParameter("bsStatus", BackupStorageStatus.Connected);<NEW_LINE>List<BackupStorageInventory> candidates = BackupStorageInventory.valueOf(q.getResultList());<NEW_LINE>for (BackupStorageAllocatorFilterExtensionPoint ext : pluginRgty.getExtensionList(BackupStorageAllocatorFilterExtensionPoint.class)) {<NEW_LINE>candidates = ext.filterBackupStorageCandidatesByPS(candidates, ps.getUuid());<NEW_LINE>}<NEW_LINE>APIGetCandidateBackupStorageForCreatingImageReply reply = new APIGetCandidateBackupStorageForCreatingImageReply();<NEW_LINE>reply.setInventories(candidates);<NEW_LINE>bus.reply(msg, reply);<NEW_LINE>} | setParameter("bsState", BackupStorageState.Enabled); |
310,282 | public Object evaluate(DeferredObject[] arg0) throws HiveException {<NEW_LINE>Set<InspectableObject> objects = new TreeSet<InspectableObject>();<NEW_LINE>for (int i = 0; i < arg0.length; ++i) {<NEW_LINE>Object undeferred = arg0[i].get();<NEW_LINE>for (int j = 0; j < listInspectorArr[i].getListLength(undeferred); ++j) {<NEW_LINE>Object nonStd = listInspectorArr[i].getListElement(undeferred, j);<NEW_LINE>InspectableObject stdInsp = new InspectableObject(nonStd, listInspectorArr[i].getListElementObjectInspector());<NEW_LINE>objects.add(stdInsp);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List retVal = (List) retValInspector.create(0);<NEW_LINE>for (Object io : objects) {<NEW_LINE>InspectableObject inspObj = (InspectableObject) io;<NEW_LINE>Object stdObj = ObjectInspectorUtils.copyToStandardObject(<MASK><NEW_LINE>retVal.add(stdObj);<NEW_LINE>}<NEW_LINE>return retVal;<NEW_LINE>} | inspObj.o, inspObj.oi); |
771,687 | public Object calculate(Context ctx) {<NEW_LINE>Machines mcHS = new Machines();<NEW_LINE>String path = null;<NEW_LINE>if (param == null) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("sync" + mm.getMessage("function.missingParam"));<NEW_LINE>} else if (param.isLeaf()) {<NEW_LINE>Object obj = param.<MASK><NEW_LINE>mcHS.set(obj);<NEW_LINE>} else if (param.getSubSize() == 2) {<NEW_LINE>IParam hParam = param.getSub(0);<NEW_LINE>if (hParam == null) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("sync" + mm.getMessage("function.invalidParam"));<NEW_LINE>} else {<NEW_LINE>Object obj = hParam.getLeafExpression().calculate(ctx);<NEW_LINE>mcHS.set(obj);<NEW_LINE>}<NEW_LINE>IParam sub1 = param.getSub(1);<NEW_LINE>if (sub1 != null) {<NEW_LINE>Object op = sub1.getLeafExpression().calculate(ctx);<NEW_LINE>if (op instanceof String) {<NEW_LINE>path = (String) op;<NEW_LINE>} else {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("sync" + mm.getMessage("function.paramTypeError"));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("sync" + mm.getMessage("function.invalidParam"));<NEW_LINE>}<NEW_LINE>PartitionUtil.syncTo(mcHS, path);<NEW_LINE>return Boolean.TRUE;<NEW_LINE>} | getLeafExpression().calculate(ctx); |
513,949 | public float[] demodulate(float[] i, float[] q) {<NEW_LINE>VectorUtilities.checkComplexArrayLength(i, q, VECTOR_SPECIES);<NEW_LINE>if (mIBuffer.length != (i.length + BUFFER_OVERLAP)) {<NEW_LINE>mIBuffer = new float[i.length + BUFFER_OVERLAP];<NEW_LINE>mQBuffer = new float[q.length + BUFFER_OVERLAP];<NEW_LINE>}<NEW_LINE>// Copy last sample to beginning of buffer arrays<NEW_LINE>mIBuffer[0] = mIBuffer[mIBuffer.length - 1];<NEW_LINE>mQBuffer[0] = mQBuffer[mQBuffer.length - 1];<NEW_LINE>// Copy new samples to end of buffer arrays<NEW_LINE>System.arraycopy(i, 0, mIBuffer, 1, i.length);<NEW_LINE>System.arraycopy(q, 0, mQBuffer, 1, q.length);<NEW_LINE>float[] demodulated = new float[i.length];<NEW_LINE>FloatVector currentI, currentQ, previousI, previousQ, demod, demodI, demodQ;<NEW_LINE>for (int bufferPointer = 0; bufferPointer < mIBuffer.length - 1; bufferPointer += VECTOR_SPECIES.length()) {<NEW_LINE>previousI = FloatVector.<MASK><NEW_LINE>previousQ = FloatVector.fromArray(VECTOR_SPECIES, mQBuffer, bufferPointer);<NEW_LINE>currentI = FloatVector.fromArray(VECTOR_SPECIES, mIBuffer, bufferPointer + 1);<NEW_LINE>currentQ = FloatVector.fromArray(VECTOR_SPECIES, mQBuffer, bufferPointer + 1);<NEW_LINE>demodI = currentI.mul(previousI).sub(currentQ.mul(previousQ.neg()));<NEW_LINE>demodQ = currentQ.mul(previousI).add(currentI.mul(previousQ.neg()));<NEW_LINE>// Replace any zero-values in the I vector by adding Float.MIN_VALUE to side-step divide by zero errors<NEW_LINE>demodI = demodI.add(Float.MIN_VALUE, demodQ.eq(ZERO));<NEW_LINE>demod = demodQ.div(demodI).lanewise(VectorOperators.ATAN);<NEW_LINE>demod.intoArray(demodulated, bufferPointer);<NEW_LINE>}<NEW_LINE>return demodulated;<NEW_LINE>} | fromArray(VECTOR_SPECIES, mIBuffer, bufferPointer); |
948,366 | public static void generateMipMaps(Image image) {<NEW_LINE>int width = image.getWidth();<NEW_LINE>int height = image.getHeight();<NEW_LINE>Image current = image;<NEW_LINE>ArrayList<ByteBuffer> output = new ArrayList<>();<NEW_LINE>int totalSize = 0;<NEW_LINE>while (height >= 1 || width >= 1) {<NEW_LINE>output.add(current.getData(0));<NEW_LINE>totalSize += current.getData(0).capacity();<NEW_LINE>if (height == 1 || width == 1) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>height /= 2;<NEW_LINE>width /= 2;<NEW_LINE>current = scaleImage(current, width, height);<NEW_LINE>}<NEW_LINE>ByteBuffer combinedData = BufferUtils.createByteBuffer(totalSize);<NEW_LINE>int[] mipSizes = new int[output.size()];<NEW_LINE>for (int i = 0; i < output.size(); i++) {<NEW_LINE>ByteBuffer data = output.get(i);<NEW_LINE>data.clear();<NEW_LINE>combinedData.put(data);<NEW_LINE>mipSizes[i] = data.capacity();<NEW_LINE>}<NEW_LINE>combinedData.flip();<NEW_LINE>// insert mip data into image<NEW_LINE><MASK><NEW_LINE>image.setMipMapSizes(mipSizes);<NEW_LINE>} | image.setData(0, combinedData); |
567,893 | public static DescribeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response unmarshall(DescribeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response describeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response, UnmarshallerContext _ctx) {<NEW_LINE>describeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response.setRequestId(_ctx.stringValue("DescribeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response.RequestId"));<NEW_LINE>describeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response.setHttpStatusCode(_ctx.stringValue("DescribeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response.HttpStatusCode"));<NEW_LINE>describeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response.setSuccess(_ctx.booleanValue("DescribeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response.Success"));<NEW_LINE>describeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response.setResultMessage(_ctx.stringValue("DescribeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response.ResultMessage"));<NEW_LINE>describeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response.setCode(_ctx.stringValue("DescribeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response.Code"));<NEW_LINE>describeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response.setMessage(_ctx.stringValue("DescribeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response.Message"));<NEW_LINE>describeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response.setResultCode(_ctx.stringValue("DescribeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response.ResultCode"));<NEW_LINE>Result result = new Result();<NEW_LINE>result.setQRCodeType(_ctx.stringValue("DescribeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response.Result.QRCodeType"));<NEW_LINE>result.setAuthorizationType(_ctx.stringValue("DescribeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response.Result.AuthorizationType"));<NEW_LINE>result.setAntChainId(_ctx.stringValue("DescribeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response.Result.AntChainId"));<NEW_LINE>Pagination pagination = new Pagination();<NEW_LINE>pagination.setPageSize(_ctx.integerValue("DescribeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response.Result.Pagination.PageSize"));<NEW_LINE>pagination.setPageNumber(_ctx.integerValue("DescribeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response.Result.Pagination.PageNumber"));<NEW_LINE>pagination.setTotalCount(_ctx.integerValue("DescribeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response.Result.Pagination.TotalCount"));<NEW_LINE>result.setPagination(pagination);<NEW_LINE>List<AuthorizedUserListItem> authorizedUserList <MASK><NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response.Result.AuthorizedUserList.Length"); i++) {<NEW_LINE>AuthorizedUserListItem authorizedUserListItem = new AuthorizedUserListItem();<NEW_LINE>authorizedUserListItem.setGmtAuthorized(_ctx.stringValue("DescribeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response.Result.AuthorizedUserList[" + i + "].GmtAuthorized"));<NEW_LINE>authorizedUserListItem.setPhone(_ctx.stringValue("DescribeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response.Result.AuthorizedUserList[" + i + "].Phone"));<NEW_LINE>authorizedUserList.add(authorizedUserListItem);<NEW_LINE>}<NEW_LINE>result.setAuthorizedUserList(authorizedUserList);<NEW_LINE>describeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response.setResult(result);<NEW_LINE>return describeAntChainMiniAppBrowserQRCodeAuthorizedUsersV2Response;<NEW_LINE>} | = new ArrayList<AuthorizedUserListItem>(); |
1,708,922 | public static void doCopy(File repository, File sourceFile, File destFile, boolean bAfter, OutputLogger logger) throws HgException {<NEW_LINE>if (repository == null)<NEW_LINE>return;<NEW_LINE>List<String> command = new ArrayList<String>();<NEW_LINE>command.add(getHgCommand());<NEW_LINE>command.add(HG_COPY_CMD);<NEW_LINE>if (bAfter)<NEW_LINE>command.add(HG_COPY_AFTER_CMD);<NEW_LINE>command.add(HG_OPT_REPOSITORY);<NEW_LINE>command.add(repository.getAbsolutePath());<NEW_LINE>command.add(HG_OPT_CWD_CMD);<NEW_LINE>command.add(repository.getAbsolutePath());<NEW_LINE>command.add(sourceFile.getAbsolutePath().substring(repository.getAbsolutePath().length() + 1));<NEW_LINE>command.add(destFile.getAbsolutePath().substring(repository.getAbsolutePath()<MASK><NEW_LINE>List<String> list = exec(command);<NEW_LINE>if (!list.isEmpty() && isErrorAbort(list.get(list.size() - 1))) {<NEW_LINE>if (!bAfter || !isErrorAbortNoFilesToCopy(list.get(list.size() - 1))) {<NEW_LINE>handleError(command, list, NbBundle.getMessage(HgCommand.class, "MSG_COPY_FAILED"), logger);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .length() + 1)); |
832,849 | public Message createMessage(BlockFactory blockFactory, RLPList list) {<NEW_LINE>RLPList message = (RLPList) RLP.decode2(list.get(1).getRLPData()).get(0);<NEW_LINE>byte[] rlpId = list.get(0).getRLPData();<NEW_LINE>long id = rlpId == null ? 0 : BigIntegers.fromUnsignedByteArray(rlpId).longValue();<NEW_LINE>RLPList paramsList = (RLPList) RLP.decode2(message.get(0).getRLPData()).get(0);<NEW_LINE>List<BlockIdentifier> blockIdentifiers = new ArrayList<>();<NEW_LINE>for (int k = 0; k < paramsList.size(); k++) {<NEW_LINE>RLPElement param = paramsList.get(k);<NEW_LINE>BlockIdentifier blockIdentifier = <MASK><NEW_LINE>blockIdentifiers.add(blockIdentifier);<NEW_LINE>}<NEW_LINE>return new SkeletonResponseMessage(id, blockIdentifiers);<NEW_LINE>} | new BlockIdentifier((RLPList) param); |
284,193 | private String buildAndGetRuleParams(final CreateUpdateRuleDetails ruleDetails, final String ruleUUID, final boolean isCreatedNew) {<NEW_LINE>Map<String, Object> newJobParams;<NEW_LINE>try {<NEW_LINE>newJobParams = mapper.readValue(ruleDetails.getRuleParams(), new TypeReference<Map<String, Object>>() {<NEW_LINE>});<NEW_LINE>newJobParams.put("ruleId", ruleDetails.getRuleId());<NEW_LINE>newJobParams.put("autofix", ruleDetails.isAutofixEnabled());<NEW_LINE>newJobParams.put("alexaKeyword", ruleDetails.getAlexaKeyword());<NEW_LINE>newJobParams.put("ruleRestUrl", ruleDetails.getRuleRestUrl());<NEW_LINE>newJobParams.put("targetType", ruleDetails.getTargetType());<NEW_LINE>newJobParams.put("pac_ds", ruleDetails.getDataSource());<NEW_LINE>newJobParams.put("policyId", ruleDetails.getPolicyId());<NEW_LINE>newJobParams.put("assetGroup", ruleDetails.getAssetGroup());<NEW_LINE>newJobParams.put("ruleUUID", ruleUUID);<NEW_LINE>newJobParams.put(<MASK><NEW_LINE>Map<String, Object> severity = new HashMap<>();<NEW_LINE>severity.put("key", "severity");<NEW_LINE>severity.put("value", ruleDetails.getSeverity());<NEW_LINE>severity.put("encrypt", false);<NEW_LINE>Map<String, Object> category = new HashMap<>();<NEW_LINE>category.put("key", "ruleCategory");<NEW_LINE>category.put("value", ruleDetails.getCategory());<NEW_LINE>category.put("encrypt", false);<NEW_LINE>List<Map<String, Object>> environmentVariables = (List<Map<String, Object>>) newJobParams.get("environmentVariables");<NEW_LINE>List<Map<String, Object>> params = (List<Map<String, Object>>) newJobParams.get("params");<NEW_LINE>params.add(severity);<NEW_LINE>params.add(category);<NEW_LINE>newJobParams.put("environmentVariables", encryptDecryptValues(environmentVariables, ruleUUID, isCreatedNew));<NEW_LINE>newJobParams.put("params", encryptDecryptValues(params, ruleUUID, isCreatedNew));<NEW_LINE>return mapper.writeValueAsString(newJobParams);<NEW_LINE>} catch (Exception exception) {<NEW_LINE>log.error(UNEXPECTED_ERROR_OCCURRED, exception);<NEW_LINE>}<NEW_LINE>return ruleDetails.getRuleParams();<NEW_LINE>} | "ruleType", ruleDetails.getRuleType()); |
944,091 | private void drawMap() {<NEW_LINE>System.out.println("MAP OF THE CITY OF HYATTSVILLE");<NEW_LINE>System.out.println();<NEW_LINE>System.out.println(" -----1-----2-----3-----4-----");<NEW_LINE>int k = 3;<NEW_LINE>for (int i = 1; i < 5; i++) {<NEW_LINE>System.out.println("-");<NEW_LINE>System.out.println("-");<NEW_LINE><MASK><NEW_LINE>System.out.println("-");<NEW_LINE>System.out.print(gridPos[k]);<NEW_LINE>int pos = 16 - 4 * i;<NEW_LINE>System.out.print(" " + houses[pos]);<NEW_LINE>System.out.print(" " + houses[pos + 1]);<NEW_LINE>System.out.print(" " + houses[pos + 2]);<NEW_LINE>System.out.print(" " + houses[pos + 3]);<NEW_LINE>System.out.println(" " + gridPos[k]);<NEW_LINE>k = k - 1;<NEW_LINE>}<NEW_LINE>System.out.println("-");<NEW_LINE>System.out.println("-");<NEW_LINE>System.out.println("-");<NEW_LINE>System.out.println("-");<NEW_LINE>System.out.println(" -----1-----2-----3-----4-----");<NEW_LINE>} | System.out.println("-"); |
72,982 | public static ClientMessage encodeRequest(java.lang.String name, @Nullable java.util.Collection<com.hazelcast.client.impl.protocol.task.dynamicconfig.ListenerConfigHolder> listenerConfigs, int readBatchSize, boolean statisticsEnabled, java.lang.String topicOverloadPolicy, @Nullable com.hazelcast.internal.serialization.Data executor) {<NEW_LINE>ClientMessage clientMessage = ClientMessage.createForEncode();<NEW_LINE>clientMessage.setRetryable(false);<NEW_LINE>clientMessage.setOperationName("DynamicConfig.AddReliableTopicConfig");<NEW_LINE>ClientMessage.Frame initialFrame = new ClientMessage.Frame(new byte[REQUEST_INITIAL_FRAME_SIZE], UNFRAGMENTED_MESSAGE);<NEW_LINE>encodeInt(initialFrame.content, TYPE_FIELD_OFFSET, REQUEST_MESSAGE_TYPE);<NEW_LINE>encodeInt(initialFrame.content, PARTITION_ID_FIELD_OFFSET, -1);<NEW_LINE>encodeInt(initialFrame.content, REQUEST_READ_BATCH_SIZE_FIELD_OFFSET, readBatchSize);<NEW_LINE>encodeBoolean(initialFrame.content, REQUEST_STATISTICS_ENABLED_FIELD_OFFSET, statisticsEnabled);<NEW_LINE>clientMessage.add(initialFrame);<NEW_LINE>StringCodec.encode(clientMessage, name);<NEW_LINE>ListMultiFrameCodec.encodeNullable(clientMessage, listenerConfigs, ListenerConfigHolderCodec::encode);<NEW_LINE><MASK><NEW_LINE>CodecUtil.encodeNullable(clientMessage, executor, DataCodec::encode);<NEW_LINE>return clientMessage;<NEW_LINE>} | StringCodec.encode(clientMessage, topicOverloadPolicy); |
854,397 | public void paint(Graphics g) {<NEW_LINE>for (int i = 0; i < Main.height * rectSize; i += rectSize) {<NEW_LINE>for (int j = 0; j < Main.width * rectSize; j += rectSize) {<NEW_LINE>g.setColor(Color.DARK_GRAY);<NEW_LINE>if (i / rectSize == snakeHead.getX() && j / rectSize == snakeHead.getY())<NEW_LINE>g.setColor(Color.white);<NEW_LINE>else if (snakeTail.contains(board[i / rectSize][j / rectSize]))<NEW_LINE>g.setColor(Color.green);<NEW_LINE>else if (i / rectSize == food.getX() && j / rectSize == food.getY())<NEW_LINE>g.setColor(Color.red);<NEW_LINE>else if (showPath && path.contains(board[i / rectSize][j / rectSize]))<NEW_LINE><MASK><NEW_LINE>// remove this comment if you want to see generation of hamiltonian cycle and delay in dfs method of Main Class.<NEW_LINE>// else if(visited.contains(board[i/rectSize][j/rectSize]))<NEW_LINE>// g.setColor(Color.CYAN);<NEW_LINE>g.fillRect(i, j, rectSize, rectSize);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | g.setColor(Color.black); |
1,642,096 | private void executeCommand(String slicePath) {<NEW_LINE>if (exec == null)<NEW_LINE>return;<NEW_LINE>try {<NEW_LINE>String[] newArr = new String[exec.length + 1];<NEW_LINE>System.arraycopy(exec, 0, newArr, 0, exec.length);<NEW_LINE>newArr[exec.length] = slicePath;<NEW_LINE>ProcessWrapper pw = new ProcessWrapper(newArr, null);<NEW_LINE>int exit = pw.execute();<NEW_LINE>if (verbose)<NEW_LINE>System.out.println(Platform.stringFromBytes<MASK><NEW_LINE>byte[] err = pw.getErr();<NEW_LINE>if (err.length > 0) {<NEW_LINE>System.err.println(Platform.stringFromBytes(err));<NEW_LINE>}<NEW_LINE>if (exit != 0) {<NEW_LINE>System.err.println("Command '" + join(newArr) + "' exited with code: " + exit);<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>} | (pw.getOut())); |
1,426,181 | private Request buildRequest(JsonNode requestNode, String name) {<NEW_LINE>Request request = new Request();<NEW_LINE>request.setName(name);<NEW_LINE>if (isV2Collection) {<NEW_LINE>request.setHeaders(buildHeaders(requestNode.path("header")));<NEW_LINE>if (requestNode.has("body") && requestNode.path("body").has("raw")) {<NEW_LINE>request.setContent(requestNode.path("body").path("raw").asText());<NEW_LINE>} else if (requestNode.has("body") && requestNode.path("body").has("graphql")) {<NEW_LINE>String content = requestNode.path("body").path("graphql").path("query").asText();<NEW_LINE>String variables = requestNode.path("body").path("graphql").<MASK><NEW_LINE>content = replaceGraphQLVariables(content, variables);<NEW_LINE>request.setContent(content);<NEW_LINE>}<NEW_LINE>if (requestNode.path("url").has("variable")) {<NEW_LINE>JsonNode variablesNode = requestNode.path("url").path("variable");<NEW_LINE>for (JsonNode variableNode : variablesNode) {<NEW_LINE>Parameter param = new Parameter();<NEW_LINE>param.setName(variableNode.path("key").asText());<NEW_LINE>param.setValue(variableNode.path("value").asText());<NEW_LINE>request.addQueryParameter(param);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (requestNode.path("url").has("query")) {<NEW_LINE>JsonNode queryNode = requestNode.path("url").path("query");<NEW_LINE>for (JsonNode variableNode : queryNode) {<NEW_LINE>Parameter param = new Parameter();<NEW_LINE>param.setName(variableNode.path("key").asText());<NEW_LINE>param.setValue(variableNode.path("value").asText());<NEW_LINE>request.addQueryParameter(param);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>request.setHeaders(buildHeaders(requestNode.path("headers")));<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | path("variables").asText(); |
1,519,705 | private void unnestOperands(Analyzer analyzer) throws AnalysisException {<NEW_LINE>if (operands.size() == 1) {<NEW_LINE>// ValuesStmt for a single row.<NEW_LINE>allOperands_.add(operands.get(0));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// find index of first ALL operand<NEW_LINE>int firstAllIdx = operands.size();<NEW_LINE>for (int i = 1; i < operands.size(); ++i) {<NEW_LINE>SetOperand operand = operands.get(i);<NEW_LINE>if (operand.getQualifier() == Qualifier.ALL) {<NEW_LINE>firstAllIdx = (i == 1 ? 0 : i);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// operands[0] is always implicitly ALL, so operands[1] can't be the<NEW_LINE>// first one<NEW_LINE>Preconditions.checkState(firstAllIdx != 1);<NEW_LINE>// unnest DISTINCT operands<NEW_LINE>Preconditions.checkState(distinctOperands_.isEmpty());<NEW_LINE>for (int i = 0; i < firstAllIdx; ++i) {<NEW_LINE>unnestOperand(distinctOperands_, Qualifier.DISTINCT, operands.get(i));<NEW_LINE>}<NEW_LINE>// unnest ALL operands<NEW_LINE>Preconditions.checkState(allOperands_.isEmpty());<NEW_LINE>for (int i = firstAllIdx; i < operands.size(); ++i) {<NEW_LINE>unnestOperand(allOperands_, Qualifier.ALL<MASK><NEW_LINE>}<NEW_LINE>for (SetOperand op : distinctOperands_) {<NEW_LINE>op.setQualifier(Qualifier.DISTINCT);<NEW_LINE>}<NEW_LINE>for (SetOperand op : allOperands_) {<NEW_LINE>op.setQualifier(Qualifier.ALL);<NEW_LINE>}<NEW_LINE>operands.clear();<NEW_LINE>operands.addAll(distinctOperands_);<NEW_LINE>operands.addAll(allOperands_);<NEW_LINE>} | , operands.get(i)); |
984,910 | private void registerTranslations() {<NEW_LINE>final TranslationRegistry translationRegistry = TranslationRegistry.create(Key.key("velocity", "translations"));<NEW_LINE>translationRegistry.defaultLocale(Locale.US);<NEW_LINE>try {<NEW_LINE>FileSystemUtils.visitResources(VelocityServer.class, path -> {<NEW_LINE>logger.info("Loading localizations...");<NEW_LINE>try {<NEW_LINE>Files.walk(path).forEach(file -> {<NEW_LINE>if (!Files.isRegularFile(file)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String filename = com.google.common.io.Files.getNameWithoutExtension(file.<MASK><NEW_LINE>String localeName = filename.replace("messages_", "").replace("messages", "").replace('_', '-');<NEW_LINE>Locale locale;<NEW_LINE>if (localeName.isEmpty()) {<NEW_LINE>locale = Locale.US;<NEW_LINE>} else {<NEW_LINE>locale = Locale.forLanguageTag(localeName);<NEW_LINE>}<NEW_LINE>translationRegistry.registerAll(locale, ResourceBundle.getBundle("com/velocitypowered/proxy/l10n/messages", locale, UTF8ResourceBundleControl.get()), false);<NEW_LINE>ClosestLocaleMatcher.INSTANCE.registerKnown(locale);<NEW_LINE>});<NEW_LINE>} catch (IOException e) {<NEW_LINE>logger.error("Encountered an I/O error whilst loading translations", e);<NEW_LINE>}<NEW_LINE>}, "com", "velocitypowered", "proxy", "l10n");<NEW_LINE>} catch (IOException e) {<NEW_LINE>logger.error("Encountered an I/O error whilst loading translations", e);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>GlobalTranslator.translator().addSource(translationRegistry);<NEW_LINE>} | getFileName().toString()); |
1,494,019 | public boolean doIWantToQuit(MissionInit missionInit) {<NEW_LINE>this.quitCode = "";<NEW_LINE>List<Entity> caughtEntities = RewardForCatchingMobImplementation.getCaughtEntities();<NEW_LINE>for (Entity ent : caughtEntities) {<NEW_LINE>// Do we care about this entity?<NEW_LINE>for (MobWithDescription mob : this.qcmparams.getMob()) {<NEW_LINE>for (EntityTypes et : mob.getType()) {<NEW_LINE>if (et.value().equals(ent.getName())) {<NEW_LINE>if (!mob.isGlobal()) {<NEW_LINE>// If global flag is false, our player needs to be adjacent to the mob in order to claim the reward.<NEW_LINE>BlockPos entityPos = new BlockPos(ent.posX, ent.posY, ent.posZ);<NEW_LINE>EntityPlayerSP player = Minecraft.getMinecraft().player;<NEW_LINE>BlockPos playerPos = new BlockPos(player.posX, <MASK><NEW_LINE>if (Math.abs(entityPos.getX() - playerPos.getX()) + Math.abs(entityPos.getZ() - playerPos.getZ()) > 1)<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>this.quitCode = mob.getDescription();<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | player.posY, player.posZ); |
868,147 | public void region(float tl_x, float tl_y, GrayF32 output) {<NEW_LINE>if (tl_x < 0 || tl_y < 0 || tl_x + output.width > orig.width || tl_y + output.height > orig.height) {<NEW_LINE>throw new IllegalArgumentException("Region is outside of the image");<NEW_LINE>}<NEW_LINE>int xt = (int) tl_x;<NEW_LINE>int yt = (int) tl_y;<NEW_LINE>float ax = tl_x - xt;<NEW_LINE>float ay = tl_y - yt;<NEW_LINE>float bx = 1.0f - ax;<NEW_LINE>float by = 1.0f - ay;<NEW_LINE>float a0 = bx * by;<NEW_LINE>float a1 = ax * by;<NEW_LINE>float a2 = ax * ay;<NEW_LINE>float a3 = bx * ay;<NEW_LINE>int regWidth = output.width;<NEW_LINE>int regHeight = output.height;<NEW_LINE>final float[] results = output.data;<NEW_LINE>boolean borderRight = false;<NEW_LINE>boolean borderBottom = false;<NEW_LINE>// make sure it is in bounds or if its right on the image border<NEW_LINE>if (xt + regWidth >= orig.width || yt + regHeight >= orig.height) {<NEW_LINE>if ((xt + regWidth > orig.width || yt + regHeight > orig.height))<NEW_LINE>throw new IllegalArgumentException("requested region is out of bounds");<NEW_LINE>if (xt + regWidth == orig.width) {<NEW_LINE>regWidth--;<NEW_LINE>borderRight = true;<NEW_LINE>}<NEW_LINE>if (yt + regHeight == orig.height) {<NEW_LINE>regHeight--;<NEW_LINE>borderBottom = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// perform the interpolation while reducing the number of times the image needs to be accessed<NEW_LINE>for (int i = 0; i < regHeight; i++) {<NEW_LINE>int index = orig.startIndex + (yt + i) * stride + xt;<NEW_LINE>int indexResults = output.startIndex + i * output.stride;<NEW_LINE>float XY = data[index];<NEW_LINE>float Xy = data[index + stride];<NEW_LINE>int indexEnd = index + regWidth;<NEW_LINE>// for( int j = 0; j < regWidth; j++, index++ ) {<NEW_LINE>for (; index < indexEnd; index++) {<NEW_LINE>float xY = data[index + 1];<NEW_LINE>float xy = data[index + stride + 1];<NEW_LINE>float val = a0 * XY + a1 * xY <MASK><NEW_LINE>results[indexResults++] = val;<NEW_LINE>XY = xY;<NEW_LINE>Xy = xy;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// if touching the image border handle the special case<NEW_LINE>if (borderBottom || borderRight)<NEW_LINE>handleBorder(output, xt, yt, ax, ay, bx, by, regWidth, regHeight, results, borderRight, borderBottom);<NEW_LINE>} | + a2 * xy + a3 * Xy; |
179,373 | public void signVerify() throws NoSuchAlgorithmException {<NEW_LINE>CryptographyAsyncClient cryptographyAsyncClient = createAsyncClient();<NEW_LINE>// BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.sign#SignatureAlgorithm-byte<NEW_LINE>byte[] data = new byte[100];<NEW_LINE>new Random(0x1234567L).nextBytes(data);<NEW_LINE>MessageDigest md = MessageDigest.getInstance("SHA-256");<NEW_LINE>md.update(data);<NEW_LINE>byte[] digest = md.digest();<NEW_LINE>cryptographyAsyncClient.sign(SignatureAlgorithm.ES256, digest).contextWrite(Context.of("key1", "value1", "key2", "value2")).subscribe(signResult -> System.out.printf("Received signature of length: %d, with algorithm: %s.%n", signResult.getSignature().length<MASK><NEW_LINE>// END: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.sign#SignatureAlgorithm-byte<NEW_LINE>byte[] signature = new byte[100];<NEW_LINE>// BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.verify#SignatureAlgorithm-byte-byte<NEW_LINE>byte[] myData = new byte[100];<NEW_LINE>new Random(0x1234567L).nextBytes(myData);<NEW_LINE>MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");<NEW_LINE>messageDigest.update(myData);<NEW_LINE>byte[] myDigest = messageDigest.digest();<NEW_LINE>// A signature can be obtained from the SignResult returned by the CryptographyAsyncClient.sign() operation.<NEW_LINE>cryptographyAsyncClient.verify(SignatureAlgorithm.ES256, myDigest, signature).contextWrite(Context.of("key1", "value1", "key2", "value2")).subscribe(verifyResult -> System.out.printf("Verification status: %s.%n", verifyResult.isValid()));<NEW_LINE>// END: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.verify#SignatureAlgorithm-byte-byte<NEW_LINE>} | , signResult.getAlgorithm())); |
343,363 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {<NEW_LINE>super.onCreateView(inflater, container, savedInstanceState);<NEW_LINE>View layout = inflater.inflate(R.layout.feeditem_pager_fragment, container, false);<NEW_LINE>toolbar = layout.findViewById(R.id.toolbar);<NEW_LINE>toolbar.setTitle("");<NEW_LINE>toolbar.inflateMenu(R.menu.feeditem_options);<NEW_LINE>toolbar.setNavigationOnClickListener(v -> getParentFragmentManager().popBackStack());<NEW_LINE>toolbar.setOnMenuItemClickListener(this);<NEW_LINE>feedItems = getArguments().getLongArray(ARG_FEEDITEMS);<NEW_LINE>int feedItemPos = getArguments().getInt(ARG_FEEDITEM_POS);<NEW_LINE>pager = layout.findViewById(R.id.pager);<NEW_LINE>// FragmentStatePagerAdapter documentation:<NEW_LINE>// > When using FragmentStatePagerAdapter the host ViewPager must have a valid ID set.<NEW_LINE>// When opening multiple ItemPagerFragments by clicking "item" -> "visit podcast" -> "item" -> etc,<NEW_LINE>// the ID is no longer unique and FragmentStatePagerAdapter does not display any pages.<NEW_LINE>int newId = View.generateViewId();<NEW_LINE>if (savedInstanceState != null && savedInstanceState.getInt(KEY_PAGER_ID, 0) != 0) {<NEW_LINE>// Restore state by using the same ID as before. ID collisions are prevented in MainActivity.<NEW_LINE>newId = <MASK><NEW_LINE>}<NEW_LINE>pager.setId(newId);<NEW_LINE>pager.setAdapter(new ItemPagerAdapter(this));<NEW_LINE>pager.setCurrentItem(feedItemPos, false);<NEW_LINE>pager.setOffscreenPageLimit(1);<NEW_LINE>loadItem(feedItems[feedItemPos]);<NEW_LINE>pager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onPageSelected(int position) {<NEW_LINE>loadItem(feedItems[position]);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>EventBus.getDefault().register(this);<NEW_LINE>return layout;<NEW_LINE>} | savedInstanceState.getInt(KEY_PAGER_ID, 0); |
213,344 | public void showError(String title, String message, Throwable ex) {<NEW_LINE>final Alert alert = new Alert(Alert.AlertType.ERROR);<NEW_LINE>final Scene scene = alert.getDialogPane().getScene();<NEW_LINE>BrandUtil.applyBrand(injector, stage, scene);<NEW_LINE>alert.setHeaderText(title);<NEW_LINE>alert.setContentText(message);<NEW_LINE>alert.setGraphic(FontAwesome.EXCLAMATION_TRIANGLE.view());<NEW_LINE>alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);<NEW_LINE>if (ex == null) {<NEW_LINE>alert.setTitle("Error");<NEW_LINE>} else {<NEW_LINE>alert.setTitle(ex.getClass().getSimpleName());<NEW_LINE>final StringWriter sw = new StringWriter();<NEW_LINE>final PrintWriter pw = new PrintWriter(sw);<NEW_LINE>ex.printStackTrace(pw);<NEW_LINE>final Label label = new Label("The exception stacktrace was:");<NEW_LINE>final String exceptionText = sw.toString();<NEW_LINE>final TextArea textArea = new TextArea(exceptionText);<NEW_LINE>textArea.setEditable(false);<NEW_LINE>textArea.setWrapText(true);<NEW_LINE>textArea.setMaxWidth(Double.MAX_VALUE);<NEW_LINE><MASK><NEW_LINE>GridPane.setVgrow(textArea, Priority.ALWAYS);<NEW_LINE>GridPane.setHgrow(textArea, Priority.ALWAYS);<NEW_LINE>final GridPane expContent = new GridPane();<NEW_LINE>expContent.setMaxWidth(Double.MAX_VALUE);<NEW_LINE>expContent.add(label, 0, 0);<NEW_LINE>expContent.add(textArea, 0, 1);<NEW_LINE>alert.getDialogPane().setExpandableContent(expContent);<NEW_LINE>}<NEW_LINE>alert.showAndWait();<NEW_LINE>} | textArea.setMaxHeight(Double.MAX_VALUE); |
634,544 | public void validateSystemTag(String resourceUuid, Class resourceType, String systemTag) {<NEW_LINE>String target = LoadBalancerSystemTags.HEALTH_TARGET.getTokenByTag(systemTag, LoadBalancerSystemTags.HEALTH_TARGET_TOKEN);<NEW_LINE>String[] ts = target.split(":");<NEW_LINE>if (ts.length != 2) {<NEW_LINE>throw new OperationFailureException(argerr("invalid health target[%s], the format is targetCheckProtocol:port, for example, tcp:default", systemTag));<NEW_LINE>}<NEW_LINE>String protocol = ts[0];<NEW_LINE>if (!LoadBalancerConstants.HEALTH_CHECK_TARGET_PROTOCOLS.contains(protocol)) {<NEW_LINE>throw new OperationFailureException(argerr("invalid health target[%s], the target checking protocol[%s] is invalid, valid protocols are %s", systemTag<MASK><NEW_LINE>}<NEW_LINE>String port = ts[1];<NEW_LINE>if (!"default".equals(port)) {<NEW_LINE>try {<NEW_LINE>int p = Integer.parseInt(port);<NEW_LINE>if (p < 1 || p > 65535) {<NEW_LINE>throw new OperationFailureException(argerr("invalid invalid health target[%s], port[%s] is not in the range of [1, 65535]", systemTag, port));<NEW_LINE>}<NEW_LINE>} catch (NumberFormatException e) {<NEW_LINE>throw new OperationFailureException(argerr("invalid invalid health target[%s], port[%s] is not a number", systemTag, port));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | , protocol, LoadBalancerConstants.HEALTH_CHECK_TARGET_PROTOCOLS)); |
171,086 | public void show(View anchor, float anchorOverlap) {<NEW_LINE>updateItems();<NEW_LINE>if (mSystemUiVisibilityHelper != null)<NEW_LINE>mSystemUiVisibilityHelper.copyVisibility(getContentView());<NEW_LINE>// don't steal the focus, this will prevent the keyboard from changing<NEW_LINE>setFocusable(false);<NEW_LINE>// draw over stuff if needed<NEW_LINE>setClippingEnabled(false);<NEW_LINE>final Rect displayFrame = new Rect();<NEW_LINE>anchor.getWindowVisibleDisplayFrame(displayFrame);<NEW_LINE>final int[] anchorPos = new int[2];<NEW_LINE>anchor.getLocationOnScreen(anchorPos);<NEW_LINE>final int distanceToBottom = displayFrame.bottom - (anchorPos[1] + anchor.getHeight());<NEW_LINE>final int distanceToTop = anchorPos[1] - displayFrame.top;<NEW_LINE>LinearLayout linearLayout = getLinearLayout();<NEW_LINE>linearLayout.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));<NEW_LINE>setWidth(linearLayout.getMeasuredWidth());<NEW_LINE>int xOffset = anchorPos[0] + anchor.getPaddingLeft();<NEW_LINE>if (xOffset + linearLayout.getMeasuredWidth() > displayFrame.right)<NEW_LINE>xOffset = displayFrame.right - linearLayout.getMeasuredWidth();<NEW_LINE>int overlapAmount = (int) (<MASK><NEW_LINE>int yOffset;<NEW_LINE>if (distanceToBottom > linearLayout.getMeasuredHeight()) {<NEW_LINE>// show below anchor<NEW_LINE>yOffset = anchorPos[1] + overlapAmount;<NEW_LINE>setAnimationStyle(R.style.PopupAnimationTop);<NEW_LINE>} else if (distanceToTop > distanceToBottom) {<NEW_LINE>// show above anchor<NEW_LINE>yOffset = anchorPos[1] + overlapAmount - linearLayout.getMeasuredHeight();<NEW_LINE>setAnimationStyle(R.style.PopupAnimationBottom);<NEW_LINE>if (distanceToTop < linearLayout.getMeasuredHeight()) {<NEW_LINE>// enable scroll<NEW_LINE>setHeight(distanceToTop + overlapAmount);<NEW_LINE>yOffset += linearLayout.getMeasuredHeight() - distanceToTop - overlapAmount;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// show below anchor with scroll<NEW_LINE>yOffset = anchorPos[1] + overlapAmount;<NEW_LINE>setAnimationStyle(R.style.PopupAnimationTop);<NEW_LINE>setHeight(distanceToBottom + overlapAmount);<NEW_LINE>}<NEW_LINE>showAtLocation(anchor, Gravity.START | Gravity.TOP, xOffset, yOffset);<NEW_LINE>} | anchor.getHeight() * anchorOverlap); |
1,811,543 | public void reset(final Context context) {<NEW_LINE>final Config config = Config.get(context);<NEW_LINE>key_symbol_color = config.getColor("key_symbol_color");<NEW_LINE>hilited_key_symbol_color = config.getColor("hilited_key_symbol_color");<NEW_LINE>mShadowColor = config.getColor("shadow_color");<NEW_LINE>mSymbolSize = config.getPixel("symbol_text_size", 10);<NEW_LINE>mKeyTextSize = config.getPixel("key_text_size", 22);<NEW_LINE>mVerticalCorrection = config.getPixel("vertical_correction");<NEW_LINE>setProximityCorrectionEnabled(config.getBoolean("proximity_correction"));<NEW_LINE>mPreviewOffset = config.getPixel("preview_offset");<NEW_LINE>mPreviewHeight = config.getPixel("preview_height");<NEW_LINE>mLabelTextSize = config.getPixel("key_long_text_size");<NEW_LINE>if (mLabelTextSize == 0)<NEW_LINE>mLabelTextSize = mKeyTextSize;<NEW_LINE>mBackgroundDimAmount = config.getFloat("background_dim_amount");<NEW_LINE>mShadowRadius = config.getFloat("shadow_radius");<NEW_LINE>final float mRoundCorner = config.getFloat("round_corner");<NEW_LINE>mKeyBackColor = new StateListDrawable();<NEW_LINE>mKeyBackColor.addState(Key.KEY_STATE_PRESSED_ON, config.getColorDrawable("hilited_on_key_back_color"));<NEW_LINE>mKeyBackColor.addState(Key.KEY_STATE_PRESSED_OFF, config.getColorDrawable("hilited_off_key_back_color"));<NEW_LINE>mKeyBackColor.addState(Key.KEY_STATE_NORMAL_ON, config.getColorDrawable("on_key_back_color"));<NEW_LINE>mKeyBackColor.addState(Key.KEY_STATE_NORMAL_OFF, config.getColorDrawable("off_key_back_color"));<NEW_LINE>mKeyBackColor.addState(Key.KEY_STATE_PRESSED, config.getColorDrawable("hilited_key_back_color"));<NEW_LINE>mKeyBackColor.addState(Key.KEY_STATE_NORMAL, config.getColorDrawable("key_back_color"));<NEW_LINE>mKeyTextColor = new ColorStateList(Key.KEY_STATES, new int[] { config.getColor("hilited_on_key_text_color"), config.getColor("hilited_off_key_text_color"), config.getColor("on_key_text_color"), config.getColor("off_key_text_color"), config.getColor("hilited_key_text_color"), config.getColor("key_text_color") });<NEW_LINE>final Integer color = config.getColor("preview_text_color");<NEW_LINE>if (color != null)<NEW_LINE>mPreviewText.setTextColor(color);<NEW_LINE>final Integer previewBackColor = config.getColor("preview_back_color");<NEW_LINE>if (previewBackColor != null) {<NEW_LINE>final GradientDrawable background = new GradientDrawable();<NEW_LINE>background.setColor(previewBackColor);<NEW_LINE>background.setCornerRadius(mRoundCorner);<NEW_LINE>mPreviewText.setBackground(background);<NEW_LINE>}<NEW_LINE>final int mPreviewTextSizeLarge = config.getInt("preview_text_size");<NEW_LINE>mPreviewText.setTextSize(mPreviewTextSizeLarge);<NEW_LINE>mShowPreview = getPrefs()<MASK><NEW_LINE>mPaint.setTypeface(config.getFont("key_font"));<NEW_LINE>mPaintSymbol.setTypeface(config.getFont("symbol_font"));<NEW_LINE>mPaintSymbol.setColor(key_symbol_color);<NEW_LINE>mPaintSymbol.setTextSize(mSymbolSize);<NEW_LINE>mPreviewText.setTypeface(config.getFont("preview_font"));<NEW_LINE>REPEAT_INTERVAL = config.getRepeatInterval();<NEW_LINE>REPEAT_START_DELAY = config.getLongTimeout() + 1;<NEW_LINE>LONG_PRESS_TIMEOUT = config.getLongTimeout();<NEW_LINE>MULTI_TAP_INTERVAL = config.getLongTimeout();<NEW_LINE>invalidateAllKeys();<NEW_LINE>} | .getKeyboard().getPopupKeyPressEnabled(); |
1,074,421 | protected Response exchangeStoredToken(UriInfo uriInfo, EventBuilder event, ClientModel authorizedClient, UserSessionModel tokenUserSession, UserModel tokenSubject) {<NEW_LINE>FederatedIdentityModel model = session.users().getFederatedIdentity(authorizedClient.getRealm(), tokenSubject, getConfig().getAlias());<NEW_LINE>if (model == null || model.getToken() == null) {<NEW_LINE>event.detail(Details.REASON, "requested_issuer is not linked");<NEW_LINE>event.error(Errors.INVALID_TOKEN);<NEW_LINE>return exchangeNotLinked(uriInfo, authorizedClient, tokenUserSession, tokenSubject);<NEW_LINE>}<NEW_LINE>String accessToken = extractTokenFromResponse(model.getToken(), getAccessTokenResponseParameter());<NEW_LINE>if (accessToken == null) {<NEW_LINE>model.setToken(null);<NEW_LINE>session.users().updateFederatedIdentity(authorizedClient.<MASK><NEW_LINE>event.detail(Details.REASON, "requested_issuer token expired");<NEW_LINE>event.error(Errors.INVALID_TOKEN);<NEW_LINE>return exchangeTokenExpired(uriInfo, authorizedClient, tokenUserSession, tokenSubject);<NEW_LINE>}<NEW_LINE>AccessTokenResponse tokenResponse = new AccessTokenResponse();<NEW_LINE>tokenResponse.setToken(accessToken);<NEW_LINE>tokenResponse.setIdToken(null);<NEW_LINE>tokenResponse.setRefreshToken(null);<NEW_LINE>tokenResponse.setRefreshExpiresIn(0);<NEW_LINE>tokenResponse.getOtherClaims().clear();<NEW_LINE>tokenResponse.getOtherClaims().put(OAuth2Constants.ISSUED_TOKEN_TYPE, OAuth2Constants.ACCESS_TOKEN_TYPE);<NEW_LINE>tokenResponse.getOtherClaims().put(ACCOUNT_LINK_URL, getLinkingUrl(uriInfo, authorizedClient, tokenUserSession));<NEW_LINE>event.success();<NEW_LINE>return Response.ok(tokenResponse).type(MediaType.APPLICATION_JSON_TYPE).build();<NEW_LINE>} | getRealm(), tokenSubject, model); |
674,192 | private void resize() {<NEW_LINE>if (buckets == null) {<NEW_LINE>throw new IllegalStateException("Someone must be doing something ugly with reflection -- I have no buckets.");<NEW_LINE>}<NEW_LINE>final int oldCapacity = capacity;<NEW_LINE>final int oldSize = size;<NEW_LINE>final T[] oldBuckets = buckets;<NEW_LINE>final byte[] oldStatus = status;<NEW_LINE>capacity = SetSizeUtils.getLegalSizeAbove(capacity);<NEW_LINE>size = 0;<NEW_LINE>buckets = (T[]) new Object[capacity];<NEW_LINE>status = new byte[capacity];<NEW_LINE>final Function<T<MASK><NEW_LINE>try {<NEW_LINE>int idx = 0;<NEW_LINE>do {<NEW_LINE>final T entry = oldBuckets[idx];<NEW_LINE>if (entry != null)<NEW_LINE>insert(entry, hashToIndex(keyFunc.apply(entry)), (t1, t2) -> false);<NEW_LINE>} while ((idx = (idx + 127) % oldCapacity) != 0);<NEW_LINE>} catch (final IllegalStateException ise) {<NEW_LINE>capacity = oldCapacity;<NEW_LINE>size = oldSize;<NEW_LINE>buckets = oldBuckets;<NEW_LINE>status = oldStatus;<NEW_LINE>// this shouldn't happen except in the case of really bad hashCode implementations<NEW_LINE>throw new IllegalStateException("Hopscotching failed at load factor " + 1. * size / capacity + ", and resizing didn't help.");<NEW_LINE>}<NEW_LINE>if (size != oldSize) {<NEW_LINE>// this should never happen, period.<NEW_LINE>throw new IllegalStateException("Lost some elements during resizing.");<NEW_LINE>}<NEW_LINE>} | , Object> keyFunc = toKey(); |
1,046,191 | private void saveOrUpdateJobRankDistribution(List<JobStatistics> jobList, String zkBsKey) {<NEW_LINE>try {<NEW_LINE>Map<Integer, Integer> jobDegreeCountMap = new HashMap<>();<NEW_LINE>for (JobStatistics jobStatistics : jobList) {<NEW_LINE>int jobDegree = jobStatistics.getJobDegree();<NEW_LINE>Integer count = jobDegreeCountMap.get(jobDegree);<NEW_LINE>jobDegreeCountMap.put(jobDegree, count == null ? 1 : count + 1);<NEW_LINE>}<NEW_LINE>String <MASK><NEW_LINE>SaturnStatistics jobDegreeMapFromDB = saturnStatisticsService.findStatisticsByNameAndZkList(StatisticsTableKeyConstant.JOB_RANK_DISTRIBUTION, zkBsKey);<NEW_LINE>if (jobDegreeMapFromDB == null) {<NEW_LINE>SaturnStatistics ss = new SaturnStatistics(StatisticsTableKeyConstant.JOB_RANK_DISTRIBUTION, zkBsKey, jobDegreeMapString);<NEW_LINE>saturnStatisticsService.create(ss);<NEW_LINE>} else {<NEW_LINE>jobDegreeMapFromDB.setResult(jobDegreeMapString);<NEW_LINE>saturnStatisticsService.updateByPrimaryKey(jobDegreeMapFromDB);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.error(e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | jobDegreeMapString = JSON.toJSONString(jobDegreeCountMap); |
1,348,237 | public Object visit(ASTClassOrInterfaceDeclaration node, Object data) {<NEW_LINE>if (node.isInterface()) {<NEW_LINE>return data;<NEW_LINE>}<NEW_LINE>Set<String> methodsUsedByAnnotations = methodsUsedByAnnotations(node);<NEW_LINE>Map<MethodNameDeclaration, List<NameOccurrence>> methods = node.getScope().getEnclosingScope(ClassScope.class).getMethodDeclarations();<NEW_LINE>for (MethodNameDeclaration mnd : findUnique(methods)) {<NEW_LINE>List<NameOccurrence> occs = methods.get(mnd);<NEW_LINE>if (!privateAndNotExcluded(mnd) || hasIgnoredAnnotation((Annotatable) mnd.getNode().getParent()) || mnd.getParameterCount() == 0 && methodsUsedByAnnotations.contains(mnd.getName())) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (occs.isEmpty()) {<NEW_LINE>addViolation(data, mnd.getNode(), mnd.getImage(<MASK><NEW_LINE>} else {<NEW_LINE>if (isMethodNotCalledFromOtherMethods(mnd, occs)) {<NEW_LINE>addViolation(data, mnd.getNode(), mnd.getImage() + mnd.getParameterDisplaySignature());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return data;<NEW_LINE>} | ) + mnd.getParameterDisplaySignature()); |
1,576,337 | public boolean visit(TryStatement node) {<NEW_LINE>if (!hasChildrenChanges(node)) {<NEW_LINE>return doVisitUnchangedChildren(node);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>int level = node.getAST().apiLevel();<NEW_LINE>if (level >= JLS4_INTERNAL) {<NEW_LINE>StructuralPropertyDescriptor desc = level < JLS9_INTERNAL ? INTERNAL_TRY_STATEMENT_RESOURCES_PROPERTY : TryStatement.RESOURCES2_PROPERTY;<NEW_LINE>if (isChanged(node, desc)) {<NEW_LINE>int indent = getIndent(node.getStartPosition());<NEW_LINE>String prefix = this.formatter.TRY_RESOURCES.getPrefix(indent);<NEW_LINE>// $NON-NLS-1$<NEW_LINE>String newParen = this.formatter.TRY_RESOURCES_PAREN.getPrefix(indent) + "(";<NEW_LINE>// $NON-NLS-1$ //$NON-NLS-2$<NEW_LINE>pos = rewriteNodeList(node, desc, getPosAfterTry(pos), newParen, ")", ";" + prefix);<NEW_LINE>} else {<NEW_LINE>pos = doVisit(node, desc, pos);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>pos = rewriteRequiredNode(node, TryStatement.BODY_PROPERTY);<NEW_LINE>if (isChanged(node, TryStatement.CATCH_CLAUSES_PROPERTY)) {<NEW_LINE>int indent = getIndent(node.getStartPosition());<NEW_LINE>String prefix = this.formatter.CATCH_BLOCK.getPrefix(indent);<NEW_LINE>pos = rewriteNodeList(node, TryStatement.CATCH_CLAUSES_PROPERTY, pos, prefix, prefix);<NEW_LINE>} else {<NEW_LINE>pos = doVisit(node, TryStatement.CATCH_CLAUSES_PROPERTY, pos);<NEW_LINE>}<NEW_LINE>rewriteNode(node, TryStatement.FINALLY_PROPERTY, pos, this.formatter.FINALLY_BLOCK);<NEW_LINE>return false;<NEW_LINE>} | int pos = node.getStartPosition(); |
972,403 | private void insertDefault(SQLiteDatabase db) {<NEW_LINE>ContentValues screenValues = new ContentValues();<NEW_LINE>screenValues.put(DB_KEY_SCREEN_COLORS, 32);<NEW_LINE>screenValues.put(DB_KEY_SCREEN_RESOLUTION, 1);<NEW_LINE>screenValues.put(DB_KEY_SCREEN_WIDTH, 1024);<NEW_LINE>screenValues.put(DB_KEY_SCREEN_HEIGHT, 768);<NEW_LINE>final long idScreen = db.insert(DB_TABLE_SCREEN, null, screenValues);<NEW_LINE>final long idScreen3g = db.insert(DB_TABLE_SCREEN, null, screenValues);<NEW_LINE>ContentValues performanceValues = new ContentValues();<NEW_LINE>performanceValues.put(DB_KEY_PERFORMANCE_RFX, 1);<NEW_LINE>performanceValues.put(DB_KEY_PERFORMANCE_GFX, 1);<NEW_LINE>performanceValues.put(DB_KEY_PERFORMANCE_H264, 0);<NEW_LINE>performanceValues.put(DB_KEY_PERFORMANCE_WALLPAPER, 0);<NEW_LINE>performanceValues.put(DB_KEY_PERFORMANCE_THEME, 0);<NEW_LINE>performanceValues.put(DB_KEY_PERFORMANCE_DRAG, 0);<NEW_LINE><MASK><NEW_LINE>performanceValues.put(DB_KEY_PERFORMANCE_FONTS, 0);<NEW_LINE>performanceValues.put(DB_KEY_PERFORMANCE_COMPOSITION, 0);<NEW_LINE>final long idPerformance = db.insert(DB_TABLE_PERFORMANCE, null, performanceValues);<NEW_LINE>final long idPerformance3g = db.insert(DB_TABLE_PERFORMANCE, null, performanceValues);<NEW_LINE>ContentValues bookmarkValues = new ContentValues();<NEW_LINE>bookmarkValues.put(DB_KEY_BOOKMARK_LABEL, "Test Server");<NEW_LINE>bookmarkValues.put(DB_KEY_BOOKMARK_HOSTNAME, "testservice.afreerdp.com");<NEW_LINE>bookmarkValues.put(DB_KEY_BOOKMARK_USERNAME, "");<NEW_LINE>bookmarkValues.put(DB_KEY_BOOKMARK_PASSWORD, "");<NEW_LINE>bookmarkValues.put(DB_KEY_BOOKMARK_DOMAIN, "");<NEW_LINE>bookmarkValues.put(DB_KEY_BOOKMARK_PORT, "3389");<NEW_LINE>bookmarkValues.put(DB_KEY_SCREEN_SETTINGS, idScreen);<NEW_LINE>bookmarkValues.put(DB_KEY_SCREEN_SETTINGS_3G, idScreen3g);<NEW_LINE>bookmarkValues.put(DB_KEY_PERFORMANCE_FLAGS, idPerformance);<NEW_LINE>bookmarkValues.put(DB_KEY_PERFORMANCE_FLAGS_3G, idPerformance3g);<NEW_LINE>bookmarkValues.put(DB_KEY_BOOKMARK_REDIRECT_SDCARD, 0);<NEW_LINE>bookmarkValues.put(DB_KEY_BOOKMARK_REDIRECT_SOUND, 0);<NEW_LINE>bookmarkValues.put(DB_KEY_BOOKMARK_REDIRECT_MICROPHONE, 0);<NEW_LINE>bookmarkValues.put(DB_KEY_BOOKMARK_SECURITY, 0);<NEW_LINE>bookmarkValues.put(DB_KEY_BOOKMARK_REMOTE_PROGRAM, "");<NEW_LINE>bookmarkValues.put(DB_KEY_BOOKMARK_WORK_DIR, "");<NEW_LINE>bookmarkValues.put(DB_KEY_BOOKMARK_ASYNC_CHANNEL, 1);<NEW_LINE>bookmarkValues.put(DB_KEY_BOOKMARK_ASYNC_UPDATE, 1);<NEW_LINE>bookmarkValues.put(DB_KEY_BOOKMARK_CONSOLE_MODE, 0);<NEW_LINE>bookmarkValues.put(DB_KEY_BOOKMARK_DEBUG_LEVEL, "INFO");<NEW_LINE>db.insert(DB_TABLE_BOOKMARK, null, bookmarkValues);<NEW_LINE>} | performanceValues.put(DB_KEY_PERFORMANCE_MENU_ANIMATIONS, 0); |
1,727,801 | V remove(Object key, int hash) {<NEW_LINE>lock();<NEW_LINE>try {<NEW_LINE>long now = map.ticker.read();<NEW_LINE>preWriteCleanup(now);<NEW_LINE>int newCount = this.count - 1;<NEW_LINE>AtomicReferenceArray<ReferenceEntry<K, V>> table = this.table;<NEW_LINE>int index = hash & (table.length() - 1);<NEW_LINE>ReferenceEntry<K, V> first = table.get(index);<NEW_LINE>for (ReferenceEntry<K, V> e = first; e != null; e = e.getNext()) {<NEW_LINE><MASK><NEW_LINE>if (e.getHash() == hash && entryKey != null && map.keyEquivalence.equivalent(key, entryKey)) {<NEW_LINE>ValueReference<K, V> valueReference = e.getValueReference();<NEW_LINE>V entryValue = valueReference.get();<NEW_LINE>RemovalCause cause;<NEW_LINE>if (entryValue != null) {<NEW_LINE>cause = RemovalCause.EXPLICIT;<NEW_LINE>} else if (valueReference.isActive()) {<NEW_LINE>cause = RemovalCause.COLLECTED;<NEW_LINE>} else {<NEW_LINE>// currently loading<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>++modCount;<NEW_LINE>ReferenceEntry<K, V> newFirst = removeValueFromChain(first, e, entryKey, hash, entryValue, valueReference, cause);<NEW_LINE>newCount = this.count - 1;<NEW_LINE>table.set(index, newFirst);<NEW_LINE>// write-volatile<NEW_LINE>this.count = newCount;<NEW_LINE>return entryValue;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} finally {<NEW_LINE>unlock();<NEW_LINE>postWriteCleanup();<NEW_LINE>}<NEW_LINE>} | K entryKey = e.getKey(); |
54,098 | protected Object decode(Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {<NEW_LINE>Parser parser = new Parser(PATTERN, (String) msg);<NEW_LINE>if (!parser.matches()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Position position = new Position(getProtocolName());<NEW_LINE>DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, parser.next());<NEW_LINE>if (deviceSession == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>position.setDeviceId(deviceSession.getDeviceId());<NEW_LINE>position.setTime(parser.nextDateTime());<NEW_LINE>position.setLatitude(parser.nextDouble(0));<NEW_LINE>position.setLongitude(parser.nextDouble(0));<NEW_LINE>position.setSpeed(UnitsConverter.knotsFromKph(parser.nextDouble(0)));<NEW_LINE>position.setCourse(parser.nextDouble(0));<NEW_LINE>position.setAltitude(parser.nextDouble(0));<NEW_LINE>position.setValid(parser.next<MASK><NEW_LINE>position.set(Position.KEY_SATELLITES, parser.nextInt());<NEW_LINE>position.set(Position.KEY_RSSI, parser.nextDouble());<NEW_LINE>position.set(Position.KEY_BATTERY, parser.nextDouble(0));<NEW_LINE>position.set(Position.KEY_CHARGE, parser.next().equals("1"));<NEW_LINE>return position;<NEW_LINE>} | ().equals("F")); |
448,663 | public void onRender(MatrixStack matrixStack, float partialTicks) {<NEW_LINE>matrixStack.push();<NEW_LINE>GL11.glEnable(GL11.GL_BLEND);<NEW_LINE>GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);<NEW_LINE>GL11.glDisable(GL11.GL_DEPTH_TEST);<NEW_LINE>GL11.glDepthMask(false);<NEW_LINE>GL11.glEnable(GL11.GL_LINE_SMOOTH);<NEW_LINE>RenderUtils.applyCameraRotationOnly();<NEW_LINE>ArrayList<Vec3d> path = getPath(partialTicks);<NEW_LINE>Vec3d camPos = RenderUtils.getCameraPos();<NEW_LINE>drawLine(matrixStack, path, camPos);<NEW_LINE>if (!path.isEmpty()) {<NEW_LINE>Vec3d end = path.get(path.size() - 1);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>RenderSystem.setShaderColor(1, 1, 1, 1);<NEW_LINE>GL11.glDisable(GL11.GL_BLEND);<NEW_LINE>GL11.glEnable(GL11.GL_DEPTH_TEST);<NEW_LINE>GL11.glDepthMask(true);<NEW_LINE>GL11.glDisable(GL11.GL_LINE_SMOOTH);<NEW_LINE>matrixStack.pop();<NEW_LINE>} | drawEndOfLine(matrixStack, end, camPos); |
1,145,070 | final CreateDatasetResult executeCreateDataset(CreateDatasetRequest createDatasetRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createDatasetRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateDatasetRequest> request = null;<NEW_LINE>Response<CreateDatasetResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateDatasetRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createDatasetRequest));<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, "Personalize");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateDataset");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateDatasetResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateDatasetResultJsonUnmarshaller());<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()); |
531,666 | public synchronized void start() {<NEW_LINE>String id = getID();<NEW_LINE>if (id != null) {<NEW_LINE>log.info("Starting Speed Layer {}", id);<NEW_LINE>}<NEW_LINE>streamingContext = buildStreamingContext();<NEW_LINE>log.info("Creating message stream from topic");<NEW_LINE>JavaInputDStream<ConsumerRecord<K, M>> kafkaDStream = buildInputDStream(streamingContext);<NEW_LINE>JavaPairDStream<K, M> pairDStream = kafkaDStream.mapToPair(mAndM -> new Tuple2<>(mAndM.key(), mAndM.value()));<NEW_LINE>KafkaConsumer<String, U> consumer = new KafkaConsumer<>(// Do start from the beginning of the update queue<NEW_LINE>ConfigUtils.// Do start from the beginning of the update queue<NEW_LINE>keyValueToProperties(// Do start from the beginning of the update queue<NEW_LINE>"group.id", // Do start from the beginning of the update queue<NEW_LINE>"OryxGroup-" + getLayerName() + '-' + UUID.randomUUID(), // Do start from the beginning of the update queue<NEW_LINE>"bootstrap.servers", // Do start from the beginning of the update queue<NEW_LINE>updateBroker, // Do start from the beginning of the update queue<NEW_LINE>"max.partition.fetch.bytes", // Do start from the beginning of the update queue<NEW_LINE>maxMessageSize, // Do start from the beginning of the update queue<NEW_LINE>"key.deserializer", // Do start from the beginning of the update queue<NEW_LINE>"org.apache.kafka.common.serialization.StringDeserializer", // Do start from the beginning of the update queue<NEW_LINE>"value.deserializer", // Do start from the beginning of the update queue<NEW_LINE>updateDecoderClass.getName(), "auto.offset.reset", "earliest"));<NEW_LINE>consumer.subscribe(Collections.singletonList(updateTopic));<NEW_LINE>consumerIterator = new ConsumeDataIterator<>(consumer);<NEW_LINE>modelManager = loadManagerInstance();<NEW_LINE>Configuration hadoopConf = streamingContext.sparkContext().hadoopConfiguration();<NEW_LINE>new Thread(LoggingCallable.log(() -> {<NEW_LINE>try {<NEW_LINE>modelManager.consume(consumerIterator, hadoopConf);<NEW_LINE>} catch (Throwable t) {<NEW_LINE><MASK><NEW_LINE>close();<NEW_LINE>}<NEW_LINE>}).asRunnable(), "OryxSpeedLayerUpdateConsumerThread").start();<NEW_LINE>pairDStream.foreachRDD(new SpeedLayerUpdate<>(modelManager, updateBroker, updateTopic));<NEW_LINE>// Must use the raw Kafka stream to get offsets<NEW_LINE>kafkaDStream.foreachRDD(new UpdateOffsetsFn<>(getGroupID(), getInputTopicLockMaster()));<NEW_LINE>log.info("Starting Spark Streaming");<NEW_LINE>streamingContext.start();<NEW_LINE>} | log.error("Error while consuming updates", t); |
1,064,097 | private void mark(TokenSequence ts) {<NEW_LINE>ts.move(startOffset1);<NEW_LINE>if (!ts.moveNext())<NEW_LINE>return;<NEW_LINE>Token token = ts.token();<NEW_LINE>TokenSequence ts2 = ts.embedded();<NEW_LINE>if (ts2 == null)<NEW_LINE>return;<NEW_LINE>String mimeTypeOut = ts.language().mimeType();<NEW_LINE>String mimeTypeIn = ts2.language().mimeType();<NEW_LINE>if (token.id().name().equals(SLexer.EMBEDDING_TOKEN_TYPE_NAME)) {<NEW_LINE>Color c = getPreprocessorImportsColor(mimeTypeIn);<NEW_LINE>if (c != null) {<NEW_LINE>attributeSet.addAttribute(StyleConstants.Background, c);<NEW_LINE>attributeSet.addAttribute(HighlightsContainer.ATTR_EXTENDS_EOL, Boolean.TRUE);<NEW_LINE>endOffset1 = tokenSequence.offset() + token.length();<NEW_LINE>}<NEW_LINE>} else if (!mimeTypeOut.equals(mimeTypeIn)) {<NEW_LINE>Color c = getTokenImportsColor(mimeTypeOut, mimeTypeIn, token.id().name());<NEW_LINE>if (c != null) {<NEW_LINE>attributeSet.<MASK><NEW_LINE>attributeSet.addAttribute(HighlightsContainer.ATTR_EXTENDS_EOL, Boolean.TRUE);<NEW_LINE>endOffset1 = tokenSequence.offset() + token.length();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>mark(ts2);<NEW_LINE>} | addAttribute(StyleConstants.Background, c); |
1,042,012 | protected void performAction(Node[] activatedNodes) {<NEW_LINE>for (Node n : activatedNodes) {<NEW_LINE>final JavaComponentInfo ci = n.getLookup(<MASK><NEW_LINE>if (ci != null) {<NEW_LINE>final FieldInfo fieldInfo = ci.getField();<NEW_LINE>if (fieldInfo != null) {<NEW_LINE>GoToSourceAction.RP.post(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>org.netbeans.api.debugger.jpda.Field fieldVariable;<NEW_LINE>JPDADebuggerImpl debugger = ci.getThread().getDebugger();<NEW_LINE>Variable variable = debugger.getVariable(fieldInfo.getParent().getComponent());<NEW_LINE>fieldVariable = ((ObjectVariable) variable).getField(fieldInfo.getName());<NEW_LINE>SourcePath ectx = debugger.getSession().lookupFirst(null, SourcePath.class);<NEW_LINE>ectx.showSource(fieldVariable);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} else {<NEW_LINE>NotifyDescriptor d = new NotifyDescriptor.Message(NbBundle.getMessage(GoToFieldDeclarationAction.class, "MSG_NoFieldInfo"), NotifyDescriptor.WARNING_MESSAGE);<NEW_LINE>DialogDisplayer.getDefault().notifyLater(d);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ).lookup(JavaComponentInfo.class); |
1,734,773 | public static Optional<RequestBodyExt> requestBody(ParserContext ctx, MethodNode node) {<NEW_LINE>List<MethodInsnNode> instructions = StreamSupport.stream(Spliterators.spliteratorUnknownSize(node.instructions.iterator(), Spliterator.ORDERED), false).filter(MethodInsnNode.class::isInstance).map(MethodInsnNode.class::cast).filter(i -> i.owner.equals(TypeFactory.CONTEXT.getInternalName()) && (isFormLike(i) || i.name.equals("body"))).collect(Collectors.toList());<NEW_LINE>if (instructions.size() == 0) {<NEW_LINE>return Optional.empty();<NEW_LINE>} else if (instructions.size() == 1) {<NEW_LINE>MethodInsnNode i = instructions.get(0);<NEW_LINE>Signature signature = Signature.create(i);<NEW_LINE>RequestBodyExt body = new RequestBodyExt();<NEW_LINE>if (isMultipart(i)) {<NEW_LINE>body.setContentType(MediaType.MULTIPART_FORMDATA);<NEW_LINE>} else if (isForm(i)) {<NEW_LINE>body.setContentType(MediaType.FORM_URLENCODED);<NEW_LINE>}<NEW_LINE>if (signature.matches(Class.class)) {<NEW_LINE>String bodyType = valueType(i).orElseThrow(() -> new IllegalStateException("Type not found, for: " + InsnSupport.toString(i)));<NEW_LINE>body.setJavaType(bodyType);<NEW_LINE>} else {<NEW_LINE>if (isFormLike(i)) {<NEW_LINE>formFields(ctx, Collections.singletonList(i)<MASK><NEW_LINE>} else {<NEW_LINE>argumentValue(i.name, i).set(body);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return Optional.of(body);<NEW_LINE>} else {<NEW_LINE>RequestBodyExt body = new RequestBodyExt();<NEW_LINE>formFields(ctx, instructions.stream().filter(RequestParser::isFormLike).collect(Collectors.toList())).ifPresent(body::setContent);<NEW_LINE>boolean multipart = instructions.stream().anyMatch(RequestParser::isMultipart);<NEW_LINE>if (multipart) {<NEW_LINE>body.setContentType(MediaType.MULTIPART_FORMDATA);<NEW_LINE>} else {<NEW_LINE>body.setContentType(MediaType.FORM_URLENCODED);<NEW_LINE>}<NEW_LINE>return Optional.of(body);<NEW_LINE>}<NEW_LINE>} | ).ifPresent(body::setContent); |
653,289 | public Taint unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>Taint taint = new Taint();<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 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("key", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>taint.setKey(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("value", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>taint.setValue(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("effect", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>taint.setEffect(context.getUnmarshaller(String.<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 taint;<NEW_LINE>} | class).unmarshall(context)); |
1,651,906 | public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) {<NEW_LINE>if (super.onBlockActivated(world, pos, state, player, side, hitX, hitY, hitZ)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>TileEntity tile = world.getTileEntity(pos);<NEW_LINE>if (!(tile instanceof TileRefinery)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>Item equipped = current != null ? current.getItem() : null;<NEW_LINE>if (player.isSneaking() && equipped instanceof IToolWrench && ((IToolWrench) equipped).canWrench(player, pos)) {<NEW_LINE>((TileRefinery) tile).resetFilters();<NEW_LINE>((IToolWrench) equipped).wrenchUsed(player, pos);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (current != null) {<NEW_LINE>if (!world.isRemote) {<NEW_LINE>if (FluidContainerRegistry.isEmptyContainer(current)) {<NEW_LINE>if (TankUtils.handleRightClick((TileRefinery) tile, side, player, false, true)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>} else if (FluidContainerRegistry.isFilledContainer(current)) {<NEW_LINE>if (TankUtils.handleRightClick((TileRefinery) tile, side, player, true, false)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (FluidContainerRegistry.isContainer(current)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!world.isRemote) {<NEW_LINE>player.openGui(BuildCraftFactory.instance, GuiIds.REFINERY, world, pos.getX(), pos.getY(), pos.getZ());<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | ItemStack current = player.getCurrentEquippedItem(); |
710,790 | private void bitrv216(float[] a, int offa) {<NEW_LINE>float x1r, x1i, x2r, x2i, x3r, x3i, x4r, x4i, x5r, x5i, x7r, x7i, x8r, x8i, x10r, x10i, x11r, x11i, x12r, x12i, x13r, x13i, x14r, x14i;<NEW_LINE>x1r = a[offa + 2];<NEW_LINE>x1i = a[offa + 3];<NEW_LINE>x2r = a[offa + 4];<NEW_LINE>x2i = a[offa + 5];<NEW_LINE>x3r = a[offa + 6];<NEW_LINE>x3i = a[offa + 7];<NEW_LINE>x4r = a[offa + 8];<NEW_LINE>x4i = a[offa + 9];<NEW_LINE>x5r = a[offa + 10];<NEW_LINE>x5i = a[offa + 11];<NEW_LINE>x7r = a[offa + 14];<NEW_LINE>x7i = a[offa + 15];<NEW_LINE>x8r = a[offa + 16];<NEW_LINE>x8i = a[offa + 17];<NEW_LINE>x10r = a[offa + 20];<NEW_LINE>x10i = a[offa + 21];<NEW_LINE>x11r = a[offa + 22];<NEW_LINE>x11i = a[offa + 23];<NEW_LINE>x12r = a[offa + 24];<NEW_LINE>x12i = a[offa + 25];<NEW_LINE>x13r = a[offa + 26];<NEW_LINE>x13i = a[offa + 27];<NEW_LINE>x14r = a[offa + 28];<NEW_LINE>x14i = a[offa + 29];<NEW_LINE>a[offa + 2] = x8r;<NEW_LINE>a[offa + 3] = x8i;<NEW_LINE>a[offa + 4] = x4r;<NEW_LINE>a[offa + 5] = x4i;<NEW_LINE>a[offa + 6] = x12r;<NEW_LINE>a[offa + 7] = x12i;<NEW_LINE>a[offa + 8] = x2r;<NEW_LINE>a[offa + 9] = x2i;<NEW_LINE>a[offa + 10] = x10r;<NEW_LINE>a[offa + 11] = x10i;<NEW_LINE>a[offa + 14] = x14r;<NEW_LINE><MASK><NEW_LINE>a[offa + 16] = x1r;<NEW_LINE>a[offa + 17] = x1i;<NEW_LINE>a[offa + 20] = x5r;<NEW_LINE>a[offa + 21] = x5i;<NEW_LINE>a[offa + 22] = x13r;<NEW_LINE>a[offa + 23] = x13i;<NEW_LINE>a[offa + 24] = x3r;<NEW_LINE>a[offa + 25] = x3i;<NEW_LINE>a[offa + 26] = x11r;<NEW_LINE>a[offa + 27] = x11i;<NEW_LINE>a[offa + 28] = x7r;<NEW_LINE>a[offa + 29] = x7i;<NEW_LINE>} | a[offa + 15] = x14i; |
709,002 | private void notifyDeviceDisconnected(@NonNull final BluetoothDevice device, final int status) {<NEW_LINE>final boolean wasConnected = connected;<NEW_LINE>connected = false;<NEW_LINE>servicesDiscovered = false;<NEW_LINE>serviceDiscoveryRequested = false;<NEW_LINE>deviceNotSupported = false;<NEW_LINE>mtu = 23;<NEW_LINE>connectionState = BluetoothGatt.STATE_DISCONNECTED;<NEW_LINE>checkCondition();<NEW_LINE>if (!wasConnected) {<NEW_LINE>log(Log.WARN, () -> "Connection attempt timed out");<NEW_LINE>close();<NEW_LINE>postCallback(c -> c.onDeviceDisconnected(device));<NEW_LINE>postConnectionStateChange(o -> o.onDeviceFailedToConnect(device, status));<NEW_LINE>// ConnectRequest was already notified<NEW_LINE>} else if (userDisconnected) {<NEW_LINE>log(Log.INFO, () -> "Disconnected");<NEW_LINE>// If Remove Bond was called, the broadcast may be called AFTER the device has disconnected.<NEW_LINE>// In that case, we can't call close() here, as that would unregister the broadcast<NEW_LINE>// receiver. Instead, close() will be called from the receiver.<NEW_LINE>if (request == null || request.type != Request.Type.REMOVE_BOND)<NEW_LINE>close();<NEW_LINE>postCallback(c -> c.onDeviceDisconnected(device));<NEW_LINE>postConnectionStateChange(o -> o.onDeviceDisconnected(device, status));<NEW_LINE>final Request request = this.request;<NEW_LINE>if (request != null && request.type == Request.Type.DISCONNECT) {<NEW_LINE>request.notifySuccess(device);<NEW_LINE>this.request = null;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>log(Log.WARN, () -> "Connection lost");<NEW_LINE>postCallback(c <MASK><NEW_LINE>// When the device indicated disconnection, return the REASON_TERMINATE_PEER_USER.<NEW_LINE>// Otherwise, return REASON_LINK_LOSS.<NEW_LINE>// See: https://github.com/NordicSemiconductor/Android-BLE-Library/issues/284<NEW_LINE>final int reason = status == ConnectionObserver.REASON_TERMINATE_PEER_USER ? ConnectionObserver.REASON_TERMINATE_PEER_USER : ConnectionObserver.REASON_LINK_LOSS;<NEW_LINE>postConnectionStateChange(o -> o.onDeviceDisconnected(device, reason));<NEW_LINE>// We are not closing the connection here as the device should try to reconnect<NEW_LINE>// automatically.<NEW_LINE>// This may be only called when the shouldAutoConnect() method returned true.<NEW_LINE>}<NEW_LINE>for (final ValueChangedCallback callback : valueChangedCallbacks.values()) {<NEW_LINE>callback.notifyClosed();<NEW_LINE>}<NEW_LINE>valueChangedCallbacks.clear();<NEW_LINE>onServicesInvalidated();<NEW_LINE>onDeviceDisconnected();<NEW_LINE>} | -> c.onLinkLossOccurred(device)); |
1,754,781 | public Object instanceCreate() throws IOException, ClassNotFoundException {<NEW_LINE>try {<NEW_LINE>Document doc = XMLUtil.parse(new InputSource(obj.getPrimaryFile().toURL().toString()), true, false, XMLUtil.defaultErrorHandler(), EntityCatalog.getDefault());<NEW_LINE>Element el = doc.getDocumentElement();<NEW_LINE>if (!el.getNodeName().equals("helpsetref")) {<NEW_LINE>// NOI18N<NEW_LINE>throw new IOException();<NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>String url = el.getAttribute("url");<NEW_LINE>if (url == null || url.isEmpty()) {<NEW_LINE>throw new IOException("no url attr on <helpsetref>! doc.class=" + doc.getClass().getName() + " doc.documentElement=" + el);<NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>String <MASK><NEW_LINE>boolean merge = mergeS.isEmpty() || Boolean.valueOf(mergeS);<NEW_LINE>// Make sure nbdocs: protocol is ready:<NEW_LINE>// DO NOT DELETE THIS LINE<NEW_LINE>Object ignore = NbDocsStreamHandler.class;<NEW_LINE>HelpSet hs = new HelpSet(Lookup.getDefault().lookup(ClassLoader.class), new URL(url));<NEW_LINE>hs.setKeyData(HELPSET_MERGE_CONTEXT, HELPSET_MERGE_ATTR, merge);<NEW_LINE>return hs;<NEW_LINE>} catch (IOException x) {<NEW_LINE>throw x;<NEW_LINE>} catch (Exception x) {<NEW_LINE>throw new IOException(x);<NEW_LINE>}<NEW_LINE>} | mergeS = el.getAttribute("merge"); |
1,847,029 | // build reset offset info<NEW_LINE>private List<Tuple3<String, Integer, Long>> buildOffsetResetInfo(Set<String> topicSet) {<NEW_LINE>MessageStore store = null;<NEW_LINE>List<Tuple3<String, Integer, Long>> result = new ArrayList<>();<NEW_LINE>MessageStoreManager storeManager = broker.getStoreManager();<NEW_LINE>// get topic's partition set<NEW_LINE>Map<String, Set<Integer<MASK><NEW_LINE>// fill current topic's max offset value<NEW_LINE>for (Map.Entry<String, Set<Integer>> entry : topicPartMap.entrySet()) {<NEW_LINE>if (entry.getKey() == null || entry.getValue() == null || entry.getValue().isEmpty()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Set<Integer> partitionSet = entry.getValue();<NEW_LINE>for (Integer partId : partitionSet) {<NEW_LINE>// get topic store<NEW_LINE>try {<NEW_LINE>store = storeManager.getOrCreateMessageStore(entry.getKey(), partId);<NEW_LINE>} catch (Throwable e) {<NEW_LINE>//<NEW_LINE>}<NEW_LINE>if (store == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>result.add(new Tuple3<>(entry.getKey(), partId, store.getIndexMaxOffset()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | >> topicPartMap = getTopicPartitions(topicSet); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.