idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,678,043 | public void configure(ConfigurableProvider provider) {<NEW_LINE>provider.addAlgorithm("MessageDigest.DSTU7564-256", PREFIX + "$Digest256");<NEW_LINE>provider.addAlgorithm("MessageDigest.DSTU7564-384", PREFIX + "$Digest384");<NEW_LINE>provider.addAlgorithm("MessageDigest.DSTU7564-512", PREFIX + "$Digest512");<NEW_LINE>provider.addAlgorithm("MessageDigest", UAObjectIdentifiers.dstu7564digest_256, PREFIX + "$Digest256");<NEW_LINE>provider.addAlgorithm("MessageDigest", <MASK><NEW_LINE>provider.addAlgorithm("MessageDigest", UAObjectIdentifiers.dstu7564digest_512, PREFIX + "$Digest512");<NEW_LINE>addHMACAlgorithm(provider, "DSTU7564-256", PREFIX + "$HashMac256", PREFIX + "$KeyGenerator256");<NEW_LINE>addHMACAlgorithm(provider, "DSTU7564-384", PREFIX + "$HashMac384", PREFIX + "$KeyGenerator384");<NEW_LINE>addHMACAlgorithm(provider, "DSTU7564-512", PREFIX + "$HashMac512", PREFIX + "$KeyGenerator512");<NEW_LINE>addHMACAlias(provider, "DSTU7564-256", UAObjectIdentifiers.dstu7564mac_256);<NEW_LINE>addHMACAlias(provider, "DSTU7564-384", UAObjectIdentifiers.dstu7564mac_384);<NEW_LINE>addHMACAlias(provider, "DSTU7564-512", UAObjectIdentifiers.dstu7564mac_512);<NEW_LINE>} | UAObjectIdentifiers.dstu7564digest_384, PREFIX + "$Digest384"); |
374,033 | public static JavaRuntimeInfo from(RuleContext ruleContext, String attributeName) {<NEW_LINE>if (!ruleContext.attributes().has(attributeName, BuildType.LABEL)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>TransitiveInfoCollection <MASK><NEW_LINE>if (prerequisite == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>ToolchainInfo toolchainInfo = prerequisite.get(ToolchainInfo.PROVIDER);<NEW_LINE>if (toolchainInfo != null) {<NEW_LINE>try {<NEW_LINE>JavaRuntimeInfo result = (JavaRuntimeInfo) toolchainInfo.getValue("java_runtime");<NEW_LINE>if (result != null) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>} catch (EvalException e) {<NEW_LINE>ruleContext.ruleError(String.format("There was an error reading the Java runtime: %s", e));<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ruleContext.ruleError("The selected Java runtime is not a JavaRuntimeInfo");<NEW_LINE>return null;<NEW_LINE>} | prerequisite = ruleContext.getPrerequisite(attributeName); |
1,734,298 | public static ListVnAvailableInstancesResponse unmarshall(ListVnAvailableInstancesResponse listVnAvailableInstancesResponse, UnmarshallerContext context) {<NEW_LINE>listVnAvailableInstancesResponse.setRequestId(context.stringValue("ListVnAvailableInstancesResponse.RequestId"));<NEW_LINE>listVnAvailableInstancesResponse.setHttpStatusCode<MASK><NEW_LINE>listVnAvailableInstancesResponse.setCode(context.stringValue("ListVnAvailableInstancesResponse.Code"));<NEW_LINE>listVnAvailableInstancesResponse.setSuccess(context.booleanValue("ListVnAvailableInstancesResponse.Success"));<NEW_LINE>List<Instance> instances = new ArrayList<Instance>();<NEW_LINE>for (int i = 0; i < context.lengthValue("ListVnAvailableInstancesResponse.Instances.Length"); i++) {<NEW_LINE>Instance instance = new Instance();<NEW_LINE>instance.setInstanceId(context.stringValue("ListVnAvailableInstancesResponse.Instances[" + i + "].InstanceId"));<NEW_LINE>instance.setName(context.stringValue("ListVnAvailableInstancesResponse.Instances[" + i + "].Name"));<NEW_LINE>instance.setDescription(context.stringValue("ListVnAvailableInstancesResponse.Instances[" + i + "].Description"));<NEW_LINE>instance.setConcurrency(context.longValue("ListVnAvailableInstancesResponse.Instances[" + i + "].Concurrency"));<NEW_LINE>instances.add(instance);<NEW_LINE>}<NEW_LINE>listVnAvailableInstancesResponse.setInstances(instances);<NEW_LINE>return listVnAvailableInstancesResponse;<NEW_LINE>} | (context.integerValue("ListVnAvailableInstancesResponse.HttpStatusCode")); |
401,559 | public static void encodeResponseHeaders(ResteasyReactiveRequestContext requestContext) {<NEW_LINE>ServerHttpResponse vertxResponse = requestContext.serverResponse();<NEW_LINE>LazyResponse lazyResponse = requestContext.getResponse();<NEW_LINE>if (!lazyResponse.isCreated() && lazyResponse.isPredetermined()) {<NEW_LINE>// fast path<NEW_LINE>// there is no response, so we just set the content type<NEW_LINE>if (requestContext.getResponseEntity() == null) {<NEW_LINE>vertxResponse.setStatusCode(Response.Status.NO_CONTENT.getStatusCode());<NEW_LINE>}<NEW_LINE>EncodedMediaType contentType = requestContext.getResponseContentType();<NEW_LINE>if (contentType != null) {<NEW_LINE>vertxResponse.setResponseHeader(CONTENT_TYPE, contentType.toString());<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Response response = requestContext.getResponse().get();<NEW_LINE>vertxResponse.setStatusCode(response.getStatus());<NEW_LINE>// avoid using getStringHeaders() which does similar things but copies into yet another map<NEW_LINE>MultivaluedMap<String, Object> headers = response.getHeaders();<NEW_LINE>for (Map.Entry<String, List<Object>> entry : headers.entrySet()) {<NEW_LINE>if (entry.getValue().size() == 1) {<NEW_LINE>Object o = entry.getValue().get(0);<NEW_LINE>if (o == null) {<NEW_LINE>vertxResponse.setResponseHeader(<MASK><NEW_LINE>} else if (o instanceof CharSequence) {<NEW_LINE>vertxResponse.setResponseHeader(entry.getKey(), (CharSequence) o);<NEW_LINE>} else {<NEW_LINE>vertxResponse.setResponseHeader(entry.getKey(), (CharSequence) HeaderUtil.headerToString(o));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>List<CharSequence> strValues = new ArrayList<>(entry.getValue().size());<NEW_LINE>for (Object o : entry.getValue()) {<NEW_LINE>strValues.add(HeaderUtil.headerToString(o));<NEW_LINE>}<NEW_LINE>vertxResponse.setResponseHeader(entry.getKey(), strValues);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | entry.getKey(), ""); |
940,016 | final SynthesizeSpeechResult executeSynthesizeSpeech(SynthesizeSpeechRequest synthesizeSpeechRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(synthesizeSpeechRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<SynthesizeSpeechRequest> request = null;<NEW_LINE>Response<SynthesizeSpeechResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new SynthesizeSpeechRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(synthesizeSpeechRequest));<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, "Polly");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "SynthesizeSpeech");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<SynthesizeSpeechResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(false).withHasStreamingSuccessResponse(true), new SynthesizeSpeechResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>request.addHandlerContext(HandlerContextKey.HAS_STREAMING_OUTPUT, Boolean.TRUE);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.endEvent(Field.RequestMarshallTime); |
1,592,460 | public void send(Object message, boolean sent) throws RemotingException {<NEW_LINE>super.send(message, sent);<NEW_LINE>boolean success = true;<NEW_LINE>int timeout = 0;<NEW_LINE>try {<NEW_LINE>ChannelFuture future = channel.write(message);<NEW_LINE>if (sent) {<NEW_LINE>timeout = getUrl().getPositiveParameter(TIMEOUT_KEY, DEFAULT_TIMEOUT);<NEW_LINE>success = future.await(timeout);<NEW_LINE>}<NEW_LINE>Throwable cause = future.getCause();<NEW_LINE>if (cause != null) {<NEW_LINE>throw cause;<NEW_LINE>}<NEW_LINE>} catch (Throwable e) {<NEW_LINE>throw new RemotingException(this, "Failed to send message " + PayloadDropper.getRequestWithoutData(message) + " to " + getRemoteAddress() + ", cause: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>if (!success) {<NEW_LINE>throw new RemotingException(this, "Failed to send message " + PayloadDropper.getRequestWithoutData(message) + " to " + getRemoteAddress(<MASK><NEW_LINE>}<NEW_LINE>} | ) + "in timeout(" + timeout + "ms) limit"); |
1,190,503 | private StreamHolder payloadToInputStream(Message<?> message) throws MessageDeliveryException {<NEW_LINE>Object payload = message.getPayload();<NEW_LINE>try {<NEW_LINE>if (payload instanceof File) {<NEW_LINE>File inputFile = (File) payload;<NEW_LINE>if (inputFile.exists()) {<NEW_LINE>return new StreamHolder(new BufferedInputStream(new FileInputStream(inputFile)), inputFile.getAbsolutePath());<NEW_LINE>}<NEW_LINE>} else if (payload instanceof byte[] || payload instanceof String) {<NEW_LINE>byte[] bytes;<NEW_LINE>String name;<NEW_LINE>if (payload instanceof String) {<NEW_LINE>bytes = ((String) payload).getBytes(this.charset);<NEW_LINE>name = "String payload";<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>name = "byte[] payload";<NEW_LINE>}<NEW_LINE>return new StreamHolder(new ByteArrayInputStream(bytes), name);<NEW_LINE>} else if (payload instanceof InputStream) {<NEW_LINE>return new StreamHolder((InputStream) payload, "InputStream payload");<NEW_LINE>} else if (payload instanceof Resource) {<NEW_LINE>Resource resource = (Resource) payload;<NEW_LINE>String filename = resource.getFilename();<NEW_LINE>return new StreamHolder(resource.getInputStream(), filename != null ? filename : "Resource payload");<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("Unsupported payload type [" + payload.getClass().getName() + "]. The only supported payloads are " + "java.io.File, java.lang.String, byte[], and InputStream");<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new MessageDeliveryException(message, "Failed to create sendable file.", e);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | bytes = (byte[]) payload; |
104,461 | protected String doIt() throws IOException, DocumentException {<NEW_LINE>final Properties ctx = Env.getCtx();<NEW_LINE>final String trxName = ITrx.TRXNAME_None;<NEW_LINE>final String outputDir = Services.get(ISysConfigBL.class).getValue(SYSCONFIG_PdfDownloadPath);<NEW_LINE>final String fileName = "printjobs_" + getPinstanceId().getRepoId();<NEW_LINE>final I_C_Print_Job job = InterfaceWrapperHelper.create(ctx, printJobID, I_C_Print_Job.class, trxName);<NEW_LINE>final Iterator<I_C_Print_Job_Line> jobLines = Services.get(IPrintingDAO.class).retrievePrintJobLines(job);<NEW_LINE>if (!jobLines.hasNext()) {<NEW_LINE>return "No print job lines found. Pdf not generated.";<NEW_LINE>}<NEW_LINE>final File file;<NEW_LINE>if (Check.isEmpty(outputDir, true)) {<NEW_LINE>file = File.createTempFile(fileName, ".pdf");<NEW_LINE>} else {<NEW_LINE>file = new File(outputDir, fileName + ".pdf");<NEW_LINE>}<NEW_LINE>final Document document = new Document();<NEW_LINE>final FileOutputStream fos = new FileOutputStream(file, false);<NEW_LINE>final PdfCopy copy = new PdfCopy(document, fos);<NEW_LINE>document.open();<NEW_LINE>for (final I_C_Print_Job_Line jobLine : IteratorUtils.asIterable(jobLines)) {<NEW_LINE>final I_C_Printing_Queue queue = jobLine.getC_Printing_Queue();<NEW_LINE>Check.assume(queue != null, jobLine + " references a C_Printing_Queue");<NEW_LINE>final I_AD_Archive archive = queue.getAD_Archive();<NEW_LINE>Check.assume(<MASK><NEW_LINE>final byte[] data = Services.get(IArchiveBL.class).getBinaryData(archive);<NEW_LINE>final PdfReader reader = new PdfReader(data);<NEW_LINE>for (int page = 0; page < reader.getNumberOfPages(); ) {<NEW_LINE>copy.addPage(copy.getImportedPage(reader, ++page));<NEW_LINE>}<NEW_LINE>copy.freeReader(reader);<NEW_LINE>reader.close();<NEW_LINE>}<NEW_LINE>document.close();<NEW_LINE>fos.close();<NEW_LINE>outputFile = new File(outputDir);<NEW_LINE>return "@Created@ " + fileName + ".pdf" + " in " + outputDir;<NEW_LINE>} | archive != null, queue + " references an AD_Archive record"); |
698,677 | final UpdateEnvironmentResult executeUpdateEnvironment(UpdateEnvironmentRequest updateEnvironmentRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateEnvironmentRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateEnvironmentRequest> request = null;<NEW_LINE>Response<UpdateEnvironmentResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdateEnvironmentRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateEnvironmentRequest));<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, "finspace");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateEnvironment");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpdateEnvironmentResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(<MASK><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>} | false), new UpdateEnvironmentResultJsonUnmarshaller()); |
473,296 | public static void main(String[] args) {<NEW_LINE>PackManager.v().getPack("wjpp").add(new Transform("wjpp.inlineReflCalls", new ReflectiveCallsInliner()));<NEW_LINE>final Scene scene = Scene.v();<NEW_LINE>scene.addBasicClass(Object.class.getName());<NEW_LINE>scene.addBasicClass(SootSig.class.getName(), SootClass.BODIES);<NEW_LINE>scene.addBasicClass(UnexpectedReflectiveCall.class.getName(), SootClass.BODIES);<NEW_LINE>scene.addBasicClass(IUnexpectedReflectiveCallHandler.class.getName(), SootClass.BODIES);<NEW_LINE>scene.addBasicClass(DefaultHandler.class.getName(), SootClass.BODIES);<NEW_LINE>scene.addBasicClass(OpaquePredicate.class.getName(), SootClass.BODIES);<NEW_LINE>scene.addBasicClass(ReflectiveCalls.class.getName(), SootClass.BODIES);<NEW_LINE>ArrayList<String> argList = new ArrayList<String>(Arrays.asList(args));<NEW_LINE>argList.add("-w");<NEW_LINE>argList.add("-p");<NEW_LINE>argList.add("cg");<NEW_LINE>argList.add("enabled:false");<NEW_LINE>argList.add("-app");<NEW_LINE>Options.v().set_keep_line_number(true);<NEW_LINE>logger.debug("TamiFlex Booster Version " + ReflInliner.class.getPackage().getImplementationVersion());<NEW_LINE>try {<NEW_LINE>soot.Main.main(argList.toArray(new String[0]));<NEW_LINE>} catch (CompilationDeathException e) {<NEW_LINE>logger.debug("\nERROR: " + e.getMessage() + "\n");<NEW_LINE><MASK><NEW_LINE>if (Options.v().verbose()) {<NEW_LINE>throw e;<NEW_LINE>} else {<NEW_LINE>logger.debug("Use -verbose to see stack trace.");<NEW_LINE>}<NEW_LINE>usage();<NEW_LINE>}<NEW_LINE>} | logger.debug("The command-line options are described at:\n" + "http://www.sable.mcgill.ca/soot/tutorial/usage/index.html"); |
581,028 | public List<String> tokenize(String text, Language lang) {<NEW_LINE>List<String> result = new ArrayList<String>();<NEW_LINE>if ((text == null) || (text.length() == 0)) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>if ((lang == null) || (lang.getLang() == null)) {<NEW_LINE>// default Indo-European languages<NEW_LINE>result = GrobidDefaultAnalyzer.getInstance().tokenize(text);<NEW_LINE>} else if (lang.isJapaneses()) {<NEW_LINE>// Japanese analyser<NEW_LINE>if (jaAnalyzer == null)<NEW_LINE>jaAnalyzer = ReTokenizerFactory.create("ja_g");<NEW_LINE>result = jaAnalyzer.tokensAsList(text);<NEW_LINE>} else if (lang.isChinese()) {<NEW_LINE>// Chinese analyser<NEW_LINE>if (zhAnalyzer == null)<NEW_LINE>zhAnalyzer = ReTokenizerFactory.create("zh_g");<NEW_LINE>result = zhAnalyzer.tokensAsList(text);<NEW_LINE>} else if (lang.isKorean()) {<NEW_LINE>// Korean analyser<NEW_LINE>if (krAnalyzer == null)<NEW_LINE>krAnalyzer = ReTokenizerFactory.create("kr_g");<NEW_LINE>result = krAnalyzer.tokensAsList(text);<NEW_LINE>} else if (lang.isArabic()) {<NEW_LINE>// Arabic analyser<NEW_LINE>result = GrobidDefaultAnalyzer.getInstance().tokenize(text);<NEW_LINE>int p = 0;<NEW_LINE>for (String token : result) {<NEW_LINE>// string being immutable in Java, I think we can't do better that this:<NEW_LINE>StringBuilder newToken = new StringBuilder();<NEW_LINE>for (int i = 0; i < token.length(); i++) {<NEW_LINE>newToken.append(ArabicChars.arabicCharacters(token.charAt(i)));<NEW_LINE>}<NEW_LINE>result.set(p, newToken.toString());<NEW_LINE>p++;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// default Indo-European languages<NEW_LINE>result = GrobidDefaultAnalyzer.<MASK><NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error("Invalid tokenizer", e);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | getInstance().tokenize(text); |
893,542 | public static void main(String[] args) {<NEW_LINE>boolean verbose = false;<NEW_LINE>for (String s : args) {<NEW_LINE>if ("-v".equals(s)) {<NEW_LINE>verbose = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (verbose) {<NEW_LINE>System.out.println("These are the lookup table sizes required for each floating point type:");<NEW_LINE>} else {<NEW_LINE>System.out.println("floating_point_type,table_size_1,table_size_2,total_size");<NEW_LINE>}<NEW_LINE>for (FloatingPointFormat format : FloatingPointFormat.values()) {<NEW_LINE>int minE2 = 1 - format.bias() - format.mantissaBits() - 2;<NEW_LINE>int maxE2 = ((1 << format.exponentBits()) - 2) - format.bias() - format.mantissaBits() - 2;<NEW_LINE>long minQ, maxQ;<NEW_LINE>if (format == FloatingPointFormat.FLOAT32) {<NEW_LINE>// Float32 is special; using -1 as below is problematic as it would require 33 bit<NEW_LINE>// integers. Instead, we compute the additionally required digit separately.<NEW_LINE>minQ = (-minE2 * LOG10_5_NUMERATOR) / LOG10_5_DENOMINATOR;<NEW_LINE>maxQ = (maxE2 * LOG10_2_NUMERATOR) / LOG10_2_DENOMINATOR;<NEW_LINE>} else {<NEW_LINE>minQ = Math.max(0, (-minE2 <MASK><NEW_LINE>maxQ = Math.max(0, (maxE2 * LOG10_2_NUMERATOR) / LOG10_2_DENOMINATOR - 1);<NEW_LINE>}<NEW_LINE>long negTableSize = (-minE2 - minQ) + 1;<NEW_LINE>long posTableSize = maxQ + 1;<NEW_LINE>if (verbose) {<NEW_LINE>System.out.println(format);<NEW_LINE>System.out.println(" " + minE2 + " <= e_2 <= " + maxE2);<NEW_LINE>System.out.println(" " + (-minQ) + " <= q <= " + maxQ);<NEW_LINE>System.out.println(" Total table size = " + negTableSize + " + " + posTableSize + " = " + (negTableSize + posTableSize));<NEW_LINE>} else {<NEW_LINE>System.out.println(format + "," + negTableSize + "," + posTableSize + "," + (negTableSize + posTableSize));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | * LOG10_5_NUMERATOR) / LOG10_5_DENOMINATOR - 1); |
1,485,398 | protected void execute(ThreadPoolRunStateInfo poolRunStateInfo) {<NEW_LINE>EsThreadPoolRunStateInfo esThreadPoolRunStateInfo = new EsThreadPoolRunStateInfo();<NEW_LINE>BeanUtil.copyProperties(poolRunStateInfo, esThreadPoolRunStateInfo);<NEW_LINE>Environment environment = ApplicationContextHolder.getInstance().getEnvironment();<NEW_LINE>String indexName = environment.getProperty("es.thread-pool-state.index.name", "thread-pool-state");<NEW_LINE>String applicationName = environment.getProperty("spring.application.name", "application");<NEW_LINE>if (!this.isExists(indexName)) {<NEW_LINE>List<String> rawMapping = FileUtil.readLines(new File(Thread.currentThread().getContextClassLoader().getResource("mapping.json").getPath()), StandardCharsets.UTF_8);<NEW_LINE>String mapping = String.join(" ", rawMapping);<NEW_LINE>// if index doesn't exsit, this function may try to create one, but recommend to create index manually.<NEW_LINE>this.createIndex(indexName, "_doc", <MASK><NEW_LINE>}<NEW_LINE>esThreadPoolRunStateInfo.setApplicationName(applicationName);<NEW_LINE>esThreadPoolRunStateInfo.setId(indexName + "-" + System.currentTimeMillis());<NEW_LINE>this.log2Es(esThreadPoolRunStateInfo, indexName);<NEW_LINE>} | mapping, null, null, null); |
769,004 | private void auditEventJMXMBean01(Object[] methodParams) {<NEW_LINE>Object[] varargs = (Object[]) methodParams[1];<NEW_LINE>ObjectName name = (ObjectName) varargs[0];<NEW_LINE>String className = (String) varargs[1];<NEW_LINE>ObjectName loader = (ObjectName) varargs[2];<NEW_LINE>String operationName = (String) varargs[3];<NEW_LINE>Object[] params = (Object[]) varargs[4];<NEW_LINE>String[] signature = (String[]) varargs[5];<NEW_LINE>QueryExp query = (QueryExp) varargs[6];<NEW_LINE>String action = (String) varargs[7];<NEW_LINE>String outcome = (String) varargs[8];<NEW_LINE>String outcomeReason = (String) varargs[9];<NEW_LINE>if (auditServiceRef.getService() != null && auditServiceRef.getService().isAuditRequired(AuditConstants.JMX_MBEAN, outcome)) {<NEW_LINE>JMXMBeanEvent je = new JMXMBeanEvent(name, className, loader, operationName, params, signature, <MASK><NEW_LINE>auditServiceRef.getService().sendEvent(je);<NEW_LINE>}<NEW_LINE>} | query, action, outcome, outcomeReason); |
362,605 | protected void updateContent() {<NEW_LINE>RoutingHelper routingHelper = mapActivity.getRoutingHelper();<NEW_LINE>view.findViewById(R.id.dividerToDropDown).setVisibility(View.VISIBLE);<NEW_LINE>view.findViewById(R.id.route_info_details_card).setVisibility(View.VISIBLE);<NEW_LINE>View info = view.findViewById(R.id.info_container);<NEW_LINE>info.setOnClickListener(v -> notifyCardPressed());<NEW_LINE>ImageView infoIcon = (ImageView) view.findViewById(R.id.InfoIcon);<NEW_LINE>ImageView durationIcon = (ImageView) view.findViewById(R.id.DurationIcon);<NEW_LINE>View infoDistanceView = view.findViewById(R.id.InfoDistance);<NEW_LINE>View infoDurationView = view.findViewById(R.id.InfoDuration);<NEW_LINE>infoIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_route_distance));<NEW_LINE>infoIcon.setVisibility(View.VISIBLE);<NEW_LINE>durationIcon.setImageDrawable(getContentIcon(R.drawable.ic_action_time_span));<NEW_LINE>durationIcon.setVisibility(View.VISIBLE);<NEW_LINE>infoDistanceView.setVisibility(View.VISIBLE);<NEW_LINE>infoDurationView.setVisibility(View.VISIBLE);<NEW_LINE>TextView distanceText = (TextView) view.findViewById(R.id.DistanceText);<NEW_LINE>TextView durationText = (TextView) view.findViewById(R.id.DurationText);<NEW_LINE>TextView durationTitle = (TextView) view.findViewById(R.id.DurationTitle);<NEW_LINE>distanceText.setText(OsmAndFormatter.getFormattedDistance(routingHelper.getLeftDistance(), app));<NEW_LINE>durationText.setText(OsmAndFormatter.getFormattedDuration(routingHelper.getLeftTime(), app));<NEW_LINE>durationTitle.setText(app.getString(R.string.arrive_at_time, OsmAndFormatter.getFormattedTime(routingHelper.<MASK><NEW_LINE>view.findViewById(R.id.details_button).setOnClickListener(v -> notifyButtonPressed(0));<NEW_LINE>FrameLayout detailsButton = view.findViewById(R.id.details_button);<NEW_LINE>AndroidUtils.setBackground(app, detailsButton, nightMode, R.drawable.btn_border_light, R.drawable.btn_border_dark);<NEW_LINE>AndroidUtils.setBackground(app, view.findViewById(R.id.details_button_descr), nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);<NEW_LINE>buildHeader(view);<NEW_LINE>} | getLeftTime(), true))); |
519,132 | public boolean execute(Object result) throws ContractExeException {<NEW_LINE>TransactionResultCapsule ret = (TransactionResultCapsule) result;<NEW_LINE>if (Objects.isNull(ret)) {<NEW_LINE>throw new RuntimeException(ActuatorConstant.TX_RESULT_NULL);<NEW_LINE>}<NEW_LINE>final SetAccountIdContract setAccountIdContract;<NEW_LINE>final long fee = calcFee();<NEW_LINE>AccountStore accountStore = chainBaseManager.getAccountStore();<NEW_LINE>AccountIdIndexStore accountIdIndexStore = chainBaseManager.getAccountIdIndexStore();<NEW_LINE>try {<NEW_LINE>setAccountIdContract = any.unpack(SetAccountIdContract.class);<NEW_LINE>} catch (InvalidProtocolBufferException e) {<NEW_LINE>logger.debug(e.getMessage(), e);<NEW_LINE>ret.setStatus(fee, code.FAILED);<NEW_LINE>throw new ContractExeException(e.getMessage());<NEW_LINE>}<NEW_LINE>byte[] ownerAddress = setAccountIdContract<MASK><NEW_LINE>AccountCapsule account = accountStore.get(ownerAddress);<NEW_LINE>account.setAccountId(setAccountIdContract.getAccountId().toByteArray());<NEW_LINE>accountStore.put(ownerAddress, account);<NEW_LINE>accountIdIndexStore.put(account);<NEW_LINE>ret.setStatus(fee, code.SUCESS);<NEW_LINE>return true;<NEW_LINE>} | .getOwnerAddress().toByteArray(); |
1,628,853 | private void readCommonParameters(Class<?> cls) {<NEW_LINE>Path path = AnnotationUtils.findAnnotation(cls, Path.class);<NEW_LINE>if (path != null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<Method> filteredMethods = getFilteredMethods(cls);<NEW_LINE>for (Method method : filteredMethods) {<NEW_LINE>path = AnnotationUtils.findAnnotation(method, Path.class);<NEW_LINE>if (path != null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String httpMethod = extractOperationMethod(null, method, SwaggerExtensions.chain());<NEW_LINE>if (httpMethod != null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Field[<MASK><NEW_LINE>for (Field field : fields) {<NEW_LINE>Annotation[] annotations = field.getAnnotations();<NEW_LINE>if (annotations.length > 0) {<NEW_LINE>List<Parameter> params = getParameters(cls, Arrays.asList(annotations));<NEW_LINE>for (Parameter param : params) {<NEW_LINE>if (hasCommonParameter(param)) {<NEW_LINE>String msg = "[" + cls.getCanonicalName() + "] Redefining common parameter '" + param.getName() + "' already defined elsewhere";<NEW_LINE>throw new RuntimeException(msg);<NEW_LINE>}<NEW_LINE>swagger.addParameter(param.getName(), param);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ] fields = cls.getDeclaredFields(); |
1,246,897 | public ClassSetAnalysisData read(Decoder decoder) throws Exception {<NEW_LINE>HierarchicalNameSerializer hierarchicalNameSerializer = classNameSerializerSupplier.get();<NEW_LINE>DependentSetSerializer dependentSetSerializer = new DependentSetSerializer(() -> hierarchicalNameSerializer);<NEW_LINE>int count = decoder.readSmallInt();<NEW_LINE>ImmutableMap.Builder<String, HashCode> classHashes = ImmutableMap.builderWithExpectedSize(count);<NEW_LINE>for (int i = 0; i < count; i++) {<NEW_LINE>String className = hierarchicalNameSerializer.read(decoder);<NEW_LINE>HashCode hashCode = hashCodeSerializer.read(decoder);<NEW_LINE>classHashes.put(className, hashCode);<NEW_LINE>}<NEW_LINE>count = decoder.readSmallInt();<NEW_LINE>ImmutableMap.Builder<String, DependentsSet> dependentsBuilder = ImmutableMap.builderWithExpectedSize(count);<NEW_LINE>for (int i = 0; i < count; i++) {<NEW_LINE>String className = hierarchicalNameSerializer.read(decoder);<NEW_LINE>DependentsSet <MASK><NEW_LINE>dependentsBuilder.put(className, dependents);<NEW_LINE>}<NEW_LINE>count = decoder.readSmallInt();<NEW_LINE>ImmutableMap.Builder<String, IntSet> classesToConstantsBuilder = ImmutableMap.builderWithExpectedSize(count);<NEW_LINE>for (int i = 0; i < count; i++) {<NEW_LINE>String className = hierarchicalNameSerializer.read(decoder);<NEW_LINE>IntSet constants = IntSetSerializer.INSTANCE.read(decoder);<NEW_LINE>classesToConstantsBuilder.put(className, constants);<NEW_LINE>}<NEW_LINE>String fullRebuildCause = decoder.readNullableString();<NEW_LINE>return new ClassSetAnalysisData(classHashes.build(), dependentsBuilder.build(), classesToConstantsBuilder.build(), fullRebuildCause);<NEW_LINE>} | dependents = dependentSetSerializer.read(decoder); |
477,580 | public static BinaryTableWriter<DragstrLocus> dragenWriter(final OutputStream out, final OutputStream indexOut, final String path) {<NEW_LINE>final ByteBuffer buffer = ByteBuffer.allocate(Integer.BYTES * 3 + Short.BYTES + 2 * Byte.BYTES);<NEW_LINE>buffer.order(ByteOrder.LITTLE_ENDIAN);<NEW_LINE>return binaryWriter(out, indexOut, path, (record, output) -> {<NEW_LINE>buffer.clear();<NEW_LINE>buffer.putInt((int) record.getMask());<NEW_LINE>buffer.putInt(record.getChromosomeIndex());<NEW_LINE>buffer.putInt((int) record.getStart() - 1);<NEW_LINE>buffer.putShort(record.getLength());<NEW_LINE>buffer.put((byte) record.getPeriod());<NEW_LINE>// DRAGEN caps repeat lengths to 20, the default max period.<NEW_LINE>buffer.put((byte) Math.min(DragstrHyperParameters.DEFAULT_MAX_PERIOD<MASK><NEW_LINE>output.write(buffer.array());<NEW_LINE>});<NEW_LINE>} | , record.getRepeats())); |
420,004 | public static void createT_Selection_Browse(int AD_PInstance_ID, LinkedHashMap<Integer, LinkedHashMap<String, Object>> selection, String trxName) {<NEW_LINE>StringBuilder insert = new StringBuilder();<NEW_LINE>insert.append("INSERT INTO " + "T_Selection_Browse (AD_PInstance_ID, T_Selection_ID, ColumnName , Value_String, Value_Number , Value_Date) " + "VALUES(?,?,?,?,?,?) ");<NEW_LINE>for (Entry<Integer, LinkedHashMap<String, Object>> records : selection.entrySet()) {<NEW_LINE>// set Record ID<NEW_LINE>LinkedHashMap<String, Object> fields = records.getValue();<NEW_LINE>for (Entry<String, Object> field : fields.entrySet()) {<NEW_LINE>List<Object> parameters = new ArrayList<Object>();<NEW_LINE>parameters.add(AD_PInstance_ID);<NEW_LINE>parameters.add(records.getKey());<NEW_LINE>parameters.add(field.getKey());<NEW_LINE>Object data = field.getValue();<NEW_LINE>// set Values<NEW_LINE>if (data instanceof String) {<NEW_LINE>parameters.add(data);<NEW_LINE>parameters.add(null);<NEW_LINE>parameters.add(null);<NEW_LINE>} else if (data instanceof BigDecimal || data instanceof Integer || data instanceof Double) {<NEW_LINE>parameters.add(null);<NEW_LINE>if (data instanceof Double) {<NEW_LINE>BigDecimal value = BigDecimal.valueOf((Double) data);<NEW_LINE>parameters.add(value);<NEW_LINE>} else<NEW_LINE>parameters.add(data);<NEW_LINE>parameters.add(null);<NEW_LINE>} else if (data instanceof Integer) {<NEW_LINE>parameters.add(null);<NEW_LINE>parameters.add((Integer) data);<NEW_LINE>parameters.add(null);<NEW_LINE>} else if (data instanceof Timestamp || data instanceof Date) {<NEW_LINE>parameters.add(null);<NEW_LINE>parameters.add(null);<NEW_LINE>if (data instanceof Date) {<NEW_LINE>Timestamp value = new Timestamp(((Date<MASK><NEW_LINE>parameters.add(value);<NEW_LINE>} else<NEW_LINE>parameters.add(data);<NEW_LINE>} else {<NEW_LINE>parameters.add(data);<NEW_LINE>parameters.add(null);<NEW_LINE>parameters.add(null);<NEW_LINE>}<NEW_LINE>DB.executeUpdateEx(insert.toString(), parameters.toArray(), null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ) data).getTime()); |
1,651,352 | public OLCand toOLCand(@NonNull final I_C_OLCand record) {<NEW_LINE>final OrderLineGroup orderLineGroup = Check.isBlank(record.getCompensationGroupKey()) ? null : OrderLineGroup.builder().groupKey(record.getCompensationGroupKey()).isGroupingError(record.isGroupingError()).groupingErrorMessage(record.getGroupingErrorMessage()).discount(Percent.ofNullable(record.getGroupCompensationDiscountPercentage())).build();<NEW_LINE>final Quantity qtyItemCapacity = olCandEffectiveValuesBL.getQtyItemCapacity_Effective(record);<NEW_LINE>return OLCand.builder().olCandEffectiveValuesBL(olCandEffectiveValuesBL).olCandRecord(record).pricingSystemId(PricingSystemId.ofRepoIdOrNull(record.getM_PricingSystem_ID())).deliveryRule(DeliveryRule.ofNullableCode(record.getDeliveryRule())).deliveryViaRule(DeliveryViaRule.ofNullableCode(record.getDeliveryViaRule())).shipperId(ShipperId.ofRepoIdOrNull(record.getM_Shipper_ID())).paymentRule(PaymentRule.ofNullableCode(record.getPaymentRule())).paymentTermId(PaymentTermId.ofRepoIdOrNull(record.getC_PaymentTerm_ID())).salesRepId(BPartnerId.ofRepoIdOrNull(record.getC_BPartner_SalesRep_ID())).orderDocTypeId(DocTypeId.ofRepoIdOrNull(record.getC_DocTypeOrder_ID())).orderLineGroup(orderLineGroup).asyncBatchId(AsyncBatchId.ofRepoIdOrNull(record.getC_Async_Batch_ID())).qtyItemCapacityEff(qtyItemCapacity).salesRepInternalId(BPartnerId.ofRepoIdOrNull(record.getC_BPartner_SalesRep_Internal_ID())).assignSalesRepRule(AssignSalesRepRule.ofCode(record.getApplySalesRepFrom())).bpartnerName(record.getBPartnerName()).email(record.getEMail()).phone(record.<MASK><NEW_LINE>} | getPhone()).build(); |
70,900 | private static void addMember(PythonLanguage language, Object clsPtr, Object tpDictPtr, Object namePtr, int memberType, int offset, int canSet, Object docPtr, AsPythonObjectNode asPythonObjectNode, CastToJavaStringNode castToJavaStringNode, FromCharPointerNode fromCharPointerNode, InteropLibrary docPtrLib, PythonObjectFactory factory, WriteAttributeToDynamicObjectNode writeDocNode, HashingStorageLibrary dictStorageLib) {<NEW_LINE>Object clazz = asPythonObjectNode.execute(clsPtr);<NEW_LINE>PDict tpDict = castPDict(asPythonObjectNode.execute(tpDictPtr));<NEW_LINE>String memberName;<NEW_LINE>try {<NEW_LINE>memberName = castToJavaStringNode.execute<MASK><NEW_LINE>} catch (CannotCastException e) {<NEW_LINE>throw CompilerDirectives.shouldNotReachHere("Cannot cast member name to string");<NEW_LINE>}<NEW_LINE>// note: 'doc' may be NULL; in this case, we would store 'None'<NEW_LINE>Object memberDoc = CharPtrToJavaObjectNode.run(docPtr, fromCharPointerNode, docPtrLib);<NEW_LINE>PBuiltinFunction getterObject = ReadMemberNode.createBuiltinFunction(language, clazz, memberName, memberType, offset);<NEW_LINE>Object setterObject = null;<NEW_LINE>if (canSet != 0) {<NEW_LINE>setterObject = WriteMemberNode.createBuiltinFunction(language, clazz, memberName, memberType, offset);<NEW_LINE>}<NEW_LINE>// create member descriptor<NEW_LINE>GetSetDescriptor memberDescriptor = factory.createMemberDescriptor(getterObject, setterObject, memberName, clazz);<NEW_LINE>writeDocNode.execute(memberDescriptor, SpecialAttributeNames.__DOC__, memberDoc);<NEW_LINE>// add member descriptor to tp_dict<NEW_LINE>HashingStorage dictStorage = tpDict.getDictStorage();<NEW_LINE>HashingStorage updatedStorage = dictStorageLib.setItem(dictStorage, memberName, memberDescriptor);<NEW_LINE>if (dictStorage != updatedStorage) {<NEW_LINE>tpDict.setDictStorage(updatedStorage);<NEW_LINE>}<NEW_LINE>} | (asPythonObjectNode.execute(namePtr)); |
275,265 | public void testPersistentExecPolling(HttpServletRequest request, HttpServletResponse response) throws Exception {<NEW_LINE>int numPersistentExecs = Integer.parseInt(request.getParameter("numPersistentExecs"));<NEW_LINE>final long[] expectedDelays = new long[numPersistentExecs];<NEW_LINE>final long[] alternateExpectedDelays = new long[numPersistentExecs];<NEW_LINE>long[] delays = new long[numPersistentExecs];<NEW_LINE>int attempts = 0;<NEW_LINE>// initialize expectedDelays to {0,1,2...}<NEW_LINE>// initialize alternateExpectedDelays to {-1,0,1...}<NEW_LINE>for (int i = 0; i < expectedDelays.length; i++) {<NEW_LINE>expectedDelays[i] = i;<NEW_LINE>alternateExpectedDelays[i] = i - 1;<NEW_LINE>}<NEW_LINE>while (attempts < 100) {<NEW_LINE>attempts++;<NEW_LINE>collectDelays(delays);<NEW_LINE>Arrays.sort(delays);<NEW_LINE>System.out.println("persistent executor delays: " + Arrays.toString(delays));<NEW_LINE>if (Arrays.equals(expectedDelays, delays) || Arrays.equals(alternateExpectedDelays, delays)) {<NEW_LINE>// We got passing results.<NEW_LINE>response.getWriter().println("PASSED");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Wait at least one poll interval to try again.<NEW_LINE>Thread.sleep(1100);<NEW_LINE>}<NEW_LINE>// We failed to get expected delay values. Returns the delay values we got for debug.<NEW_LINE>response.getWriter().println<MASK><NEW_LINE>} | (Arrays.toString(delays)); |
53,339 | private String remount(String key) {<NEW_LINE>List<String> segments = Splitter.on('.').splitToList(key);<NEW_LINE>segments.forEach(segment -> Preconditions.checkArgument(!Strings.isNullOrEmpty(segment)));<NEW_LINE>JsonNode scope = mounts.getInternalObjectNode();<NEW_LINE>int i = 0;<NEW_LINE>while (true) {<NEW_LINE>String segment = segments.get(i);<NEW_LINE>JsonNode node = scope.get(segment);<NEW_LINE>if (node == null) {<NEW_LINE>// Key falls outside the override scope. No remount.<NEW_LINE>return key;<NEW_LINE>}<NEW_LINE>if (node.isObject()) {<NEW_LINE>// Dig deeper<NEW_LINE>i++;<NEW_LINE>if (i >= segments.size()) {<NEW_LINE>// Key ended before we reached a leaf. No override.<NEW_LINE>return key;<NEW_LINE>}<NEW_LINE>scope = node;<NEW_LINE>} else if (node.isTextual()) {<NEW_LINE>// Reached a path-overriding grant leaf.<NEW_LINE>List<String> remainder = segments.subList(i + 1, segments.size());<NEW_LINE>List<String> base = Splitter.on('.').splitToList(node.asText());<NEW_LINE>String remounted = FluentIterable.from(base).append(remainder).join(Joiner.on('.'));<NEW_LINE>return remounted;<NEW_LINE>} else if (node.isBoolean() && node.asBoolean()) {<NEW_LINE>// Reached a grant leaf.<NEW_LINE>logger.warn("Granting access to secrets in '_secrets' is deprecated. All secrets are accessible by default.");<NEW_LINE>return key;<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | throw new ConfigException("Illegal value in _secrets: " + node); |
1,745,558 | public void collectLocalVariableAssignment(LocalVariable localVariable, StatementContainer<StructuredStatement> statementContainer, Expression value) {<NEW_LINE>// Ensure type clashes are collapsed, otherwise PairTest3 gets duplicate definitions.<NEW_LINE>localVariable.getInferredJavaType().collapseTypeClash();<NEW_LINE>// Note that just because two local variables in the same scope have the same name, they're not NECESSARILY<NEW_LINE>// the same variable - if we've reused a stack location, and don't have any naming hints, the name will have<NEW_LINE>// been re-used. This is why we also have to verify that the type of the new assignment is the same as the type<NEW_LINE>// of the previous one, and kick out the previous (and remove from earlier scopes) if that's the case).<NEW_LINE><MASK><NEW_LINE>ScopeDefinition previousDef = earliestDefinition.get(name);<NEW_LINE>JavaTypeInstance newType = localVariable.getInferredJavaType().getJavaTypeInstance();<NEW_LINE>if (// Doesn't exist at this level.<NEW_LINE>// Total bodge - catch statements.<NEW_LINE>previousDef == null || (previousDef.getDepth() == currentDepth && previousDef.getExactStatement() != null && previousDef.getExactStatement().getStatement() instanceof StructuredCatch)) {<NEW_LINE>// First use is here.<NEW_LINE>ScopeDefinition scopeDefinition = new ScopeDefinition(currentDepth, currentBlock, statementContainer, localVariable, newType, name, null, true);<NEW_LINE>earliestDefinition.put(name, scopeDefinition);<NEW_LINE>earliestDefinitionsByLevel.get(currentDepth).put(name, true);<NEW_LINE>discoveredCreations.add(scopeDefinition);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>JavaTypeInstance oldType = previousDef.getJavaTypeInstance();<NEW_LINE>if (!oldType.equals(newType)) {<NEW_LINE>earliestDefinitionsByLevel.get(previousDef.getDepth()).remove(previousDef.getName());<NEW_LINE>if (previousDef.getDepth() == currentDepth) {<NEW_LINE>variableFactory.mutatingRenameUnClash(localVariable);<NEW_LINE>name = localVariable.getName();<NEW_LINE>}<NEW_LINE>InferredJavaType inferredJavaType = localVariable.getInferredJavaType();<NEW_LINE>ScopeDefinition scopeDefinition = new ScopeDefinition(currentDepth, currentBlock, statementContainer, localVariable, inferredJavaType, name);<NEW_LINE>earliestDefinition.put(name, scopeDefinition);<NEW_LINE>earliestDefinitionsByLevel.get(currentDepth).put(name, true);<NEW_LINE>discoveredCreations.add(scopeDefinition);<NEW_LINE>}<NEW_LINE>} | NamedVariable name = localVariable.getName(); |
1,279,813 | private static RequestLog requestLog(ApplicationServer applicationServer) throws Exception {<NEW_LINE>AsyncRequestLogWriter asyncRequestLogWriter = new AsyncRequestLogWriter();<NEW_LINE>asyncRequestLogWriter.setTimeZone(TimeZone.getDefault().getID());<NEW_LINE>asyncRequestLogWriter.setAppend(true);<NEW_LINE>asyncRequestLogWriter.setRetainDays(applicationServer.getRequestLogRetainDays());<NEW_LINE>asyncRequestLogWriter.setFilename(Config.dir_logs().toString() + File.separator + "application.request.yyyy_MM_dd." + Config.node() + ".log");<NEW_LINE>asyncRequestLogWriter.setFilenameDateFormat("yyyyMMdd");<NEW_LINE>String format = "%{client}a - %u %{yyyy-MM-dd HH:mm:ss.SSS ZZZ|" + DateFormatUtils.format(new <MASK><NEW_LINE>if (BooleanUtils.isTrue(applicationServer.getRequestLogBodyEnable()) || BooleanUtils.isTrue(Config.ternaryManagement().getEnable())) {<NEW_LINE>return new ServerRequestLogBody(asyncRequestLogWriter, StringUtils.isEmpty(applicationServer.getRequestLogFormat()) ? format : applicationServer.getRequestLogFormat());<NEW_LINE>} else {<NEW_LINE>return new ServerRequestLog(asyncRequestLogWriter, StringUtils.isEmpty(applicationServer.getRequestLogFormat()) ? format : applicationServer.getRequestLogFormat());<NEW_LINE>}<NEW_LINE>} | Date(), "z") + "}t \"%r\" %s %O %{ms}T"; |
1,410,328 | public void read(org.apache.thrift.protocol.TProtocol iprot, update_request struct) throws org.apache.thrift.TException {<NEW_LINE>org.apache.thrift.protocol.TField schemeField;<NEW_LINE>iprot.readStructBegin();<NEW_LINE>while (true) {<NEW_LINE>schemeField = iprot.readFieldBegin();<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>switch(schemeField.id) {<NEW_LINE>case // KEY<NEW_LINE>1:<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {<NEW_LINE><MASK><NEW_LINE>struct.key.read(iprot);<NEW_LINE>struct.setKeyIsSet(true);<NEW_LINE>} else {<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case // VALUE<NEW_LINE>2:<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {<NEW_LINE>struct.value = new blob();<NEW_LINE>struct.value.read(iprot);<NEW_LINE>struct.setValueIsSet(true);<NEW_LINE>} else {<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case // EXPIRE_TS_SECONDS<NEW_LINE>3:<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.I32) {<NEW_LINE>struct.expire_ts_seconds = iprot.readI32();<NEW_LINE>struct.setExpire_ts_secondsIsSet(true);<NEW_LINE>} else {<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);<NEW_LINE>}<NEW_LINE>iprot.readFieldEnd();<NEW_LINE>}<NEW_LINE>iprot.readStructEnd();<NEW_LINE>// check for required fields of primitive type, which can't be checked in the validate method<NEW_LINE>struct.validate();<NEW_LINE>} | struct.key = new blob(); |
269,406 | protected void edgeStructure(StreamTokenizerWithMultilineLiterals streamTokenizer, final NodeDraft nodeDraft) throws Exception {<NEW_LINE>streamTokenizer.nextToken();<NEW_LINE>EdgeDraft edge = null;<NEW_LINE>if (streamTokenizer.ttype == '>' || streamTokenizer.ttype == '-') {<NEW_LINE>streamTokenizer.nextToken();<NEW_LINE>if (streamTokenizer.ttype == '{') {<NEW_LINE>while (true) {<NEW_LINE>streamTokenizer.nextToken();<NEW_LINE>if (streamTokenizer.ttype == '}') {<NEW_LINE>break;<NEW_LINE>} else {<NEW_LINE>nodeID(streamTokenizer);<NEW_LINE>edge = container.factory().newEdgeDraft();<NEW_LINE>edge.setSource(nodeDraft);<NEW_LINE>edge.setTarget(getOrCreateNode("" + streamTokenizer.sval));<NEW_LINE>container.addEdge(edge);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>nodeID(streamTokenizer);<NEW_LINE>edge = container.factory().newEdgeDraft();<NEW_LINE>edge.setSource(nodeDraft);<NEW_LINE>edge.setTarget(getOrCreateNode<MASK><NEW_LINE>container.addEdge(edge);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>report.logIssue(new Issue(NbBundle.getMessage(ImporterDOT.class, "importerDOT_error_edgeparsing", streamTokenizer.lineno()), Issue.Level.SEVERE));<NEW_LINE>if (streamTokenizer.ttype == StreamTokenizer.TT_WORD) {<NEW_LINE>streamTokenizer.pushBack();<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>streamTokenizer.nextToken();<NEW_LINE>if (streamTokenizer.ttype == '[') {<NEW_LINE>edgeAttributes(streamTokenizer, edge);<NEW_LINE>} else {<NEW_LINE>streamTokenizer.pushBack();<NEW_LINE>}<NEW_LINE>} | ("" + streamTokenizer.sval)); |
1,202,272 | /* Sample generated code:<NEW_LINE>*<NEW_LINE>* @com.ibm.j9ddr.GeneratedFieldAccessor(offsetFieldName="_fifteenMinuteAverageOffset_", declaredType="double")<NEW_LINE>* public double fifteenMinuteAverage() throws CorruptDataException {<NEW_LINE>* return getDoubleAtOffset(J9PortSysInfoLoadData._fifteenMinuteAverageOffset_);<NEW_LINE>* }<NEW_LINE>*/<NEW_LINE>private void doDoubleMethod(FieldDescriptor field) {<NEW_LINE>MethodVisitor method = beginAnnotatedMethod(field, field.getName(), doubleFromVoid);<NEW_LINE>method.visitCode();<NEW_LINE>if (checkPresent(field, method)) {<NEW_LINE>method.visitVarInsn(ALOAD, 0);<NEW_LINE>loadLong(method, field.getOffset());<NEW_LINE>method.visitMethodInsn(INVOKEVIRTUAL, <MASK><NEW_LINE>method.visitInsn(DRETURN);<NEW_LINE>}<NEW_LINE>method.visitMaxs(3, 1);<NEW_LINE>method.visitEnd();<NEW_LINE>doEAMethod("Double", field);<NEW_LINE>} | className, "getDoubleAtOffset", doubleFromLong, false); |
1,538,784 | private void attribute(MessageTextHandler messageTextHandler, Name attributeName, Name elementName, boolean atSentenceStart) throws SAXException {<NEW_LINE>String ns = attributeName.getNamespaceUri();<NEW_LINE>if (html || "".equals(ns)) {<NEW_LINE>messageTextString(messageTextHandler, ATTRIBUTE, atSentenceStart);<NEW_LINE>codeString(messageTextHandler, attributeName.getLocalName());<NEW_LINE>} else if ("http://www.w3.org/XML/1998/namespace".equals(ns)) {<NEW_LINE>messageTextString(messageTextHandler, ATTRIBUTE, atSentenceStart);<NEW_LINE>codeString(messageTextHandler, "xml:" + attributeName.getLocalName());<NEW_LINE>} else {<NEW_LINE>char[] humanReadable = WELL_KNOWN_NAMESPACES.get(ns);<NEW_LINE>if (humanReadable == null) {<NEW_LINE>if (loggingOk) {<NEW_LINE>log4j.info(new StringBuilder().append("UNKNOWN_NS:\t").append(ns));<NEW_LINE>}<NEW_LINE>messageTextString(messageTextHandler, ATTRIBUTE, atSentenceStart);<NEW_LINE>codeString(messageTextHandler, attributeName.getLocalName());<NEW_LINE>messageTextString(messageTextHandler, FROM_NAMESPACE, false);<NEW_LINE>codeString(messageTextHandler, ns);<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>messageTextString(messageTextHandler, SPACE, false);<NEW_LINE>messageTextString(messageTextHandler, ATTRIBUTE, false);<NEW_LINE>codeString(messageTextHandler, attributeName.getLocalName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | messageTextString(messageTextHandler, humanReadable, atSentenceStart); |
913,374 | public DeleteQueuedReservedInstancesResult unmarshall(StaxUnmarshallerContext context) throws Exception {<NEW_LINE>DeleteQueuedReservedInstancesResult deleteQueuedReservedInstancesResult = new DeleteQueuedReservedInstancesResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>if (context.isStartOfDocument())<NEW_LINE>targetDepth += 1;<NEW_LINE>while (true) {<NEW_LINE>XMLEvent xmlEvent = context.nextEvent();<NEW_LINE>if (xmlEvent.isEndDocument())<NEW_LINE>return deleteQueuedReservedInstancesResult;<NEW_LINE>if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {<NEW_LINE>if (context.testExpression("successfulQueuedPurchaseDeletionSet", targetDepth)) {<NEW_LINE>deleteQueuedReservedInstancesResult.withSuccessfulQueuedPurchaseDeletions(<MASK><NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("successfulQueuedPurchaseDeletionSet/item", targetDepth)) {<NEW_LINE>deleteQueuedReservedInstancesResult.withSuccessfulQueuedPurchaseDeletions(SuccessfulQueuedPurchaseDeletionStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("failedQueuedPurchaseDeletionSet", targetDepth)) {<NEW_LINE>deleteQueuedReservedInstancesResult.withFailedQueuedPurchaseDeletions(new ArrayList<FailedQueuedPurchaseDeletion>());<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("failedQueuedPurchaseDeletionSet/item", targetDepth)) {<NEW_LINE>deleteQueuedReservedInstancesResult.withFailedQueuedPurchaseDeletions(FailedQueuedPurchaseDeletionStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>} else if (xmlEvent.isEndElement()) {<NEW_LINE>if (context.getCurrentDepth() < originalDepth) {<NEW_LINE>return deleteQueuedReservedInstancesResult;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | new ArrayList<SuccessfulQueuedPurchaseDeletion>()); |
138,396 | private void readSettingsFrame(ChannelHandlerContext ctx, ByteBuf payload, Http2FrameListener listener) throws Http2Exception {<NEW_LINE>if (flags.ack()) {<NEW_LINE>listener.onSettingsAckRead(ctx);<NEW_LINE>} else {<NEW_LINE>int numSettings = payloadLength / SETTING_ENTRY_LENGTH;<NEW_LINE>Http2Settings settings = new Http2Settings();<NEW_LINE>for (int index = 0; index < numSettings; ++index) {<NEW_LINE>char id = (char) payload.readUnsignedShort();<NEW_LINE>long value = payload.readUnsignedInt();<NEW_LINE>try {<NEW_LINE>settings.put(id, Long.valueOf(value));<NEW_LINE>} catch (IllegalArgumentException e) {<NEW_LINE>if (id == SETTINGS_INITIAL_WINDOW_SIZE) {<NEW_LINE>throw connectionError(FLOW_CONTROL_ERROR, e, <MASK><NEW_LINE>}<NEW_LINE>throw connectionError(PROTOCOL_ERROR, e, "Protocol error: %s", e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>listener.onSettingsRead(ctx, settings);<NEW_LINE>}<NEW_LINE>} | "Failed setting initial window size: %s", e.getMessage()); |
1,296,498 | private static Set<String> parseNamespaceList(String namespacesList) {<NEW_LINE>Set<String> namespaces;<NEW_LINE>if (namespacesList == null || namespacesList.isEmpty()) {<NEW_LINE>namespaces = <MASK><NEW_LINE>} else {<NEW_LINE>if (namespacesList.trim().equals(AbstractResourceOperator.ANY_NAMESPACE)) {<NEW_LINE>namespaces = Collections.singleton(AbstractResourceOperator.ANY_NAMESPACE);<NEW_LINE>} else if (namespacesList.matches("(\\s*[a-z0-9.-]+\\s*,)*\\s*[a-z0-9.-]+\\s*")) {<NEW_LINE>namespaces = new HashSet<>(asList(namespacesList.trim().split("\\s*,+\\s*")));<NEW_LINE>} else {<NEW_LINE>throw new InvalidConfigurationException(STRIMZI_NAMESPACE + " is not a valid list of namespaces nor the 'any namespace' wildcard " + AbstractResourceOperator.ANY_NAMESPACE);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return namespaces;<NEW_LINE>} | Collections.singleton(AbstractResourceOperator.ANY_NAMESPACE); |
969,083 | private boolean changeGraphAccess(final String graphId, final FederatedAccess newFederatedAccess, final Predicate<FederatedAccess> accessPredicate) throws StorageException {<NEW_LINE>boolean rtn;<NEW_LINE>final Graph graphToMove = getGraphToMove(graphId, accessPredicate);<NEW_LINE>if (nonNull(graphToMove)) {<NEW_LINE>// remove graph to be moved<NEW_LINE>FederatedAccess oldAccess = null;<NEW_LINE>for (final Entry<FederatedAccess, Set<Graph>> entry : storage.entrySet()) {<NEW_LINE>entry.getValue().removeIf(graph -> graph.getGraphId().equals(graphId));<NEW_LINE>oldAccess = entry.getKey();<NEW_LINE>}<NEW_LINE>// add the graph being moved.<NEW_LINE>this.put(new GraphSerialisable.Builder().graph(graphToMove).build(), newFederatedAccess);<NEW_LINE>if (isCacheEnabled()) {<NEW_LINE>// Update cache<NEW_LINE>try {<NEW_LINE>federatedStoreCache.<MASK><NEW_LINE>} catch (final CacheOperationException e) {<NEW_LINE>// TODO FS recovery<NEW_LINE>String s = "Error occurred updating graphAccess. GraphStorage=updated, Cache=outdated. graphId:" + graphId;<NEW_LINE>LOGGER.error(s + " graphStorage access:{} cache access:{}", newFederatedAccess, oldAccess);<NEW_LINE>throw new StorageException(s, e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>rtn = true;<NEW_LINE>} else {<NEW_LINE>rtn = false;<NEW_LINE>}<NEW_LINE>return rtn;<NEW_LINE>} | addGraphToCache(graphToMove, newFederatedAccess, true); |
1,372,933 | final DeleteJobTaggingResult executeDeleteJobTagging(DeleteJobTaggingRequest deleteJobTaggingRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteJobTaggingRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteJobTaggingRequest> request = null;<NEW_LINE>Response<DeleteJobTaggingResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteJobTaggingRequestMarshaller().marshall(super.beforeMarshalling(deleteJobTaggingRequest));<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, "S3 Control");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteJobTagging");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>URI endpointTraitHost = null;<NEW_LINE>if (!clientConfiguration.isDisableHostPrefixInjection()) {<NEW_LINE>ValidationUtils.assertStringNotEmpty(deleteJobTaggingRequest.getAccountId(), "AccountId");<NEW_LINE>HostnameValidator.validateHostnameCompliant(deleteJobTaggingRequest.<MASK><NEW_LINE>String hostPrefix = "{AccountId}.";<NEW_LINE>String resolvedHostPrefix = String.format("%s.", deleteJobTaggingRequest.getAccountId());<NEW_LINE>endpointTraitHost = UriResourcePathUtils.updateUriHost(endpoint, resolvedHostPrefix);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DeleteJobTaggingResult> responseHandler = new com.amazonaws.services.s3control.internal.S3ControlStaxResponseHandler<DeleteJobTaggingResult>(new DeleteJobTaggingResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext, null, endpointTraitHost);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | getAccountId(), "AccountId", "deleteJobTaggingRequest"); |
131,512 | private int[] transformTransformedValuesToIntValuesSV(ProjectionBlock projectionBlock) {<NEW_LINE>// operating on the output of another transform so can't pass the evaluation down to the storage<NEW_LINE>ensureJsonPathCompiled();<NEW_LINE>String[] jsonStrings = _jsonFieldTransformFunction.transformToStringValuesSV(projectionBlock);<NEW_LINE>int numDocs = projectionBlock.getNumDocs();<NEW_LINE>for (int i = 0; i < numDocs; i++) {<NEW_LINE>Object result = null;<NEW_LINE>try {<NEW_LINE>result = JSON_PARSER_CONTEXT.parse(jsonStrings[i]).read(_jsonPath);<NEW_LINE>} catch (Exception ignored) {<NEW_LINE>}<NEW_LINE>if (result == null) {<NEW_LINE>if (_defaultValue != null) {<NEW_LINE>_intValuesSV[i] = (int) _defaultValue;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>throw new RuntimeException(String.format("Illegal Json Path: [%s], when reading [%s]", _jsonPathString, jsonStrings[i]));<NEW_LINE>}<NEW_LINE>if (result instanceof Number) {<NEW_LINE>_intValuesSV[i] = ((Number) result).intValue();<NEW_LINE>} else {<NEW_LINE>_intValuesSV[i] = Integer.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return _intValuesSV;<NEW_LINE>} | parseInt(result.toString()); |
1,681,550 | public void propagate(InstanceState state) {<NEW_LINE>final var portType = state.getAttributeValue(ATTR_DIR);<NEW_LINE>final var nrOfPins = state.getAttributeValue(ATTR_SIZE).getWidth();<NEW_LINE>final var stateData = getState(state);<NEW_LINE>var currentPortIndex = 0;<NEW_LINE>// first we update the state data<NEW_LINE>if (portType.equals(INOUTSE) || portType.equals(INOUTME) || portType.equals(OUTPUT)) {<NEW_LINE>var enableValue = state.getPortValue(currentPortIndex);<NEW_LINE>if (portType.equals(INOUTSE) || portType.equals(INOUTME))<NEW_LINE>currentPortIndex++;<NEW_LINE>var inputValue = state.getPortValue(currentPortIndex);<NEW_LINE>var pinIndexCorrection = -BitWidth.MAXWIDTH;<NEW_LINE>for (var pinIndex = 0; pinIndex < nrOfPins; pinIndex++) {<NEW_LINE>if ((pinIndex % BitWidth.MAXWIDTH) == 0) {<NEW_LINE>if ((portType.equals(INOUTME)) && (pinIndex > 0))<NEW_LINE>enableValue = state.getPortValue(currentPortIndex++);<NEW_LINE>inputValue = state.getPortValue(currentPortIndex++);<NEW_LINE>pinIndexCorrection += BitWidth.MAXWIDTH;<NEW_LINE>}<NEW_LINE>if (!portType.equals(OUTPUT)) {<NEW_LINE>final var enableIndex = portType.equals(INOUTSE) ? 0 : pinIndex - pinIndexCorrection;<NEW_LINE>stateData.setEnableValue(pinIndex, enableValue.get(enableIndex));<NEW_LINE>}<NEW_LINE>stateData.setInputValue(pinIndex, inputValue.get(pinIndex - pinIndexCorrection));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// now we force the outputs<NEW_LINE>if (!portType.equals(OUTPUT)) {<NEW_LINE>var nrOfRemainingPins = nrOfPins;<NEW_LINE>var nrOfPinsInCurrentBus = Math.min(nrOfRemainingPins, BitWidth.MAXWIDTH);<NEW_LINE>nrOfRemainingPins -= nrOfPinsInCurrentBus;<NEW_LINE>var outputValue = new Value[nrOfPinsInCurrentBus];<NEW_LINE>var pinIndexCorrection = 0;<NEW_LINE>for (var pinIndex = 0; pinIndex < nrOfPins; pinIndex++) {<NEW_LINE>if ((pinIndex > 0) && ((pinIndex % BitWidth.MAXWIDTH) == 0)) {<NEW_LINE>state.setPort(currentPortIndex++, Value<MASK><NEW_LINE>nrOfPinsInCurrentBus = Math.min(nrOfRemainingPins, BitWidth.MAXWIDTH);<NEW_LINE>nrOfRemainingPins -= nrOfPinsInCurrentBus;<NEW_LINE>outputValue = new Value[nrOfPinsInCurrentBus];<NEW_LINE>pinIndexCorrection += BitWidth.MAXWIDTH;<NEW_LINE>}<NEW_LINE>outputValue[pinIndex - pinIndexCorrection] = stateData.getPinValue(pinIndex, portType);<NEW_LINE>}<NEW_LINE>state.setPort(currentPortIndex++, Value.create(outputValue), DELAY);<NEW_LINE>}<NEW_LINE>} | .create(outputValue), DELAY); |
403,679 | protected void runOneIteration() {<NEW_LINE>try {<NEW_LINE>final List<PersistentQueryMetadata> currentQueries = engine.getPersistentQueries();<NEW_LINE>if (currentQueries.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final Set<HostInfo> uniqueHosts = <MASK><NEW_LINE>for (HostInfo hostInfo : uniqueHosts) {<NEW_LINE>// Only add to map if it is the first time it is discovered. Design decision to<NEW_LINE>// optimistically consider every newly discovered server as alive to avoid situations of<NEW_LINE>// unavailability until the heartbeating kicks in.<NEW_LINE>final KsqlHostInfo host = new KsqlHostInfo(hostInfo.host(), hostInfo.port());<NEW_LINE>hostsStatus.computeIfAbsent(host, key -> new HostStatus(true, clock.millis()));<NEW_LINE>}<NEW_LINE>} catch (Throwable t) {<NEW_LINE>LOG.error("Failed to discover cluster with exception " + t.getMessage(), t);<NEW_LINE>}<NEW_LINE>} | DiscoverRemoteHostsUtil.getRemoteHosts(currentQueries, localHost); |
1,029,177 | protected Set<Object> createInstance() {<NEW_LINE>if (this.sourceSet == null) {<NEW_LINE>throw new IllegalArgumentException("'sourceSet' is required");<NEW_LINE>}<NEW_LINE>Set<Object> result = null;<NEW_LINE>if (this.targetSetClass != null) {<NEW_LINE>result = <MASK><NEW_LINE>} else {<NEW_LINE>result = new LinkedHashSet<>(this.sourceSet.size());<NEW_LINE>}<NEW_LINE>Class<?> valueType = null;<NEW_LINE>if (this.targetSetClass != null) {<NEW_LINE>valueType = ResolvableType.forClass(this.targetSetClass).asCollection().resolveGeneric();<NEW_LINE>}<NEW_LINE>if (valueType != null) {<NEW_LINE>TypeConverter converter = getBeanTypeConverter();<NEW_LINE>for (Object elem : this.sourceSet) {<NEW_LINE>result.add(converter.convertIfNecessary(elem, valueType));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>result.addAll(this.sourceSet);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | BeanUtils.instantiateClass(this.targetSetClass); |
1,665,297 | public F0Value pitchAnalyzeFrame(NonharmonicSinusoidalSpeechFrame sinFrame, int samplingRate, float searchStepInHz, float minFreqInHz, float maxFreqInHz) {<NEW_LINE>F0Value v = new F0Value();<NEW_LINE>double[] Q = null;<NEW_LINE>float w0;<NEW_LINE>int i;<NEW_LINE>if (sinFrame != null) {<NEW_LINE>int numCandidates = (int) Math.floor((maxFreqInHz - minFreqInHz) / searchStepInHz + 1 + 0.5);<NEW_LINE>Q = new double[numCandidates];<NEW_LINE>int stInd, enInd;<NEW_LINE>for (i = 0; i < numCandidates; i++) {<NEW_LINE>w0 = i * searchStepInHz + minFreqInHz;<NEW_LINE>Q[i] = performanceCriterion(sinFrame, w0, samplingRate);<NEW_LINE>}<NEW_LINE>// MaryUtils.plot(Q, true, 1000);<NEW_LINE>}<NEW_LINE>// Search for distinct peaks in the Q-function<NEW_LINE>if (Q != null) {<NEW_LINE>v.maxQ = MathUtils.getMax(Q);<NEW_LINE>int numNeighs = (int) Math.floor(10.0f / searchStepInHz + 0.5);<NEW_LINE>int[] maxInds = MathUtils.getExtrema(Q, numNeighs, numNeighs, true, 0, Q.length - 1, 0.1 * v.maxQ);<NEW_LINE>if (maxInds != null) {<NEW_LINE>int maxInd = 0;<NEW_LINE>v.maxQ = Q[maxInds[maxInd]];<NEW_LINE>for (i = 1; i < maxInds.length; i++) {<NEW_LINE>if (Q[maxInds[i]] > v.maxQ) {<NEW_LINE>v.maxQ = Q[maxInds[i]];<NEW_LINE>maxInd = i;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>v.f0 = <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (v.maxQ < 5.0e-5)<NEW_LINE>v.f0 = 0.0f;<NEW_LINE>char chTab = 9;<NEW_LINE>System.out.println(String.valueOf(v.f0) + chTab + String.valueOf(v.maxQ));<NEW_LINE>return v;<NEW_LINE>} | maxInds[maxInd] * searchStepInHz + minFreqInHz; |
1,802,586 | public Future<BackupResult> backupSession(final String sessionId, final boolean sessionIdChanged, final String requestId) {<NEW_LINE>final MemcachedBackupSession session = _manager.getSessionInternal(sessionId);<NEW_LINE>if (session == null) {<NEW_LINE>if (_log.isDebugEnabled())<NEW_LINE>_log.debug("No session found in session map for " + sessionId);<NEW_LINE>return new SimpleFuture<BackupResult>(BackupResult.SKIPPED);<NEW_LINE>}<NEW_LINE>_log.info("Serializing session data for session " + session.getIdInternal());<NEW_LINE>final <MASK><NEW_LINE>final byte[] data = _transcoderService.serializeAttributes((MemcachedBackupSession) session, ((MemcachedBackupSession) session).getAttributesFiltered());<NEW_LINE>_log.info(String.format("Serializing %1$,.3f kb session data for session %2$s took %3$d ms.", (double) data.length / 1000, session.getIdInternal(), System.currentTimeMillis() - startSerialization));<NEW_LINE>_sessionData.put(session.getIdInternal(), data);<NEW_LINE>_statistics.registerSince(ATTRIBUTES_SERIALIZATION, startSerialization);<NEW_LINE>_statistics.register(CACHED_DATA_SIZE, data.length);<NEW_LINE>return new SimpleFuture<BackupResult>(new BackupResult(BackupResultStatus.SUCCESS));<NEW_LINE>} | long startSerialization = System.currentTimeMillis(); |
400,578 | public static void main(String... args) throws LineUnavailableException {<NEW_LINE>AudioGenerator generator = new AudioGenerator(1024, 0);<NEW_LINE>generator.addAudioProcessor(new NoiseGenerator(0.2));<NEW_LINE>generator.addAudioProcessor(new LowPassFS(1000, 44100));<NEW_LINE>generator.addAudioProcessor(new LowPassFS(1000, 44100));<NEW_LINE>generator.addAudioProcessor(new LowPassFS(1000, 44100));<NEW_LINE>generator.addAudioProcessor(new SineGenerator(0.05, 220));<NEW_LINE>generator.addAudioProcessor(new AmplitudeLFO(10, 0.9));<NEW_LINE>generator.addAudioProcessor(new SineGenerator(0.2, 440));<NEW_LINE>generator.addAudioProcessor(new SineGenerator(0.1, 880));<NEW_LINE>generator.addAudioProcessor(new DelayEffect(1.5, 0.4, 44100));<NEW_LINE>generator.addAudioProcessor(new AmplitudeLFO());<NEW_LINE>generator.addAudioProcessor(new NoiseGenerator(0.02));<NEW_LINE>generator.addAudioProcessor(new SineGenerator(0.05, 1760));<NEW_LINE>generator.addAudioProcessor(new SineGenerator(0.01, 2460));<NEW_LINE>generator.addAudioProcessor(new AmplitudeLFO(0.1, 0.7));<NEW_LINE>generator.addAudioProcessor(new DelayEffect(0.757, 0.4, 44100));<NEW_LINE>generator.addAudioProcessor(new FlangerEffect(0.1<MASK><NEW_LINE>generator.addAudioProcessor(new AudioPlayer(new AudioFormat(44100, 16, 1, true, false)));<NEW_LINE>generator.run();<NEW_LINE>} | , 0.2, 44100, 4)); |
473,032 | Mono<Response<SchemaProperties>> registerSchemaWithResponse(String groupName, String name, String schemaDefinition, SchemaFormat format, Context context) {<NEW_LINE>if (Objects.isNull(groupName)) {<NEW_LINE>return monoError(logger, new NullPointerException("'groupName' should not be null."));<NEW_LINE>} else if (Objects.isNull(name)) {<NEW_LINE>return monoError(logger, new NullPointerException("'name' should not be null."));<NEW_LINE>} else if (Objects.isNull(schemaDefinition)) {<NEW_LINE>return monoError(logger, new NullPointerException("'schemaDefinition' should not be null."));<NEW_LINE>} else if (Objects.isNull(format)) {<NEW_LINE>return monoError(logger, new NullPointerException("'format' should not be null."));<NEW_LINE>}<NEW_LINE>logger.verbose("Registering schema. Group: '{}', name: '{}', serialization type: '{}', payload: '{}'", <MASK><NEW_LINE>final String contentType = getContentType(format);<NEW_LINE>return restService.getSchemas().registerWithResponseAsync(groupName, name, schemaDefinition, contentType, context).map(response -> {<NEW_LINE>final SchemaProperties registered = SchemaRegistryHelper.getSchemaProperties(response);<NEW_LINE>return new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), registered);<NEW_LINE>});<NEW_LINE>} | groupName, name, format, schemaDefinition); |
1,070,004 | private Mono<Response<MetricDefinitionInner>> listMetricDefinitionsWithResponseAsync(String resourceGroupName, String name, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (name == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.listMetricDefinitions(this.client.getEndpoint(), resourceGroupName, name, this.client.getSubscriptionId(), this.client.getApiVersion(), accept, context);<NEW_LINE>} | error(new IllegalArgumentException("Parameter name is required and cannot be null.")); |
142,222 | private void initalizeSwingControls() {<NEW_LINE>accountLabel = new JTextPane();<NEW_LINE>accountLabel.setEditable(false);<NEW_LINE>accountLabel.setOpaque(false);<NEW_LINE>personaHeader = new JLabel(Bundle.MessageAccountPanel_persona_label());<NEW_LINE>contactHeader = new JLabel(Bundle.MessageAccountPanel_contact_label());<NEW_LINE>personaDisplayName = new JTextPane();<NEW_LINE>personaDisplayName.setOpaque(false);<NEW_LINE>personaDisplayName.setEditable(false);<NEW_LINE>personaDisplayName.setPreferredSize(new Dimension(100, 26));<NEW_LINE>personaDisplayName.setMaximumSize(new Dimension(100, 26));<NEW_LINE>contactDisplayName = new JTextPane();<NEW_LINE>contactDisplayName.setOpaque(false);<NEW_LINE>contactDisplayName.setEditable(false);<NEW_LINE>contactDisplayName.setPreferredSize(new Dimension(100, 26));<NEW_LINE>button = new JButton();<NEW_LINE>button.addActionListener(new PersonaButtonListener(this));<NEW_LINE>accountLabel.setMargin(new Insets(0, 0, 0, 0));<NEW_LINE>accountLabel.setText(account.getTypeSpecificID());<NEW_LINE>accountLabel.<MASK><NEW_LINE>contactDisplayName.setText(contactName);<NEW_LINE>personaDisplayName.setText(persona != null ? persona.getName() : Bundle.MessageAccountPanel_unknown_label());<NEW_LINE>// This is a bit of a hack to size the JTextPane correctly, but it gets the job done.<NEW_LINE>personaDisplayName.setMaximumSize((new JLabel(personaDisplayName.getText()).getMaximumSize()));<NEW_LINE>contactDisplayName.setMaximumSize((new JLabel(contactDisplayName.getText()).getMaximumSize()));<NEW_LINE>accountLabel.setMaximumSize((new JLabel(accountLabel.getText()).getMaximumSize()));<NEW_LINE>button.setText(persona != null ? Bundle.MessageAccountPanel_button_view_label() : Bundle.MessageAccountPanel_button_create_label());<NEW_LINE>initalizePopupMenus();<NEW_LINE>} | setFont(ContentViewerDefaults.getHeaderFont()); |
457,240 | protected void childrenChanged(PsiElement parent, final boolean stopProcessingForThisModificationCount) {<NEW_LINE>if (parent instanceof PsiDirectory && isFlattenPackages()) {<NEW_LINE>addSubtreeToUpdateByRoot();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>long newModificationCount = myModificationTracker.getModificationCount();<NEW_LINE>if (newModificationCount == myModificationCount)<NEW_LINE>return;<NEW_LINE>if (stopProcessingForThisModificationCount) {<NEW_LINE>myModificationCount = newModificationCount;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (parent == null)<NEW_LINE>break;<NEW_LINE>if (parent instanceof PsiFile) {<NEW_LINE>VirtualFile virtualFile = ((PsiFile) parent).getVirtualFile();<NEW_LINE>if (virtualFile != null && virtualFile.getFileType() != PlainTextFileType.INSTANCE) {<NEW_LINE>// adding a class within a file causes a new node to appear in project view => entire dir should be updated<NEW_LINE>parent = ((<MASK><NEW_LINE>if (parent == null)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} else if (parent instanceof PsiDirectory && ScratchUtil.isScratch(((PsiDirectory) parent).getVirtualFile())) {<NEW_LINE>addSubtreeToUpdateByRoot();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (addSubtreeToUpdateByElementFile(parent)) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (parent instanceof PsiFile || parent instanceof PsiDirectory)<NEW_LINE>break;<NEW_LINE>parent = parent.getParent();<NEW_LINE>}<NEW_LINE>} | PsiFile) parent).getContainingDirectory(); |
1,547,777 | public FluidStack drain(FluidStack toDrain, FluidAction action) {<NEW_LINE>// search for the resource<NEW_LINE>ListIterator<FluidStack> iter = fluids.listIterator();<NEW_LINE>while (iter.hasNext()) {<NEW_LINE>FluidStack fluid = iter.next();<NEW_LINE>if (fluid.isFluidEqual(toDrain)) {<NEW_LINE>// if found, determine how much we can drain<NEW_LINE>int drainable = Math.min(toDrain.getAmount(<MASK><NEW_LINE>// copy contained fluid to return for accuracy<NEW_LINE>FluidStack ret = fluid.copy();<NEW_LINE>ret.setAmount(drainable);<NEW_LINE>// update tank if executing<NEW_LINE>if (action.execute()) {<NEW_LINE>fluid.shrink(drainable);<NEW_LINE>contained -= drainable;<NEW_LINE>// if now empty, remove from the list<NEW_LINE>if (fluid.getAmount() <= 0) {<NEW_LINE>iter.remove();<NEW_LINE>parent.notifyFluidsChanged(FluidChange.REMOVED, fluid);<NEW_LINE>} else {<NEW_LINE>parent.notifyFluidsChanged(FluidChange.CHANGED, fluid);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return ret;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// nothing drained<NEW_LINE>return FluidStack.EMPTY;<NEW_LINE>} | ), fluid.getAmount()); |
444,593 | public Builder mergeFrom(org.apache.jena.riot.protobuf.wire.PB_RDF.RDF_DataTuple other) {<NEW_LINE>if (other == org.apache.jena.riot.protobuf.wire.PB_RDF.RDF_DataTuple.getDefaultInstance())<NEW_LINE>return this;<NEW_LINE>if (rowBuilder_ == null) {<NEW_LINE>if (!other.row_.isEmpty()) {<NEW_LINE>if (row_.isEmpty()) {<NEW_LINE>row_ = other.row_;<NEW_LINE>bitField0_ = (bitField0_ & ~0x00000001);<NEW_LINE>} else {<NEW_LINE>ensureRowIsMutable();<NEW_LINE>row_.addAll(other.row_);<NEW_LINE>}<NEW_LINE>onChanged();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (!other.row_.isEmpty()) {<NEW_LINE>if (rowBuilder_.isEmpty()) {<NEW_LINE>rowBuilder_.dispose();<NEW_LINE>rowBuilder_ = null;<NEW_LINE>row_ = other.row_;<NEW_LINE>bitField0_ = (bitField0_ & ~0x00000001);<NEW_LINE>rowBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getRowFieldBuilder() : null;<NEW_LINE>} else {<NEW_LINE>rowBuilder_.addAllMessages(other.row_);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>onChanged();<NEW_LINE>return this;<NEW_LINE>} | this.mergeUnknownFields(other.unknownFields); |
1,202,070 | public void configureBPartner(int partnerId) {<NEW_LINE>// Valid if has a Order<NEW_LINE>if (isCompleted() || isVoided())<NEW_LINE>return;<NEW_LINE>log.fine("CPOS.setC_BPartner_ID=" + partnerId);<NEW_LINE>boolean isSamePOSPartner = false;<NEW_LINE>// Validate BPartner<NEW_LINE>if (partnerId == 0) {<NEW_LINE>isSamePOSPartner = true;<NEW_LINE>partnerId = entityPOS.getC_BPartnerCashTrx_ID();<NEW_LINE>}<NEW_LINE>// Get BPartner<NEW_LINE>partner = MBPartner.get(ctx, partnerId);<NEW_LINE>if (partner == null || partner.get_ID() == 0) {<NEW_LINE>throw new AdempierePOSException("POS.NoBPartnerForOrder");<NEW_LINE>} else {<NEW_LINE>log.info("CPOS.SetC_BPartner_ID -" + partner);<NEW_LINE>currentOrder.setBPartner(partner);<NEW_LINE>//<NEW_LINE>MBPartnerLocation[] partnerLocations = partner.getLocations(true);<NEW_LINE>if (partnerLocations.length > 0) {<NEW_LINE>for (MBPartnerLocation partnerLocation : partnerLocations) {<NEW_LINE>if (partnerLocation.isBillTo())<NEW_LINE>currentOrder.setBill_Location_ID(partnerLocation.getC_BPartner_Location_ID());<NEW_LINE>if (partnerLocation.isShipTo())<NEW_LINE>currentOrder.setShip_Location_ID(partnerLocation.getC_BPartner_Location_ID());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Validate Same BPartner<NEW_LINE>if (isSamePOSPartner) {<NEW_LINE>if (currentOrder.getPaymentRule() == null)<NEW_LINE>currentOrder.setPaymentRule(MOrder.PAYMENTRULE_Cash);<NEW_LINE>}<NEW_LINE>// Set Sales Representative<NEW_LINE>if (currentOrder.getC_BPartner().getSalesRep_ID() != 0)<NEW_LINE>currentOrder.setSalesRep_ID(currentOrder.getC_BPartner().getSalesRep_ID());<NEW_LINE>else<NEW_LINE>currentOrder.<MASK><NEW_LINE>// Save Header<NEW_LINE>currentOrder.saveEx();<NEW_LINE>// Load Price List Version<NEW_LINE>MPriceListVersion priceListVersion = loadPriceListVersion(currentOrder.getM_PriceList_ID());<NEW_LINE>MProductPrice[] productPrices = priceListVersion.getProductPrice("AND EXISTS(" + "SELECT 1 " + "FROM C_OrderLine ol " + "WHERE ol.C_Order_ID = " + currentOrder.getC_Order_ID() + " " + "AND ol.M_Product_ID = M_ProductPrice.M_Product_ID)");<NEW_LINE>// Update Lines<NEW_LINE>MOrderLine[] lines = currentOrder.getLines();<NEW_LINE>// Delete if not exist in price list<NEW_LINE>for (MOrderLine line : lines) {<NEW_LINE>// Verify if exist<NEW_LINE>if (existInPriceList(line.getM_Product_ID(), productPrices)) {<NEW_LINE>line.setC_BPartner_ID(partner.getC_BPartner_ID());<NEW_LINE>line.setC_BPartner_Location_ID(currentOrder.getC_BPartner_Location_ID());<NEW_LINE>line.setPrice();<NEW_LINE>line.setTax();<NEW_LINE>line.saveEx();<NEW_LINE>} else {<NEW_LINE>line.deleteEx(true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | setSalesRep_ID(entityPOS.getSalesRep_ID()); |
1,134,878 | private static boolean shouldPerformWordCompletion(CompletionParameters parameters) {<NEW_LINE>final PsiElement insertedElement = parameters.getPosition();<NEW_LINE>final boolean dumb = DumbService.getInstance(insertedElement.getProject()).isDumb();<NEW_LINE>if (dumb) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (parameters.getInvocationCount() == 0) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>final PsiFile file = insertedElement.getContainingFile();<NEW_LINE>final CompletionData data = CompletionUtil.getCompletionDataByElement(insertedElement, file);<NEW_LINE>if (data != null) {<NEW_LINE>Set<CompletionVariant> toAdd = new HashSet<>();<NEW_LINE>data.addKeywordVariants(toAdd, insertedElement, file);<NEW_LINE>for (CompletionVariant completionVariant : toAdd) {<NEW_LINE>if (completionVariant.hasKeywordCompletions()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final int startOffset = parameters.getOffset();<NEW_LINE>final PsiReference reference = file.findReferenceAt(startOffset);<NEW_LINE>if (reference != null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>final PsiElement element = <MASK><NEW_LINE>ASTNode textContainer = element != null ? element.getNode() : null;<NEW_LINE>while (textContainer != null) {<NEW_LINE>final IElementType elementType = textContainer.getElementType();<NEW_LINE>if (LanguageWordCompletion.INSTANCE.isEnabledIn(textContainer) || elementType == PlainTextTokenTypes.PLAIN_TEXT) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>textContainer = textContainer.getTreeParent();<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | file.findElementAt(startOffset - 1); |
458,433 | public E poll() {<NEW_LINE>if (bypassMode.get())<NEW_LINE>return backingQueue.poll();<NEW_LINE>// if that's first step, set local step counter to -1<NEW_LINE>if (currentStep.get() == null)<NEW_LINE>currentStep.set(new AtomicLong(-1));<NEW_LINE>// we block until everyone else step forward<NEW_LINE>while (step.get() == currentStep.get().get()) ThreadUtils.uncheckedSleep(1);<NEW_LINE>E object = peek();<NEW_LINE>// we wait until all consumers peek() this object from queue<NEW_LINE><MASK><NEW_LINE>currentStep.get().incrementAndGet();<NEW_LINE>// last consumer shifts queue on step further<NEW_LINE>if (state.incrementAndGet() == currentConsumers.get()) {<NEW_LINE>// we're removing current head of queue<NEW_LINE>remove();<NEW_LINE>numElementsDrained.incrementAndGet();<NEW_LINE>// and moving step counter further<NEW_LINE>state.set(0);<NEW_LINE>step.incrementAndGet();<NEW_LINE>}<NEW_LINE>// we wait until all consumers know that queue is updated (for isEmpty())<NEW_LINE>synchronize(currentConsumers.get());<NEW_LINE>// log.info("Second lock passed");<NEW_LINE>// now, every consumer in separate threads will get it's own copy of CURRENT head of the queue<NEW_LINE>return object;<NEW_LINE>} | synchronize(currentConsumers.get()); |
288,730 | protected WizardDescriptor.Panel[] initializePanels() {<NEW_LINE>WizardDescriptor.Panel[] panels = new WizardDescriptor.Panel[3];<NEW_LINE>repositoryStep <MASK><NEW_LINE>repositoryStep.addChangeListener(ImportWizard.this);<NEW_LINE>File file = context.getRootFiles()[0];<NEW_LINE>importStep = new ImportStep(new BrowserAction[] { new CreateFolderAction(file.getName()) }, file);<NEW_LINE>importStep.addChangeListener(ImportWizard.this);<NEW_LINE>importPreviewStep = new ImportPreviewStep(context);<NEW_LINE>panels = new WizardDescriptor.Panel[] { repositoryStep, importStep, importPreviewStep };<NEW_LINE>String[] steps = new String[panels.length];<NEW_LINE>for (int i = 0; i < panels.length; i++) {<NEW_LINE>Component c = panels[i].getComponent();<NEW_LINE>// Default step name to component name of panel. Mainly useful<NEW_LINE>// for getting the name of the target chooser to appear in the<NEW_LINE>// list of steps.<NEW_LINE>steps[i] = c.getName();<NEW_LINE>if (c instanceof JComponent) {<NEW_LINE>// assume Swing components<NEW_LINE>JComponent jc = (JComponent) c;<NEW_LINE>// Sets step number of a component<NEW_LINE>// NOI18N<NEW_LINE>jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, Integer.valueOf(i));<NEW_LINE>// Sets steps names for a panel<NEW_LINE>// NOI18N<NEW_LINE>jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);<NEW_LINE>// Turn on subtitle creation on each step<NEW_LINE>// NOI18N<NEW_LINE>jc.putClientProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, Boolean.TRUE);<NEW_LINE>// Show steps on the left side with the image on the background<NEW_LINE>// NOI18N<NEW_LINE>jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED, Boolean.TRUE);<NEW_LINE>// Turn on numbering of all steps<NEW_LINE>// NOI18N<NEW_LINE>jc.putClientProperty(WizardDescriptor.PROP_CONTENT_NUMBERED, Boolean.TRUE);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return panels;<NEW_LINE>} | = new RepositoryStep(RepositoryStep.IMPORT_HELP_ID); |
1,376,935 | public BaseSummarizer visit(Row row) {<NEW_LINE><MASK><NEW_LINE>int numberN = numericalColIndices.length;<NEW_LINE>if (count == 0) {<NEW_LINE>init();<NEW_LINE>}<NEW_LINE>count++;<NEW_LINE>for (int i = 0; i < n; i++) {<NEW_LINE>Object obj = row.getField(i);<NEW_LINE>if (obj == null) {<NEW_LINE>numMissingValue.add(i, 1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (int i = 0; i < numberN; i++) {<NEW_LINE>Object obj = row.getField(numericalColIndices[i]);<NEW_LINE>if (obj != null) {<NEW_LINE>if (obj instanceof Boolean) {<NEW_LINE>vals[i] = (boolean) obj ? 1.0 : 0.0;<NEW_LINE>} else {<NEW_LINE>vals[i] = ((Number) obj).doubleValue();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>vals[i] = null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (int i = 0; i < numberN; i++) {<NEW_LINE>if (vals[i] != null) {<NEW_LINE>double val = vals[i];<NEW_LINE>max.set(i, Math.max(val, max.get(i)));<NEW_LINE>min.set(i, Math.min(val, min.get(i)));<NEW_LINE>sum.add(i, val);<NEW_LINE>squareSum.add(i, val * val);<NEW_LINE>sum3.add(i, val * val * val);<NEW_LINE>normL1.add(i, Math.abs(val));<NEW_LINE>if (calculateOuterProduct) {<NEW_LINE>for (int j = i; j < numberN; j++) {<NEW_LINE>if (vals[j] != null) {<NEW_LINE>outerProduct.add(i, j, val * vals[j]);<NEW_LINE>xSum.add(i, j, val);<NEW_LINE>xSquareSum.add(i, j, val * val);<NEW_LINE>xyCount.add(i, j, 1);<NEW_LINE>if (j != i) {<NEW_LINE>xSum.add(j, i, vals[j]);<NEW_LINE>xSquareSum.add(j, i, vals[j] * vals[j]);<NEW_LINE>xyCount.add(j, i, 1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return this;<NEW_LINE>} | int n = row.getArity(); |
1,635,098 | public void executeImpl(Connection metaDbConnection, ExecutionContext executionContext) {<NEW_LINE>Map<String, List<String>> virtualStorageOutDatedGroup = new HashMap<>();<NEW_LINE>List<String> uselessGroupList = new ArrayList<>();<NEW_LINE>ComplexTaskOutlineAccessor complexTaskOutlineAccessor = new ComplexTaskOutlineAccessor();<NEW_LINE>complexTaskOutlineAccessor.setConnection(metaDbConnection);<NEW_LINE>complexTaskOutlineAccessor.deleteScaleOutSubTaskByJobId(getJobId(), ComplexTaskMetaManager.<MASK><NEW_LINE>complexTaskOutlineAccessor.invalidScaleOutTaskByJobId(getJobId(), ComplexTaskMetaManager.ComplexTaskType.MOVE_DATABASE.getValue());<NEW_LINE>virtualStorageOutDatedGroup.put(VIRTUAL_STORAGE_ID, uselessGroupList);<NEW_LINE>for (Map.Entry<String, String> entry : sourceTargetGroupMap.entrySet()) {<NEW_LINE>virtualStorageOutDatedGroup.get(VIRTUAL_STORAGE_ID).add(entry.getValue());<NEW_LINE>}<NEW_LINE>ScaleOutUtils.cleanUpUselessGroups(virtualStorageOutDatedGroup, schemaName, executionContext);<NEW_LINE>} | ComplexTaskType.MOVE_DATABASE.getValue()); |
1,690,851 | private static void load_class_helper(CodeEmitter e, final Type type) {<NEW_LINE>if (e.isStaticHook()) {<NEW_LINE>// have to fall back on non-optimized load<NEW_LINE>e.push(TypeUtils.emulateClassGetName(type));<NEW_LINE>e.invoke_static(Constants.TYPE_CLASS, FOR_NAME);<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>String typeName = TypeUtils.emulateClassGetName(type);<NEW_LINE>// TODO: can end up with duplicated field names when using chained transformers; incorporate static hook # somehow<NEW_LINE>String fieldName = "CGLIB$load_class$" + TypeUtils.escapeType(typeName);<NEW_LINE>if (!ce.isFieldDeclared(fieldName)) {<NEW_LINE>ce.declare_field(Constants.PRIVATE_FINAL_STATIC, fieldName, Constants.TYPE_CLASS, null);<NEW_LINE>CodeEmitter hook = ce.getStaticHook();<NEW_LINE>hook.push(typeName);<NEW_LINE>hook.invoke_static(Constants.TYPE_CLASS, FOR_NAME);<NEW_LINE>hook.putstatic(ce.getClassType(), fieldName, Constants.TYPE_CLASS);<NEW_LINE>}<NEW_LINE>e.getfield(fieldName);<NEW_LINE>}<NEW_LINE>} | ClassEmitter ce = e.getClassEmitter(); |
326,843 | public AMParameterServerState transition(AMParameterServer parameterServer, AMParameterServerEvent event) {<NEW_LINE>PSAttemptId psAttemptId = ((PSPAttemptEvent) event).getPSAttemptId();<NEW_LINE>parameterServer.failedAttempts.add(psAttemptId);<NEW_LINE>if (parameterServer.runningPSAttemptId == psAttemptId) {<NEW_LINE>parameterServer.runningPSAttemptId = null;<NEW_LINE>}<NEW_LINE>// add diagnostic<NEW_LINE>StringBuilder psDiagnostic = new StringBuilder();<NEW_LINE>psDiagnostic.append(psAttemptId.toString()).append(" failed due to: ").append(StringUtils.join("\n", parameterServer.attempts.get(psAttemptId).getDiagnostics()));<NEW_LINE>if (LOG.isDebugEnabled()) {<NEW_LINE>LOG.debug(psAttemptId + "failed due to:" + psDiagnostic.toString());<NEW_LINE>}<NEW_LINE>parameterServer.diagnostics.<MASK><NEW_LINE>// check whether the number of failed attempts is less than the maximum number of allowed<NEW_LINE>if (parameterServer.failedAttempts.size() < parameterServer.maxAttempts) {<NEW_LINE>// Refresh ps location & matrix meta<NEW_LINE>LOG.info("PS " + parameterServer.getId() + " failed, modify location and metadata");<NEW_LINE>parameterServer.context.getLocationManager().setPsLocation(psAttemptId.getPsId(), null);<NEW_LINE>if (parameterServer.context.getPSReplicationNum() > 1) {<NEW_LINE>parameterServer.context.getMatrixMetaManager().psFailed(psAttemptId.getPsId());<NEW_LINE>}<NEW_LINE>// start a new attempt for this ps<NEW_LINE>parameterServer.addAndScheduleAttempt();<NEW_LINE>return parameterServer.stateMachine.getCurrentState();<NEW_LINE>} else {<NEW_LINE>// notify ps manager<NEW_LINE>parameterServer.getContext().getEventHandler().handle(new ParameterServerManagerEvent(ParameterServerManagerEventType.PARAMETERSERVER_FAILED, parameterServer.getId()));<NEW_LINE>return AMParameterServerState.FAILED;<NEW_LINE>}<NEW_LINE>} | add(psDiagnostic.toString()); |
337,205 | public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, @Nonnull List<String> tooltip, @Nonnull ITooltipFlag flagIn) {<NEW_LINE>super.addInformation(stack, worldIn, tooltip, flagIn);<NEW_LINE>CapturedMob capturedMob = CapturedMob.create(stack);<NEW_LINE>if (capturedMob != null) {<NEW_LINE>tooltip.add(capturedMob.getDisplayName());<NEW_LINE><MASK><NEW_LINE>if (health >= 0) {<NEW_LINE>float maxHealth = capturedMob.getMaxHealth();<NEW_LINE>if (maxHealth >= 0) {<NEW_LINE>tooltip.add(Lang.SOUL_VIAL_HEALTH.get(String.format("%3.1f/%3.1f", health, maxHealth)));<NEW_LINE>} else {<NEW_LINE>tooltip.add(Lang.SOUL_VIAL_HEALTH.get(String.format("%3.1f", health)));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String fluidName = capturedMob.getFluidName();<NEW_LINE>if (fluidName != null) {<NEW_LINE>Fluid fluid = FluidRegistry.getFluid(fluidName);<NEW_LINE>if (fluid != null) {<NEW_LINE>String localizedName = fluid.getLocalizedName(new FluidStack(fluid, 1));<NEW_LINE>tooltip.add(Lang.SOUL_VIAL_FLUID.get(localizedName));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>DyeColor color = capturedMob.getColor();<NEW_LINE>if (color != null) {<NEW_LINE>tooltip.add(Lang.SOUL_VIAL_COLOR.get(color.getLocalisedName()));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>tooltip.add(Lang.SOUL_VIAL_EMPTY.get());<NEW_LINE>}<NEW_LINE>} | float health = capturedMob.getHealth(); |
853,979 | private RFuture<ScanResult<Object>> distributedScanIteratorAsync(String iteratorName, int count) {<NEW_LINE>return commandExecutor.evalWriteAsync(getRawName(), codec, RedisCommands.EVAL_SSCAN, "local cursor = redis.call('get', KEYS[3]); " + "if cursor ~= false then " + "cursor = tonumber(cursor); " + "else " + "cursor = 0;" + "end;" + "if start_index == -1 then " + "return {0, {}}; " + "end;" + "local end_index = start_index + ARGV[1];" + "local result; " + "result = redis.call('lrange', KEYS[1], start_index, end_index - 1); " + "if end_index > redis.call('llen', KEYS[1]) then " + "end_index = -1;" + "end; " + "redis.call('setex', KEYS[2], 3600, end_index);" + "local expireDate = 92233720368547758; " + "local expirations = redis.call('zmscore', KEYS[1], result[2])" + "for i = #expirations, 1, -1 do " + "if expirations[i] ~= false then " + "local expireDate = tonumber(expireDateScore) " + "if expireDate <= tonumber(ARGV[1]) then " + "table.remove(result[2], i);" + "end; " + "end; " + "end; " + "return {end_index, result[2]};", Arrays.<Object>asList(timeoutSetName, getRawName(), iteratorName), <MASK><NEW_LINE>} | System.currentTimeMillis(), count); |
1,549,714 | private Properties readProperties(byte[] data) throws IOException {<NEW_LINE>// Properties are defined as name=value pairs where value may be over several lines<NEW_LINE>Properties properties = new Properties();<NEW_LINE>try (Reader isr = new InputStreamReader(new ByteArrayInputStream(data));<NEW_LINE>BufferedReader br = new BufferedReader(isr)) {<NEW_LINE>String line;<NEW_LINE>String lastName = null;<NEW_LINE>while ((line = br.readLine()) != null) {<NEW_LINE>line = line.trim();<NEW_LINE>int equalsPos = line.indexOf("=");<NEW_LINE>if ((equalsPos > 0) && ((equalsPos + 1) < line.length())) {<NEW_LINE>String name = <MASK><NEW_LINE>String value = line.substring(equalsPos + 1);<NEW_LINE>properties.setProperty(name, value);<NEW_LINE>lastName = name;<NEW_LINE>} else if (lastName != null) {<NEW_LINE>properties.setProperty(lastName, String.valueOf(properties.get(lastName)) + line);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return properties;<NEW_LINE>} | line.substring(0, equalsPos); |
1,414,979 | private void processInput(EntityRef entity, CharacterMovementComponent characterMovementComponent) {<NEW_LINE>lookYaw = (float) ((lookYaw - lookYawDelta) % 360);<NEW_LINE>lookYawDelta = 0f;<NEW_LINE>lookPitch = (float) Math.clamp(-89, 89, lookPitch + lookPitchDelta);<NEW_LINE>lookPitchDelta = 0f;<NEW_LINE>Vector3f relMove = new Vector3f(relativeMovement);<NEW_LINE>relMove.y = 0;<NEW_LINE>Quaternionf viewRotation = new Quaternionf();<NEW_LINE>switch(characterMovementComponent.mode) {<NEW_LINE>case CROUCHING:<NEW_LINE>case WALKING:<NEW_LINE>if (!config.getRendering().isVrSupport()) {<NEW_LINE>viewRotation.rotationYXZ(Math.toRadians<MASK><NEW_LINE>playerCamera.setOrientation(viewRotation);<NEW_LINE>}<NEW_LINE>playerCamera.getOrientation(new Quaternionf()).transform(relMove);<NEW_LINE>break;<NEW_LINE>case CLIMBING:<NEW_LINE>// Rotation is applied in KinematicCharacterMover<NEW_LINE>relMove.y += relativeMovement.y;<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>if (!config.getRendering().isVrSupport()) {<NEW_LINE>viewRotation.rotationYXZ(Math.toRadians(lookYaw), Math.toRadians(lookPitch), 0);<NEW_LINE>playerCamera.setOrientation(viewRotation);<NEW_LINE>}<NEW_LINE>playerCamera.getOrientation(new Quaternionf()).transform(relMove);<NEW_LINE>relMove.y += relativeMovement.y;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>// For some reason, Quat4f.rotate is returning NaN for valid inputs. This prevents those NaNs from causing<NEW_LINE>// trouble down the line.<NEW_LINE>if (relMove.isFinite()) {<NEW_LINE>entity.send(new CharacterMoveInputEvent(inputSequenceNumber++, lookPitch, lookYaw, relMove, run, crouch, jump, time.getGameDeltaInMs()));<NEW_LINE>}<NEW_LINE>jump = false;<NEW_LINE>} | (lookYaw), 0, 0); |
1,418,963 | @PutMapping(value = "/cmmn-runtime/plan-item-instances/{planItemInstanceId}", produces = "application/json")<NEW_LINE>public PlanItemInstanceResponse performPlanItemInstanceAction(@ApiParam(name = "planItemInstanceId") @PathVariable String planItemInstanceId, @RequestBody RestActionRequest actionRequest, HttpServletRequest request, HttpServletResponse response) {<NEW_LINE>PlanItemInstance planItemInstance = getPlanItemInstanceFromRequest(planItemInstanceId);<NEW_LINE>if (restApiInterceptor != null) {<NEW_LINE>restApiInterceptor.doPlanItemInstanceAction(planItemInstance, actionRequest);<NEW_LINE>}<NEW_LINE>if (RestActionRequest.TRIGGER.equals(actionRequest.getAction())) {<NEW_LINE>runtimeService.triggerPlanItemInstance(planItemInstance.getId());<NEW_LINE>} else if (RestActionRequest.ENABLE.equals(actionRequest.getAction())) {<NEW_LINE>runtimeService.startPlanItemInstance(planItemInstanceId);<NEW_LINE>} else if (RestActionRequest.DISABLE.equals(actionRequest.getAction())) {<NEW_LINE>runtimeService.disablePlanItemInstance(planItemInstanceId);<NEW_LINE>} else if (RestActionRequest.START.equals(actionRequest.getAction())) {<NEW_LINE>runtimeService.startPlanItemInstance(planItemInstanceId);<NEW_LINE>} else {<NEW_LINE>throw new FlowableIllegalArgumentException("Invalid action: '" + actionRequest.getAction() + "'.");<NEW_LINE>}<NEW_LINE>// Re-fetch the execution, could have changed due to action or even completed<NEW_LINE>planItemInstance = runtimeService.createPlanItemInstanceQuery().planItemInstanceId(planItemInstance.getId()).singleResult();<NEW_LINE>if (planItemInstance == null) {<NEW_LINE>// Execution is finished, return empty body to inform user<NEW_LINE>response.setStatus(<MASK><NEW_LINE>return null;<NEW_LINE>} else {<NEW_LINE>return restResponseFactory.createPlanItemInstanceResponse(planItemInstance);<NEW_LINE>}<NEW_LINE>} | HttpStatus.NO_CONTENT.value()); |
551,822 | public void run() {<NEW_LINE>bk.asyncOpenLedgerNoRecovery(lid, BookKeeper.DigestType.CRC32, conf.getBKDigestPW().getBytes(UTF_8), new org.apache.bookkeeper.client.AsyncCallback.OpenCallback() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void openComplete(int rc, LedgerHandle lh, Object ctx) {<NEW_LINE>final int cbRc;<NEW_LINE>if (BKException.Code.OK == rc) {<NEW_LINE>totalBytes.addAndGet(lh.getLength());<NEW_LINE>totalEntries.addAndGet(<MASK><NEW_LINE>cbRc = rc;<NEW_LINE>} else {<NEW_LINE>cbRc = BKException.Code.ZKException;<NEW_LINE>}<NEW_LINE>executorService.submit(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>cb.processResult(cbRc, null, null);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>}, null);<NEW_LINE>} | lh.getLastAddConfirmed() + 1); |
989,505 | public MetaFile exportObject() {<NEW_LINE>group = Beans.get(GroupRepository.class).all().filter("self.code = 'admins'").fetchOne();<NEW_LINE>try {<NEW_LINE>log.debug("Attachment dir: {}", AppService.getFileUploadDir());<NEW_LINE>String uploadDir = AppService.getFileUploadDir();<NEW_LINE>if (uploadDir == null || !new File(uploadDir).exists()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>MetaFile metaFile = new MetaFile();<NEW_LINE>String fileName = "ExportObject-" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyMMddHHmmSS")) + ".csv";<NEW_LINE>metaFile.setFileName(fileName);<NEW_LINE>metaFile.setFilePath(fileName);<NEW_LINE>metaFile = Beans.get(MetaFileRepository.class).save(metaFile);<NEW_LINE>SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();<NEW_LINE>saxParserFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);<NEW_LINE>saxParserFactory.setFeature("http://xml.org/sax/features/external-general-entities", false);<NEW_LINE>saxParserFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);<NEW_LINE>saxParserFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);<NEW_LINE>saxParserFactory.setXIncludeAware(false);<NEW_LINE>SAXParser parser = saxParserFactory.newSAXParser();<NEW_LINE>updateObjectMap(ModuleManager.getResolution(), parser, new XmlHandler());<NEW_LINE>writeObjects(MetaFiles.getPath<MASK><NEW_LINE>return metaFile;<NEW_LINE>} catch (ParserConfigurationException | SAXException | IOException | AxelorException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | (metaFile).toFile()); |
308,072 | private ListenableFuture<?> rollupOneFromRows(int rollupLevel, String agentRollupId, String syntheticMonitorId, long to, int adjustedTTL, Iterable<Row> rows) throws Exception {<NEW_LINE>double totalDurationNanos = 0;<NEW_LINE>long executionCount = 0;<NEW_LINE>ErrorIntervalCollector errorIntervalCollector = new ErrorIntervalCollector();<NEW_LINE>for (Row row : rows) {<NEW_LINE>int i = 0;<NEW_LINE>totalDurationNanos += row.getDouble(i++);<NEW_LINE>executionCount += row.getLong(i++);<NEW_LINE>ByteBuffer errorIntervalsBytes = row.getBytes(i++);<NEW_LINE>if (errorIntervalsBytes == null) {<NEW_LINE>errorIntervalCollector.addGap();<NEW_LINE>} else {<NEW_LINE>List<Stored.ErrorInterval> errorIntervals = Messages.parseDelimitedFrom(errorIntervalsBytes, Stored.ErrorInterval.parser());<NEW_LINE>errorIntervalCollector.addErrorIntervals(fromProto(errorIntervals));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>BoundStatement boundStatement = insertResultPS.get(rollupLevel).bind();<NEW_LINE>int i = 0;<NEW_LINE>boundStatement.setString(i++, agentRollupId);<NEW_LINE>boundStatement.setString(i++, syntheticMonitorId);<NEW_LINE>boundStatement.setTimestamp(i++, new Date(to));<NEW_LINE>boundStatement.setDouble(i++, totalDurationNanos);<NEW_LINE>boundStatement.setLong(i++, executionCount);<NEW_LINE>List<ErrorInterval> mergedErrorIntervals = errorIntervalCollector.getMergedErrorIntervals();<NEW_LINE>if (mergedErrorIntervals.isEmpty()) {<NEW_LINE>boundStatement.setToNull(i++);<NEW_LINE>} else {<NEW_LINE>boundStatement.setBytes(i++, Messages.<MASK><NEW_LINE>}<NEW_LINE>boundStatement.setInt(i++, adjustedTTL);<NEW_LINE>return session.writeAsync(boundStatement);<NEW_LINE>} | toByteBuffer(toProto(mergedErrorIntervals))); |
1,743,818 | public static <K, V> Map<K, V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9) {<NEW_LINE>Map<K, V> result = new HashMap<>(9);<NEW_LINE><MASK><NEW_LINE>result.put(k2, v2);<NEW_LINE>result.put(k3, v3);<NEW_LINE>result.put(k4, v4);<NEW_LINE>result.put(k5, v5);<NEW_LINE>result.put(k6, v6);<NEW_LINE>result.put(k7, v7);<NEW_LINE>result.put(k8, v8);<NEW_LINE>result.put(k9, v9);<NEW_LINE>return Collections.unmodifiableMap(result);<NEW_LINE>} | result.put(k1, v1); |
808,825 | final ImportStacksToStackSetResult executeImportStacksToStackSet(ImportStacksToStackSetRequest importStacksToStackSetRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(importStacksToStackSetRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ImportStacksToStackSetRequest> request = null;<NEW_LINE>Response<ImportStacksToStackSetResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new ImportStacksToStackSetRequestMarshaller().marshall(super.beforeMarshalling(importStacksToStackSetRequest));<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, "CloudFormation");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ImportStacksToStackSet");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<ImportStacksToStackSetResult> responseHandler = new StaxResponseHandler<ImportStacksToStackSetResult>(new ImportStacksToStackSetResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.RequestMarshallTime); |
791,903 | public ConnectInboundOutputImpl apply(@NotNull final ConnectInboundInputImpl input, @NotNull final ConnectInboundOutputImpl output) {<NEW_LINE>if (output.isPrevent()) {<NEW_LINE>// it's already prevented so no further interceptors must be called.<NEW_LINE>return output;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>final ConnectInboundInterceptor <MASK><NEW_LINE>if (interceptor != null) {<NEW_LINE>interceptor.onConnect(input, output);<NEW_LINE>}<NEW_LINE>} catch (final Throwable e) {<NEW_LINE>log.warn("Uncaught exception was thrown from extension with id \"{}\" on inbound CONNECT interception. " + "Extensions are responsible for their own exception handling.", extensionId, e);<NEW_LINE>output.prevent(String.format(ReasonStrings.CONNACK_UNSPECIFIED_ERROR_EXTENSION_EXCEPTION, clientId), "Exception in CONNECT inbound interceptor");<NEW_LINE>Exceptions.rethrowError(e);<NEW_LINE>}<NEW_LINE>return output;<NEW_LINE>} | interceptor = provider.getConnectInboundInterceptor(providerInput); |
65,921 | public String toSql(OlapTable table, List<Long> partitionId) {<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>sb.append("PARTITION BY RANGE(");<NEW_LINE>int idx = 0;<NEW_LINE>for (Column column : partitionColumns) {<NEW_LINE>if (idx != 0) {<NEW_LINE>sb.append(", ");<NEW_LINE>}<NEW_LINE>sb.append("`").append(column.getName()).append("`");<NEW_LINE>idx++;<NEW_LINE>}<NEW_LINE>sb.append(")\n(");<NEW_LINE>// sort range<NEW_LINE>List<Map.Entry<Long, PartitionItem>> entries = new ArrayList<>(this.idToItem.entrySet());<NEW_LINE>Collections.<MASK><NEW_LINE>idx = 0;<NEW_LINE>for (Map.Entry<Long, PartitionItem> entry : entries) {<NEW_LINE>Partition partition = table.getPartition(entry.getKey());<NEW_LINE>String partitionName = partition.getName();<NEW_LINE>Range<PartitionKey> range = entry.getValue().getItems();<NEW_LINE>// print all partitions' range is fixed range, even if some of them is created by less than range<NEW_LINE>sb.append("PARTITION ").append(partitionName).append(" VALUES [");<NEW_LINE>sb.append(range.lowerEndpoint().toSql());<NEW_LINE>sb.append(", ").append(range.upperEndpoint().toSql()).append(")");<NEW_LINE>if (partitionId != null) {<NEW_LINE>partitionId.add(entry.getKey());<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (idx != entries.size() - 1) {<NEW_LINE>sb.append(",\n");<NEW_LINE>}<NEW_LINE>idx++;<NEW_LINE>}<NEW_LINE>sb.append(")");<NEW_LINE>return sb.toString();<NEW_LINE>} | sort(entries, RangeUtils.RANGE_MAP_ENTRY_COMPARATOR); |
995,650 | private void sendMessage(FlowElement flowElement, DelegateExecution execution) {<NEW_LINE>Collection<MessageEventDefinition> messageDefinitions = flowElement.getChildElementsByType(MessageEventDefinition.class);<NEW_LINE>if (messageDefinitions.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>MessageEventDefinition messageDefinition = messageDefinitions.iterator().next();<NEW_LINE>String message = messageDefinition.getMessage().getName();<NEW_LINE>if (message.contains("${")) {<NEW_LINE>String[] msg = message.split("\\$\\{");<NEW_LINE>String expr = msg[1].replace("}", "");<NEW_LINE>message = msg[0<MASK><NEW_LINE>}<NEW_LINE>log.debug("Sending message: {}", message);<NEW_LINE>MessageCorrelationBuilder msgBuilder = execution.getProcessEngineServices().getRuntimeService().createMessageCorrelation(message);<NEW_LINE>String processKey = getProcessKey(execution, execution.getProcessDefinitionId());<NEW_LINE>log.debug("Process key: {}", processKey);<NEW_LINE>msgBuilder.setVariable(processKey, execution.getProcessInstanceId());<NEW_LINE>Collection<MessageCorrelationResult> results = msgBuilder.correlateAllWithResult();<NEW_LINE>log.debug("Message result : {}", results.size());<NEW_LINE>for (MessageCorrelationResult result : results) {<NEW_LINE>ProcessInstance resultInstance = result.getProcessInstance();<NEW_LINE>log.debug("Resulted process instance: {}", resultInstance);<NEW_LINE>if (resultInstance != null) {<NEW_LINE>execution.setVariable(getProcessKey(execution, resultInstance.getProcessDefinitionId()), resultInstance.getId());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ] + execution.getVariable(expr); |
1,392,453 | public void writeConfig() throws ExecutionException, TimeoutException, InterruptedException {<NEW_LINE>long startTime = System.currentTimeMillis();<NEW_LINE>FutureCallback<None> callback = new FutureCallback<>();<NEW_LINE>_store.start(callback);<NEW_LINE>callback.get(_timeout, _timeoutUnit);<NEW_LINE>final Semaphore outstandingPutSemaphore = new Semaphore(_maxOutstandingWrites);<NEW_LINE>for (final String key : _source.keySet()) {<NEW_LINE>Map<String, Object> map = merge(_source.get(key), _defaultMap);<NEW_LINE>T properties = _builder.fromMap(map);<NEW_LINE>Callback<None> putCallback = new Callback<None>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onSuccess(None none) {<NEW_LINE>outstandingPutSemaphore.release();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onError(Throwable e) {<NEW_LINE>_log.error("Put failed for {}", key, e);<NEW_LINE>outstandingPutSemaphore.release();<NEW_LINE>}<NEW_LINE>};<NEW_LINE>if (!outstandingPutSemaphore.tryAcquire(_timeout, _timeoutUnit)) {<NEW_LINE>_log.error("Put timed out for {}", key);<NEW_LINE>throw new TimeoutException();<NEW_LINE>}<NEW_LINE>_store.<MASK><NEW_LINE>}<NEW_LINE>// Wait until all puts are finished.<NEW_LINE>if (!outstandingPutSemaphore.tryAcquire(_maxOutstandingWrites, _timeout, _timeoutUnit)) {<NEW_LINE>_log.error("Put timed out with {} outstanding writes", _maxOutstandingWrites - outstandingPutSemaphore.availablePermits());<NEW_LINE>throw new TimeoutException();<NEW_LINE>}<NEW_LINE>FutureCallback<None> shutdownCallback = new FutureCallback<>();<NEW_LINE>_store.shutdown(shutdownCallback);<NEW_LINE>shutdownCallback.get(_timeout, _timeoutUnit);<NEW_LINE>long elapsedTime = System.currentTimeMillis() - startTime;<NEW_LINE>_log.info("A total of {}.{}s elapsed to write configs to store.", elapsedTime / 1000, elapsedTime % 1000);<NEW_LINE>} | put(key, properties, putCallback); |
790,145 | private static Deque<DualKey> initStack(Object a, Object b, List<String> parentPath, Map<String, Comparator<?>> comparatorByPropertyOrField, TypeComparators comparatorByType) {<NEW_LINE>Deque<DualKey> <MASK><NEW_LINE>boolean isRootObject = parentPath == null;<NEW_LINE>List<String> currentPath = isRootObject ? new ArrayList<>() : parentPath;<NEW_LINE>DualKey basicDualKey = new DualKey(currentPath, a, b);<NEW_LINE>if (a != null && b != null && !isContainerType(a) && !isContainerType(b) && (isRootObject || !hasCustomComparator(basicDualKey, comparatorByPropertyOrField, comparatorByType))) {<NEW_LINE>// disregard the equals method and start comparing fields<NEW_LINE>Set<String> aFieldsNames = getFieldsNames(getDeclaredFieldsIncludingInherited(a.getClass()));<NEW_LINE>if (!aFieldsNames.isEmpty()) {<NEW_LINE>Set<String> bFieldsNames = getFieldsNames(getDeclaredFieldsIncludingInherited(b.getClass()));<NEW_LINE>if (!bFieldsNames.containsAll(aFieldsNames)) {<NEW_LINE>stack.addFirst(basicDualKey);<NEW_LINE>} else {<NEW_LINE>for (String fieldName : aFieldsNames) {<NEW_LINE>List<String> fieldPath = new ArrayList<>(currentPath);<NEW_LINE>fieldPath.add(fieldName);<NEW_LINE>DualKey dk = new DualKey(fieldPath, COMPARISON.getSimpleValue(fieldName, a), COMPARISON.getSimpleValue(fieldName, b));<NEW_LINE>stack.addFirst(dk);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>stack.addFirst(basicDualKey);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>stack.addFirst(basicDualKey);<NEW_LINE>}<NEW_LINE>return stack;<NEW_LINE>} | stack = new LinkedList<>(); |
381,617 | public void onDone(final String collectionId) {<NEW_LINE>new Thread(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>String[] orderBy;<NEW_LINE>switch(sortMode) {<NEW_LINE>case SORT_ALPHA:<NEW_LINE>orderBy = new String[] { CollectionDb.ALBUMS_ALBUM + " COLLATE NOCASE " };<NEW_LINE>break;<NEW_LINE>case SORT_ARTIST_ALPHA:<NEW_LINE>orderBy = new String[<MASK><NEW_LINE>break;<NEW_LINE>case SORT_LAST_MODIFIED:<NEW_LINE>orderBy = new String[] { CollectionDb.ALBUMS_LASTMODIFIED + " DESC" };<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>Log.e(TAG, collectionId + " - getAlbums - sortMode not supported!");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Cursor cursor = CollectionDbManager.get().getCollectionDb(collectionId).albums(orderBy);<NEW_LINE>CollectionCursor<Album> collectionCursor = new CollectionCursor<>(cursor, Album.class, null, null);<NEW_LINE>deferred.resolve(collectionCursor);<NEW_LINE>}<NEW_LINE>}).start();<NEW_LINE>} | ] { CollectionDb.ARTISTS_ARTIST + " COLLATE NOCASE " }; |
237,091 | public void applyUpdater(INDArray gradient, int iteration, int epoch) {<NEW_LINE>if (msg == null || msdx == null)<NEW_LINE>throw new IllegalStateException("Updater has not been initialized with view state");<NEW_LINE>double rho = config.getRho();<NEW_LINE>double epsilon = config.getEpsilon();<NEW_LINE>// Line 4 of Algorithm 1: https://arxiv.org/pdf/1212.5701v1.pdf<NEW_LINE>// E[g^2]_t = rho * E[g^2]_{t-1} + (1-rho)*g^2_t<NEW_LINE>// Calculate update:<NEW_LINE>// dX = - g * RMS[delta x]_{t-1} / RMS[g]_t<NEW_LINE>// Note: negative is applied in the DL4J step function: params -= update rather than params += update<NEW_LINE>// Accumulate gradients: E[delta x^2]_t = rho * E[delta x^2]_{t-1} + (1-rho)* (delta x_t)^2<NEW_LINE>Nd4j.exec(new org.nd4j.linalg.api.ops.impl.updaters.AdaDeltaUpdater(gradient, msg<MASK><NEW_LINE>} | , msdx, rho, epsilon)); |
1,739,269 | <T> Record<T> retrieveRecord(String providerKey, String dynamicKey, String dynamicKeyGroup, boolean useExpiredDataIfLoaderNotAvailable, Long lifeTime, boolean isEncrypted) {<NEW_LINE>String composedKey = <MASK><NEW_LINE>Record<T> record = memory.getIfPresent(composedKey);<NEW_LINE>if (record != null) {<NEW_LINE>record.setSource(Source.MEMORY);<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>record = persistence.retrieveRecord(composedKey, isEncrypted, encryptKey);<NEW_LINE>record.setSource(Source.PERSISTENCE);<NEW_LINE>memory.put(composedKey, record);<NEW_LINE>} catch (Exception ignore) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>record.setLifeTime(lifeTime);<NEW_LINE>if (hasRecordExpired.hasRecordExpired(record)) {<NEW_LINE>if (!dynamicKeyGroup.isEmpty()) {<NEW_LINE>evictRecord.evictRecordMatchingDynamicKeyGroup(providerKey, dynamicKey, dynamicKeyGroup);<NEW_LINE>} else if (!dynamicKey.isEmpty()) {<NEW_LINE>evictRecord.evictRecordsMatchingDynamicKey(providerKey, dynamicKey);<NEW_LINE>} else {<NEW_LINE>evictRecord.evictRecordsMatchingProviderKey(providerKey);<NEW_LINE>}<NEW_LINE>return useExpiredDataIfLoaderNotAvailable ? record : null;<NEW_LINE>}<NEW_LINE>return record;<NEW_LINE>} | composeKey(providerKey, dynamicKey, dynamicKeyGroup); |
433,265 | public void check() throws SQLException {<NEW_LINE>SQLite3Tables randomTables = s.getRandomTableNonEmptyTables();<NEW_LINE>List<SQLite3Column> columns = randomTables.getColumns();<NEW_LINE>gen = new SQLite3ExpressionGenerator<MASK><NEW_LINE>SQLite3Expression randomWhereCondition = gen.generateExpression();<NEW_LINE>List<SQLite3Table> tables = randomTables.getTables();<NEW_LINE>List<Join> joinStatements = gen.getRandomJoinClauses(tables);<NEW_LINE>List<SQLite3Expression> tableRefs = SQLite3Common.getTableRefs(tables, s);<NEW_LINE>SQLite3Select select = new SQLite3Select();<NEW_LINE>select.setFromTables(tableRefs);<NEW_LINE>select.setJoinClauses(joinStatements);<NEW_LINE>int optimizedCount = getOptimizedQuery(select, randomWhereCondition);<NEW_LINE>int unoptimizedCount = getUnoptimizedQuery(select, randomWhereCondition);<NEW_LINE>if (optimizedCount == NO_VALID_RESULT || unoptimizedCount == NO_VALID_RESULT) {<NEW_LINE>throw new IgnoreMeException();<NEW_LINE>}<NEW_LINE>if (optimizedCount != unoptimizedCount) {<NEW_LINE>state.getState().getLocalState().log(optimizedQueryString + ";\n" + unoptimizedQueryString + ";");<NEW_LINE>throw new AssertionError(optimizedCount + " " + unoptimizedCount);<NEW_LINE>}<NEW_LINE>} | (state).setColumns(columns); |
272,046 | public void execute(BaseRequest request, BaseResponse response) {<NEW_LINE>String connStr = request.getSingleParameter("connection_id");<NEW_LINE>if (connStr == null) {<NEW_LINE>response.<MASK><NEW_LINE>sendResult(request, response, HttpResponseStatus.BAD_REQUEST);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int connectionId = Integer.valueOf(connStr.trim());<NEW_LINE>ConnectContext context = ExecuteEnv.getInstance().getScheduler().getContext(connectionId);<NEW_LINE>if (context == null || context.queryId() == null) {<NEW_LINE>response.getContent().append("connection id " + connectionId + " not found.");<NEW_LINE>sendResult(request, response, HttpResponseStatus.NOT_FOUND);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String queryId = DebugUtil.printId(context.queryId());<NEW_LINE>response.setContentType("application/json");<NEW_LINE>response.getContent().append("{\"query_id\" : \"" + queryId + "\"}");<NEW_LINE>sendResult(request, response);<NEW_LINE>} | getContent().append("not valid parameter"); |
257,381 | protected void checkDatabase(String storeName) {<NEW_LINE>DbUpdater dbUpdater = AppBeans.getPrototype(DbUpdater.NAME, storeName);<NEW_LINE>try {<NEW_LINE>boolean initialized = false;<NEW_LINE>try {<NEW_LINE>initialized = dbUpdater.dbInitialized();<NEW_LINE>} catch (DbInitializationException e) {<NEW_LINE>if (!Stores.isMain(storeName)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!initialized) {<NEW_LINE>throw new IllegalStateException(StringHelper.wrapLogMessage("ERROR: Data store " + (Stores.isMain(storeName) ? "" : "[" + storeNameToString(storeName) + "]") + <MASK><NEW_LINE>}<NEW_LINE>List<String> scripts = dbUpdater.findUpdateDatabaseScripts();<NEW_LINE>if (!scripts.isEmpty()) {<NEW_LINE>log.warn(StringHelper.wrapLogMessage("WARNING: The application contains unapplied update scripts for data store" + (Stores.isMain(storeName) ? "" : " [" + storeNameToString(storeName) + "]") + ":\n\n" + Joiner.on('\n').join(scripts) + "\n\n" + getLogString(storeName)));<NEW_LINE>}<NEW_LINE>} catch (DbInitializationException e) {<NEW_LINE>throw new RuntimeException(StringHelper.wrapLogMessage("ERROR: Cannot check data store [" + storeNameToString(storeName) + "]. See the stacktrace below for details."), e);<NEW_LINE>}<NEW_LINE>} | "is not initialized. " + getLogString(storeName))); |
32,544 | public void updateEffectiveValues(@NonNull final de.metas.inoutcandidate.model.I_M_ShipmentSchedule shipmentSchedule) {<NEW_LINE>final I_M_ShipmentSchedule //<NEW_LINE>//<NEW_LINE>shipmentScheduleToUse = create(shipmentSchedule, I_M_ShipmentSchedule.class);<NEW_LINE>// initialize values with the calculated ones<NEW_LINE>BigDecimal qtyTU_Effective = shipmentScheduleToUse.getQtyTU_Calculated();<NEW_LINE><MASK><NEW_LINE>if (!isNull(shipmentSchedule, I_M_ShipmentSchedule.COLUMNNAME_QtyTU_Override)) {<NEW_LINE>qtyTU_Effective = shipmentScheduleToUse.getQtyTU_Override();<NEW_LINE>}<NEW_LINE>if (!isNull(shipmentSchedule, I_M_ShipmentSchedule.COLUMNNAME_M_HU_PI_Item_Product_Override_ID)) {<NEW_LINE>piItemProduct_Effective = shipmentScheduleToUse.getM_HU_PI_Item_Product_Override();<NEW_LINE>// safe because only applied when M_HU_PI_Item_Product_Effective is not null<NEW_LINE>if (X_M_HU_PI_Version.HU_UNITTYPE_VirtualPI.equals(piItemProduct_Effective.getM_HU_PI_Item().getM_HU_PI_Version().getHU_UnitType())) {<NEW_LINE>qtyTU_Effective = ONE;<NEW_LINE>shipmentScheduleToUse.setQtyTU_Override(ONE);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>shipmentScheduleToUse.setQtyOrdered_TU(qtyTU_Effective);<NEW_LINE>shipmentScheduleToUse.setM_HU_PI_Item_Product(piItemProduct_Effective);<NEW_LINE>// set pack description<NEW_LINE>final String description;<NEW_LINE>if (piItemProduct_Effective == null) {<NEW_LINE>description = "";<NEW_LINE>} else {<NEW_LINE>description = piItemProduct_Effective.getDescription();<NEW_LINE>}<NEW_LINE>shipmentScheduleToUse.setPackDescription((Check.isEmpty(description, true) ? "" : description));<NEW_LINE>} | I_M_HU_PI_Item_Product piItemProduct_Effective = shipmentScheduleToUse.getM_HU_PI_Item_Product_Calculated(); |
1,085,702 | public void save(final OutputStream os, final Object obj) {<NEW_LINE>final EncogWriteHelper out = new EncogWriteHelper(os);<NEW_LINE>final PrgPopulation pop = (PrgPopulation) obj;<NEW_LINE>out.addSection("BASIC");<NEW_LINE>out.addSubSection("PARAMS");<NEW_LINE>out.addProperties(pop.getProperties());<NEW_LINE>out.addSubSection("EPL-OPCODES");<NEW_LINE>for (final ProgramExtensionTemplate temp : pop.getContext().getFunctions().getOpCodes()) {<NEW_LINE>out.addColumn(temp.getName());<NEW_LINE>out.addColumn(temp.getChildNodeCount());<NEW_LINE>out.writeLine();<NEW_LINE>}<NEW_LINE>out.addSubSection("EPL-SYMBOLIC");<NEW_LINE>out.addColumn("name");<NEW_LINE>out.addColumn("type");<NEW_LINE>out.addColumn("enum");<NEW_LINE>out.addColumn("enum_type");<NEW_LINE>out.addColumn("enum_count");<NEW_LINE>out.writeLine();<NEW_LINE>// write the first line, the result<NEW_LINE>out.addColumn("");<NEW_LINE>out.addColumn(getType(pop.getContext().getResult()));<NEW_LINE>out.addColumn(pop.getContext().getResult().getEnumType());<NEW_LINE>out.addColumn(pop.getContext().getResult().getEnumValueCount());<NEW_LINE>out.writeLine();<NEW_LINE>// write the next lines, the variables<NEW_LINE>for (final VariableMapping mapping : pop.getContext().getDefinedVariables()) {<NEW_LINE>out.addColumn(mapping.getName());<NEW_LINE>out.addColumn(getType(mapping));<NEW_LINE>out.addColumn(mapping.getEnumType());<NEW_LINE>out.addColumn(mapping.getEnumValueCount());<NEW_LINE>out.writeLine();<NEW_LINE>}<NEW_LINE>out.addSubSection("EPL-POPULATION");<NEW_LINE>for (final Species species : pop.getSpecies()) {<NEW_LINE>if (species.getMembers().size() > 0) {<NEW_LINE>out.addColumn("s");<NEW_LINE>out.addColumn(species.getAge());<NEW_LINE>out.<MASK><NEW_LINE>out.addColumn(species.getGensNoImprovement());<NEW_LINE>out.writeLine();<NEW_LINE>for (final Genome genome : species.getMembers()) {<NEW_LINE>final EncogProgram prg = (EncogProgram) genome;<NEW_LINE>out.addColumn("p");<NEW_LINE>if (Double.isInfinite(prg.getScore()) || Double.isNaN(prg.getScore())) {<NEW_LINE>out.addColumn("NaN");<NEW_LINE>out.addColumn("NaN");<NEW_LINE>} else {<NEW_LINE>out.addColumn(prg.getScore());<NEW_LINE>out.addColumn(prg.getAdjustedScore());<NEW_LINE>}<NEW_LINE>out.addColumn(prg.generateEPL());<NEW_LINE>out.writeLine();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>out.flush();<NEW_LINE>} | addColumn(species.getBestScore()); |
504,712 | public void extractKeyParts(CacheKeyBuilder keyBuilder, Object targetObject, Object[] params) {<NEW_LINE>//<NEW_LINE>// include specified property values into the key<NEW_LINE>for (final String keyProp : keyProperties) {<NEW_LINE>if (targetObject instanceof PO) {<NEW_LINE><MASK><NEW_LINE>if (po.get_ColumnIndex(keyProp) < 0) {<NEW_LINE>final String msg = // + "." + constructorOrMethod.getName()<NEW_LINE>"Invalid keyProperty '" + keyProp + "' for cached method " + targetObject.getClass() + ". Target PO has no such column; PO=" + po;<NEW_LINE>throw new RuntimeException(msg);<NEW_LINE>}<NEW_LINE>final Object keyValue = po.get_Value(keyProp);<NEW_LINE>keyBuilder.add(keyValue);<NEW_LINE>} else {<NEW_LINE>final StringBuilder getMethodName = new StringBuilder("get");<NEW_LINE>getMethodName.append(keyProp.substring(0, 1).toUpperCase());<NEW_LINE>getMethodName.append(keyProp.substring(1));<NEW_LINE>try {<NEW_LINE>final Method method = targetObject.getClass().getMethod(getMethodName.toString());<NEW_LINE>final Object keyValue = method.invoke(targetObject);<NEW_LINE>keyBuilder.add(keyValue);<NEW_LINE>} catch (Exception e) {<NEW_LINE>final String msg = // + "." + constructorOrMethod.getName()<NEW_LINE>"Invalid keyProperty '" + keyProp + "' for cached method " + targetObject.getClass().getName() + ". Can't access getter method get" + keyProp + ". Exception " + e + "; message: " + e.getMessage();<NEW_LINE>throw new RuntimeException(msg, e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | final PO po = (PO) targetObject; |
13,742 | protected void hardDeleteNotLoadedReference(Entity entity, MetaProperty property, Entity reference) {<NEW_LINE>((PersistenceImpl) persistence).addBeforeCommitAction(() -> {<NEW_LINE>MetadataTools metadataTools = metadata.getTools();<NEW_LINE>QueryRunner queryRunner = new QueryRunner();<NEW_LINE>try {<NEW_LINE>String column = metadataTools.getDatabaseColumn(property);<NEW_LINE>if (column != null) {<NEW_LINE>// is null for mapped-by property<NEW_LINE>String updateMasterSql = "update " + metadataTools.getDatabaseTable(metaClass) + " set " + column + " = null where " + metadataTools.getPrimaryKeyName(metaClass) + " = ?";<NEW_LINE>log.debug("Hard delete un-fetched reference: {}, bind: [{}]", updateMasterSql, entity.getId());<NEW_LINE>queryRunner.update(entityManager.getConnection(), updateMasterSql, persistence.getDbTypeConverter().getSqlObject(entity.getId()));<NEW_LINE>}<NEW_LINE>MetaClass refMetaClass = property.getRange().asClass();<NEW_LINE>String deleteRefSql = "delete from " + metadataTools.getDatabaseTable(refMetaClass) + " where " + <MASK><NEW_LINE>log.debug("Hard delete un-fetched reference: {}, bind: [{}]", deleteRefSql, reference.getId());<NEW_LINE>queryRunner.update(entityManager.getConnection(), deleteRefSql, persistence.getDbTypeConverter().getSqlObject(reference.getId()));<NEW_LINE>} catch (SQLException e) {<NEW_LINE>throw new RuntimeException("Error processing deletion of " + entity, e);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | metadataTools.getPrimaryKeyName(refMetaClass) + " = ?"; |
128,589 | public void errorResponse(byte[] data, @NotNull AbstractService service) {<NEW_LINE>TraceManager.TraceObject traceObject = TraceManager.serviceTrace(service, "get-sql-execute-error");<NEW_LINE><MASK><NEW_LINE>pauseTime((MySQLResponseService) service);<NEW_LINE>ErrorPacket errPacket = new ErrorPacket();<NEW_LINE>errPacket.read(data);<NEW_LINE>session.resetMultiStatementStatus();<NEW_LINE>lock.lock();<NEW_LINE>try {<NEW_LINE>if (!isFail()) {<NEW_LINE>err = errPacket;<NEW_LINE>setFail(new String(err.getMessage()));<NEW_LINE>}<NEW_LINE>if (errConnection == null) {<NEW_LINE>errConnection = new ArrayList<>();<NEW_LINE>}<NEW_LINE>errConnection.add((MySQLResponseService) service);<NEW_LINE>if (errPacket.getErrNo() == ErrorCode.ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION) {<NEW_LINE>readOnlyErrorCount++;<NEW_LINE>}<NEW_LINE>if (decrementToZero((MySQLResponseService) service)) {<NEW_LINE>if (session.closed()) {<NEW_LINE>cleanBuffer();<NEW_LINE>} else if (byteBuffer != null) {<NEW_LINE>session.getShardingService().writeDirectly(byteBuffer, WriteFlags.PART);<NEW_LINE>}<NEW_LINE>// just for normal error<NEW_LINE>ErrorPacket errorPacket = createErrPkg(this.error, err.getErrNo());<NEW_LINE>handleEndPacket(errorPacket, AutoTxOperation.ROLLBACK, false);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>lock.unlock();<NEW_LINE>}<NEW_LINE>} | TraceManager.finishSpan(service, traceObject); |
155,691 | private static void appendLayerInformation(StringBuilder sb, Layer[] layers, int bytesPerElement) {<NEW_LINE>Map<String, Integer> layerClasses = new HashMap<>();<NEW_LINE>for (Layer l : layers) {<NEW_LINE>if (!layerClasses.containsKey(l.getClass().getSimpleName())) {<NEW_LINE>layerClasses.put(l.getClass().getSimpleName(), 0);<NEW_LINE>}<NEW_LINE>layerClasses.put(l.getClass().getSimpleName(), layerClasses.get(l.getClass().getSimpleName()) + 1);<NEW_LINE>}<NEW_LINE>List<String> l = new ArrayList<>(layerClasses.keySet());<NEW_LINE>Collections.sort(l);<NEW_LINE>sb.append(f("Number of Layers", layers.length));<NEW_LINE>sb.append("Layer Counts\n");<NEW_LINE>for (String s : l) {<NEW_LINE>sb.append(" ").append(f(s, layerClasses.get(s)));<NEW_LINE>}<NEW_LINE>sb.append("Layer Parameter Breakdown\n");<NEW_LINE>String format = " %-3s %-20s %-20s %-20s %-20s";<NEW_LINE>sb.append(String.format(format, "Idx", "Name", "Layer Type", "Layer # Parameters", <MASK><NEW_LINE>for (Layer layer : layers) {<NEW_LINE>long numParams = layer.numParams();<NEW_LINE>sb.append(String.format(format, layer.getIndex(), layer.conf().getLayer().getLayerName(), layer.getClass().getSimpleName(), String.valueOf(numParams), fBytes(numParams * bytesPerElement))).append("\n");<NEW_LINE>}<NEW_LINE>} | "Layer Parameter Memory")).append("\n"); |
1,688,599 | public ShortestPathAStar compute(final long startNode, final long goalNode, final String propertyKeyLat, final String propertyKeyLon, final Direction direction) {<NEW_LINE>reset();<NEW_LINE>final int startNodeInternal = graph.toMappedNodeId(startNode);<NEW_LINE>final double startNodeLat = getNodeCoordinate(startNodeInternal, propertyKeyLat);<NEW_LINE>final double startNodeLon = getNodeCoordinate(startNodeInternal, propertyKeyLon);<NEW_LINE>final int goalNodeInternal = graph.toMappedNodeId(goalNode);<NEW_LINE>final double goalNodeLat = getNodeCoordinate(goalNodeInternal, propertyKeyLat);<NEW_LINE>final double goalNodeLon = getNodeCoordinate(goalNodeInternal, propertyKeyLon);<NEW_LINE>final double initialHeuristic = computeHeuristic(startNodeLat, startNodeLon, goalNodeLat, goalNodeLon);<NEW_LINE>gCosts.put(startNodeInternal, 0.0);<NEW_LINE><MASK><NEW_LINE>openNodes.add(startNodeInternal, 0.0);<NEW_LINE>run(goalNodeInternal, propertyKeyLat, propertyKeyLon, direction);<NEW_LINE>if (path.containsKey(goalNodeInternal)) {<NEW_LINE>totalCost = gCosts.get(goalNodeInternal);<NEW_LINE>int node = goalNodeInternal;<NEW_LINE>while (node != PATH_END) {<NEW_LINE>shortestPath.addFirst(node);<NEW_LINE>node = path.getOrDefault(node, PATH_END);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return this;<NEW_LINE>} | fCosts.put(startNodeInternal, initialHeuristic); |
1,394,716 | private void createNewSnapshotDirectory() throws OperationException {<NEW_LINE>final long snapshot = System.currentTimeMillis();<NEW_LINE>final String newDataDir = store.getDataDir() + "/" + ParquetStore.getSnapshotPath(snapshot) + "-tmp/";<NEW_LINE>LOGGER.info("Moving aggregated and sorted data to new snapshot-tmp directory {}", newDataDir);<NEW_LINE>try {<NEW_LINE>fs.mkdirs(new Path(newDataDir));<NEW_LINE>final FileStatus[] fss = fs.listStatus(new Path(<MASK><NEW_LINE>for (int i = 0; i < fss.length; i++) {<NEW_LINE>final Path destination = new Path(newDataDir, fss[i].getPath().getName());<NEW_LINE>LOGGER.debug("Renaming {} to {}", fss[i].getPath(), destination);<NEW_LINE>fs.rename(fss[i].getPath(), destination);<NEW_LINE>}<NEW_LINE>// Move snapshot-tmp directory to snapshot<NEW_LINE>final String directoryWithoutTmp = newDataDir.substring(0, newDataDir.lastIndexOf("-tmp"));<NEW_LINE>LOGGER.info("Renaming {} to {}", newDataDir, directoryWithoutTmp);<NEW_LINE>fs.rename(new Path(newDataDir), new Path(directoryWithoutTmp));<NEW_LINE>} catch (final IOException e) {<NEW_LINE>throw new OperationException("IOException moving files to new snapshot directory", e);<NEW_LINE>}<NEW_LINE>// Set snapshot on store to new value<NEW_LINE>LOGGER.info("Updating latest snapshot on store to {}", snapshot);<NEW_LINE>try {<NEW_LINE>store.setLatestSnapshot(snapshot);<NEW_LINE>} catch (final StoreException e) {<NEW_LINE>throw new OperationException("StoreException setting the latest snapshot on the store to " + snapshot, e);<NEW_LINE>}<NEW_LINE>} | getSortedAggregatedDirectory(true, true))); |
51,670 | public final Collection<Entry<K, V>> removeAllWithHash(int keyHash) {<NEW_LINE>List<Entry<K, V>> invalidated = new ArrayList<>();<NEW_LINE>int hash = spread(keyHash);<NEW_LINE>for (Node<K, V>[] tab = table; ; ) {<NEW_LINE>Node<K, V> f;<NEW_LINE>int n, i;<NEW_LINE>if (tab == null || (n = tab.length) == 0 || (f = tabAt(tab, i = (n - 1) & hash)) == null)<NEW_LINE>break;<NEW_LINE>else if (f.hash == MOVED)<NEW_LINE>tab = helpTransfer(tab, f);<NEW_LINE>else {<NEW_LINE>int nodesCount = 0;<NEW_LINE>synchronized (f) {<NEW_LINE>if (tabAt(tab, i) == f) {<NEW_LINE>nodesCount = nodesAt(f, invalidated);<NEW_LINE>setTabAt(tab, i, null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (nodesCount > 0) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return invalidated;<NEW_LINE>} | addCount(-nodesCount, -nodesCount); |
383,053 | public void stopRecording(final int send, boolean notify, int scheduleDate) {<NEW_LINE>if (recordStartRunnable != null) {<NEW_LINE>recordQueue.cancelRunnable(recordStartRunnable);<NEW_LINE>recordStartRunnable = null;<NEW_LINE>}<NEW_LINE>recordQueue.postRunnable(() -> {<NEW_LINE>if (sendAfterDone == 3) {<NEW_LINE>sendAfterDone = 0;<NEW_LINE>stopRecordingInternal(send, notify, scheduleDate);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (audioRecorder == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>sendAfterDone = send;<NEW_LINE>sendAfterDoneNotify = notify;<NEW_LINE>sendAfterDoneScheduleDate = scheduleDate;<NEW_LINE>audioRecorder.stop();<NEW_LINE>} catch (Exception e) {<NEW_LINE>FileLog.e(e);<NEW_LINE>if (recordingAudioFile != null) {<NEW_LINE>recordingAudioFile.delete();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (send == 0) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (!NekoConfig.disableVibration.Bool()) {<NEW_LINE>try {<NEW_LINE>feedbackView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);<NEW_LINE>} catch (Exception ignore) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>AndroidUtilities.runOnUIThread(() -> NotificationCenter.getInstance(recordingCurrentAccount).postNotificationName(NotificationCenter.recordStopped, recordingGuid, send == 2 ? 1 : 0));<NEW_LINE>});<NEW_LINE>} | stopRecordingInternal(0, false, 0); |
393,822 | public static TextEdit generateAccessors(IType type, AccessorField[] accessors, boolean generateComments, Range cursor, IProgressMonitor monitor) {<NEW_LINE>if (type == null || type.getCompilationUnit() == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>ASTNode declarationNode = null;<NEW_LINE>CompilationUnit astRoot = CoreASTProvider.getInstance().getAST(type.getCompilationUnit(), CoreASTProvider.WAIT_YES, monitor);<NEW_LINE>if (astRoot != null && cursor != null) {<NEW_LINE>ASTNode node = NodeFinder.perform(astRoot, DiagnosticsHelper.getStartOffset(type.getCompilationUnit(), cursor), DiagnosticsHelper.getLength(type.getCompilationUnit(), cursor));<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>// If cursor position is not specified, then insert to the last by default.<NEW_LINE>IJavaElement insertPosition = (declarationNode != null) ? CodeGenerationUtils.findInsertElement(type, null) : CodeGenerationUtils.findInsertElement(type, cursor);<NEW_LINE>GenerateGetterSetterOperation operation = new GenerateGetterSetterOperation(type, null, generateComments, insertPosition);<NEW_LINE>return operation.createTextEdit(null, accessors);<NEW_LINE>} catch (OperationCanceledException | CoreException e) {<NEW_LINE>JavaLanguageServerPlugin.logException("Failed to generate the accessors.", e);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | declarationNode = SourceAssistProcessor.getTypeDeclarationNode(node); |
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:").<MASK><NEW_LINE>LogUtils.getPlaintTextLogger().info(infoBuilder.toString());<NEW_LINE>if (isAsync) {<NEW_LINE>data.setSuccess(data.getJobStatus() != null && data.getJobStatus().isJobSubmitted());<NEW_LINE>}<NEW_LINE>} | append(data.getExecID()); |
1,266,338 | final CreateApplicationResult executeCreateApplication(CreateApplicationRequest createApplicationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createApplicationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateApplicationRequest> request = null;<NEW_LINE>Response<CreateApplicationResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateApplicationRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createApplicationRequest));<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, "ServerlessApplicationRepository");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateApplicationResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateApplicationResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateApplication"); |
1,046,785 | public void updateUiElements() {<NEW_LINE>super.updateUiElements();<NEW_LINE>toolbar.setBackgroundColor(getPrimaryColor());<NEW_LINE>setStatusBarColor();<NEW_LINE>setNavBarColor();<NEW_LINE>setRecentApp(getString(org.horaapps.leafpic.R.string.donate));<NEW_LINE>themeSeekBar(bar);<NEW_LINE>themeButton(btnDonateIap);<NEW_LINE>themeButton(btnDonatePP);<NEW_LINE>((TextView) findViewById(org.horaapps.leafpic.R.id.team_name)).setTextColor(getAccentColor());<NEW_LINE>((TextView) findViewById(org.horaapps.leafpic.R.id.donate_googleplay_item_title)<MASK><NEW_LINE>((TextView) findViewById(org.horaapps.leafpic.R.id.donate_paypal_item_title)).setTextColor(getAccentColor());<NEW_LINE>((TextView) findViewById(org.horaapps.leafpic.R.id.donate_bitcoin_item_title)).setTextColor(getAccentColor());<NEW_LINE>findViewById(org.horaapps.leafpic.R.id.donate_background).setBackgroundColor(getBackgroundColor());<NEW_LINE>int color = getCardBackgroundColor();<NEW_LINE>((CardView) findViewById(org.horaapps.leafpic.R.id.donate_googleplay_card)).setCardBackgroundColor(color);<NEW_LINE>((CardView) findViewById(org.horaapps.leafpic.R.id.donate_paypal_card)).setCardBackgroundColor(color);<NEW_LINE>((CardView) findViewById(org.horaapps.leafpic.R.id.donate_bitcoin_card)).setCardBackgroundColor(color);<NEW_LINE>((CardView) findViewById(org.horaapps.leafpic.R.id.donate_header_card)).setCardBackgroundColor(color);<NEW_LINE>color = getIconColor();<NEW_LINE>((ThemedIcon) findViewById(org.horaapps.leafpic.R.id.donate_googleplay_icon_title)).setColor(color);<NEW_LINE>((ThemedIcon) findViewById(org.horaapps.leafpic.R.id.donate_paypal_icon_title)).setColor(color);<NEW_LINE>((ThemedIcon) findViewById(org.horaapps.leafpic.R.id.donate_bitcoin_icon_title)).setColor(color);<NEW_LINE>((ThemedIcon) findViewById(org.horaapps.leafpic.R.id.donate_header_icon)).setColor(color);<NEW_LINE>color = getTextColor();<NEW_LINE>((TextView) findViewById(org.horaapps.leafpic.R.id.donate_googleplay_item)).setTextColor(color);<NEW_LINE>((TextView) findViewById(org.horaapps.leafpic.R.id.donate_paypal_item)).setTextColor(color);<NEW_LINE>((TextView) findViewById(org.horaapps.leafpic.R.id.donate_bitcoin_item)).setTextColor(color);<NEW_LINE>((TextView) findViewById(org.horaapps.leafpic.R.id.donate_header_item)).setTextColor(color);<NEW_LINE>setScrollViewColor(scr);<NEW_LINE>} | ).setTextColor(getAccentColor()); |
1,587,521 | public Request<ListThingGroupsForThingRequest> marshall(ListThingGroupsForThingRequest listThingGroupsForThingRequest) {<NEW_LINE>if (listThingGroupsForThingRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(ListThingGroupsForThingRequest)");<NEW_LINE>}<NEW_LINE>Request<ListThingGroupsForThingRequest> request = new DefaultRequest<ListThingGroupsForThingRequest>(listThingGroupsForThingRequest, "AWSIot");<NEW_LINE>request.setHttpMethod(HttpMethodName.GET);<NEW_LINE>String uriResourcePath = "/things/{thingName}/thing-groups";<NEW_LINE>uriResourcePath = uriResourcePath.replace("{thingName}", (listThingGroupsForThingRequest.getThingName() == null) ? "" : StringUtils.fromString(listThingGroupsForThingRequest.getThingName()));<NEW_LINE>if (listThingGroupsForThingRequest.getNextToken() != null) {<NEW_LINE>request.addParameter("nextToken", StringUtils.fromString<MASK><NEW_LINE>}<NEW_LINE>if (listThingGroupsForThingRequest.getMaxResults() != null) {<NEW_LINE>request.addParameter("maxResults", StringUtils.fromInteger(listThingGroupsForThingRequest.getMaxResults()));<NEW_LINE>}<NEW_LINE>request.setResourcePath(uriResourcePath);<NEW_LINE>if (!request.getHeaders().containsKey("Content-Type")) {<NEW_LINE>request.addHeader("Content-Type", "application/x-amz-json-1.0");<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | (listThingGroupsForThingRequest.getNextToken())); |
818,290 | protected int copyContractionsFromBaseCE32(StringBuilder context, int c, int ce32, ConditionalCE32 cond) {<NEW_LINE>int trieIndex = Collation.indexFromCE32(ce32);<NEW_LINE>int index;<NEW_LINE>if ((ce32 & Collation.CONTRACT_SINGLE_CP_NO_MATCH) != 0) {<NEW_LINE>// No match on the single code point.<NEW_LINE>// We are underneath a prefix, and the default mapping is just<NEW_LINE>// a fallback to the mappings for a shorter prefix.<NEW_LINE>assert (context.length() > 1);<NEW_LINE>index = -1;<NEW_LINE>} else {<NEW_LINE>// Default if no suffix match.<NEW_LINE>ce32 = base.getCE32FromContexts(trieIndex);<NEW_LINE>assert (!Collation.isContractionCE32(ce32));<NEW_LINE>ce32 = copyFromBaseCE32(c, ce32, true);<NEW_LINE>cond.next = index = addConditionalCE32(context.toString(), ce32);<NEW_LINE>cond = getConditionalCE32(index);<NEW_LINE>}<NEW_LINE>int suffixStart = context.length();<NEW_LINE>CharsTrie.Iterator suffixes = CharsTrie.iterator(base.contexts, trieIndex + 2, 0);<NEW_LINE>while (suffixes.hasNext()) {<NEW_LINE>CharsTrie.Entry entry = suffixes.next();<NEW_LINE>context.append(entry.chars);<NEW_LINE>ce32 = copyFromBaseCE32(<MASK><NEW_LINE>cond.next = index = addConditionalCE32(context.toString(), ce32);<NEW_LINE>// No need to update the unsafeBackwardSet because the tailoring set<NEW_LINE>// is already a copy of the base set.<NEW_LINE>cond = getConditionalCE32(index);<NEW_LINE>context.setLength(suffixStart);<NEW_LINE>}<NEW_LINE>assert (index >= 0);<NEW_LINE>return index;<NEW_LINE>} | c, entry.value, true); |
1,043,204 | protected void validate(FieldModel field, boolean prepend) throws SkipException {<NEW_LINE>if (field.isPartitionKey() || field.isClusteringColumn()) {<NEW_LINE>invalidMapping("Operation %s: directive %s is not supported for partition/clustering key field %s.", operationName, CqlDirectives.INCREMENT, field.getGraphqlName());<NEW_LINE>throw SkipException.INSTANCE;<NEW_LINE>}<NEW_LINE>Type<MASK><NEW_LINE>if (isCounter(fieldInputType)) {<NEW_LINE>if (prepend) {<NEW_LINE>failOnInvalidPrepend();<NEW_LINE>}<NEW_LINE>if (!argumentIsValidCounterIncrementType()) {<NEW_LINE>invalidMapping("Operation %s: expected argument %s to have a valid counter increment type (one of: %s)", operationName, argument.getName(), Joiner.on(", ").join(COUNTER_INCREMENT_TYPES));<NEW_LINE>throw SkipException.INSTANCE;<NEW_LINE>}<NEW_LINE>} else if (TypeUtil.isList(fieldInputType)) {<NEW_LINE>if (field.getCqlType().isSet() && prepend) {<NEW_LINE>failOnInvalidPrepend();<NEW_LINE>}<NEW_LINE>Type<?> argumentType = TypeHelper.unwrapNonNull(argument.getType());<NEW_LINE>if (!TypeHelper.deepEquals(argumentType, fieldInputType)) {<NEW_LINE>invalidMapping("Operation %s: expected argument %s to have type: %s to match %s.%s", operationName, argument.getName(), TypeHelper.format(fieldInputType), entity.getGraphqlName(), field.getGraphqlName());<NEW_LINE>throw SkipException.INSTANCE;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>invalidMapping("Operation %s: @%s can only be applied to counter or collection fields", operationName, CqlDirectives.INCREMENT);<NEW_LINE>throw SkipException.INSTANCE;<NEW_LINE>}<NEW_LINE>} | <?> fieldInputType = fieldInputType(); |
1,739,527 | public void mouseDown(MouseEvent e) {<NEW_LINE>try {<NEW_LINE>if (composite == null || composite.getMenu() != null || (cellMouseListeners != null && cellMouseListeners.size() > 0) || text == null || text.length() == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!(e.button == 3 || (e.button == 1 && e.stateMask == SWT.CONTROL))) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Menu menu = new Menu(composite.getShell(), SWT.POP_UP);<NEW_LINE>MenuItem item = new MenuItem(menu, SWT.NONE);<NEW_LINE>item.setText(MessageText.getString("ConfigView.copy.to.clipboard.tooltip"));<NEW_LINE>item.addSelectionListener(new SelectionAdapter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void widgetSelected(SelectionEvent arg0) {<NEW_LINE>if (!composite.isDisposed() && text != null && text.length() > 0) {<NEW_LINE>new Clipboard(composite.getDisplay()).setContents(new Object[] { text }, new Transfer[] <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>composite.setMenu(menu);<NEW_LINE>menu.addMenuListener(new MenuAdapter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void menuHidden(MenuEvent arg0) {<NEW_LINE>if (!composite.isDisposed()) {<NEW_LINE>composite.setMenu(null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>menu.setVisible(true);<NEW_LINE>} finally {<NEW_LINE>invokeMouseListeners(buildMouseEvent(e, TableCellMouseEvent.EVENT_MOUSEDOWN));<NEW_LINE>}<NEW_LINE>} | { TextTransfer.getInstance() }); |
1,461,448 | public void readEtchedBorder(org.w3c.dom.Node element) throws IOException {<NEW_LINE>if (!XML_ETCHED_BORDER.equals(element.getNodeName()))<NEW_LINE>// NOI18N<NEW_LINE>throw new IOException("Invalid format: missing \"" + XML_ETCHED_BORDER + "\" element.");<NEW_LINE>try {<NEW_LINE>org.w3c.dom.NamedNodeMap attributes = element.getAttributes();<NEW_LINE>org.w3c.dom.Node node;<NEW_LINE>borderSupport = new BorderDesignSupport(EtchedBorder.class);<NEW_LINE>borderSupport.setPropertyContext(propertyContext);<NEW_LINE>FormProperty prop;<NEW_LINE>node = attributes.getNamedItem(ATTR_ETCH_TYPE);<NEW_LINE>if (node != null && // NOI18N<NEW_LINE>(prop = (FormProperty) borderSupport.getPropertyOfName("etchType")) != null)<NEW_LINE>prop.setValue(new Integer<MASK><NEW_LINE>// NOI18N<NEW_LINE>readBorderProperty(ATTR_HIGHLIGHT, "highlightColor", borderSupport, element);<NEW_LINE>// NOI18N<NEW_LINE>readBorderProperty(ATTR_SHADOW, "shadowColor", borderSupport, element);<NEW_LINE>} catch (IOException ex) {<NEW_LINE>throw ex;<NEW_LINE>} catch (Exception ex) {<NEW_LINE>IOException ioex = new IOException();<NEW_LINE>ErrorManager.getDefault().annotate(ioex, ex);<NEW_LINE>throw ioex;<NEW_LINE>}<NEW_LINE>} | (node.getNodeValue())); |
868,865 | public void run(RegressionEnvironment env) {<NEW_LINE>String[] fields = "c0,c1,c2,c3,c4".split(",");<NEW_LINE>String eplCurrentTS = "@name('s0') select " + "longdate.between(longPrimitive, longBoxed) as c0, " + "utildate.between(longPrimitive, longBoxed) as c1, " + "caldate.between(longPrimitive, longBoxed) as c2," + "localdate.between(longPrimitive, longBoxed) as c3," + "zoneddate.between(longPrimitive, longBoxed) as c4 " + " from SupportDateTime unidirectional, SupportBean#lastevent";<NEW_LINE>env.compileDeploy(eplCurrentTS).addListener("s0");<NEW_LINE>SupportBean bean = new SupportBean();<NEW_LINE>bean.setLongPrimitive(10);<NEW_LINE>bean.setLongBoxed(20L);<NEW_LINE>env.sendEventBean(bean);<NEW_LINE>env.sendEventBean(SupportDateTime.make("2002-05-30T09:01:02.003"));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { false, false, false, false, false });<NEW_LINE>bean = new SupportBean();<NEW_LINE>bean.setLongPrimitive(0);<NEW_LINE>bean.setLongBoxed(Long.MAX_VALUE);<NEW_LINE>env.sendEventBean(bean);<NEW_LINE>env.sendEventBean<MASK><NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { true, true, true, true, true });<NEW_LINE>env.undeployAll();<NEW_LINE>} | (SupportDateTime.make("2002-05-30T09:01:02.003")); |
1,363,443 | private void initWizard(WizardDescriptor wizardDesc) {<NEW_LINE>// Init properties.<NEW_LINE>wizardDesc.putProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, Boolean.TRUE);<NEW_LINE>wizardDesc.putProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED, Boolean.TRUE);<NEW_LINE>wizardDesc.putProperty(WizardDescriptor.PROP_CONTENT_NUMBERED, Boolean.TRUE);<NEW_LINE>ArrayList contents = new ArrayList(3);<NEW_LINE>// NOI18N<NEW_LINE>contents.add<MASK><NEW_LINE>// NOI18N<NEW_LINE>contents.add(Util.getString("TXT_SelectTestResources"));<NEW_LINE>// NOI18N<NEW_LINE>contents.add(Util.getString("TXT_FoundMissingResources"));<NEW_LINE>wizardDesc.putProperty(WizardDescriptor.PROP_CONTENT_DATA, (String[]) contents.toArray(new String[contents.size()]));<NEW_LINE>// NOI18N<NEW_LINE>wizardDesc.setTitle(Util.getString("LBL_TestWizardTitle"));<NEW_LINE>// NOI18N<NEW_LINE>wizardDesc.setTitleFormat(new MessageFormat("{0} ({1})"));<NEW_LINE>wizardDesc.setModal(false);<NEW_LINE>} | (Util.getString("TXT_SelectTestSources")); |
1,482,575 | public Optional<SimpleLock> lock(@NonNull LockConfiguration lockConfiguration) {<NEW_LINE>String transactionId = null;<NEW_LINE>try {<NEW_LINE>StreamTransactionEntity streamTransactionEntity = arangoCollection.db().beginStreamTransaction(new StreamTransactionOptions().exclusiveCollections(arangoCollection.name()));<NEW_LINE>transactionId = streamTransactionEntity.getId();<NEW_LINE>BaseDocument existingDocument = arangoCollection.getDocument(lockConfiguration.getName(), BaseDocument.class, new DocumentReadOptions().streamTransactionId(transactionId));<NEW_LINE>// 1. case<NEW_LINE>if (existingDocument == null) {<NEW_LINE>BaseDocument newDocument = insertNewLock(transactionId, lockConfiguration.getName(), lockConfiguration.getLockAtMostUntil());<NEW_LINE>return Optional.of(new ArangoLock(arangoCollection, newDocument, lockConfiguration));<NEW_LINE>}<NEW_LINE>// 2. case<NEW_LINE>Instant lockUntil = Instant.parse(existingDocument.getAttribute<MASK><NEW_LINE>if (lockUntil.compareTo(ClockProvider.now()) <= 0) {<NEW_LINE>updateLockAtMostUntil(transactionId, existingDocument, lockConfiguration.getLockAtMostUntil());<NEW_LINE>return Optional.of(new ArangoLock(arangoCollection, existingDocument, lockConfiguration));<NEW_LINE>}<NEW_LINE>// 3. case<NEW_LINE>return Optional.empty();<NEW_LINE>} catch (ArangoDBException e) {<NEW_LINE>if (transactionId != null) {<NEW_LINE>arangoCollection.db().abortStreamTransaction(transactionId);<NEW_LINE>}<NEW_LINE>throw new LockException("Unexpected error occured", e);<NEW_LINE>} finally {<NEW_LINE>if (transactionId != null) {<NEW_LINE>arangoCollection.db().commitStreamTransaction(transactionId);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (LOCK_UNTIL).toString()); |
939,165 | public Files postFilesUploadSessionsIdCommit(String digest, String uploadSessionId, UploadSessionIdCommitBody body, String ifMatch, String ifNoneMatch) throws ApiException {<NEW_LINE>Object localVarPostBody = body;<NEW_LINE>// verify the required parameter 'digest' is set<NEW_LINE>if (digest == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'digest' when calling postFilesUploadSessionsIdCommit");<NEW_LINE>}<NEW_LINE>// verify the required parameter 'uploadSessionId' is set<NEW_LINE>if (uploadSessionId == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'uploadSessionId' when calling postFilesUploadSessionsIdCommit");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/files/upload_sessions/{upload_session_id}/commit".replaceAll("\\{" + "upload_session_id" + "\\}", apiClient.escapeString(uploadSessionId.toString()));<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new <MASK><NEW_LINE>if (digest != null)<NEW_LINE>localVarHeaderParams.put("digest", apiClient.parameterToString(digest));<NEW_LINE>if (ifMatch != null)<NEW_LINE>localVarHeaderParams.put("if-match", apiClient.parameterToString(ifMatch));<NEW_LINE>if (ifNoneMatch != null)<NEW_LINE>localVarHeaderParams.put("if-none-match", apiClient.parameterToString(ifNoneMatch));<NEW_LINE>final String[] localVarAccepts = { "application/json" };<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>final String[] localVarContentTypes = { "application/json" };<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] {};<NEW_LINE>GenericType<Files> localVarReturnType = new GenericType<Files>() {<NEW_LINE>};<NEW_LINE>return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);<NEW_LINE>} | HashMap<String, Object>(); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.