idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
989,081 | private void cleanupLSwitchPort(String logicalSwitchUuid, LogicalSwitchPort lSwitchPort, NiciraNvpApi niciraNvpApi) {<NEW_LINE>s_logger.warn("Deleting previously created Logical Switch Port " + lSwitchPort.getUuid() + " (" + lSwitchPort.getDisplayName() + ") from Logical Switch " + logicalSwitchUuid);<NEW_LINE>try {<NEW_LINE>niciraNvpApi.deleteLogicalSwitchPort(logicalSwitchUuid, lSwitchPort.getUuid());<NEW_LINE>} catch (NiciraNvpApiException exceptionDeleteLSwitchPort) {<NEW_LINE>s_logger.error("Error while deleting Logical Switch Port " + lSwitchPort.getUuid() + " (" + lSwitchPort.getDisplayName() + ") from Logical Switch " + logicalSwitchUuid + <MASK><NEW_LINE>}<NEW_LINE>s_logger.warn("Logical Switch Port " + lSwitchPort.getUuid() + " (" + lSwitchPort.getDisplayName() + ") successfully deleted");<NEW_LINE>} | " due to: " + exceptionDeleteLSwitchPort.getMessage()); |
44,878 | CloseableIterable<ManifestEntry<F>> entries() {<NEW_LINE>if ((rowFilter != null && rowFilter != Expressions.alwaysTrue()) || (partFilter != null && partFilter != Expressions.alwaysTrue()) || (partitionSet != null)) {<NEW_LINE>Evaluator evaluator = evaluator();<NEW_LINE>InclusiveMetricsEvaluator metricsEvaluator = metricsEvaluator();<NEW_LINE>// ensure stats columns are present for metrics evaluation<NEW_LINE>boolean requireStatsProjection = requireStatsProjection(rowFilter, columns);<NEW_LINE>Collection<String> projectColumns = <MASK><NEW_LINE>return CloseableIterable.filter(open(projection(fileSchema, fileProjection, projectColumns, caseSensitive)), entry -> entry != null && evaluator.eval(entry.file().partition()) && metricsEvaluator.eval(entry.file()) && inPartitionSet(entry.file()));<NEW_LINE>} else {<NEW_LINE>return open(projection(fileSchema, fileProjection, columns, caseSensitive));<NEW_LINE>}<NEW_LINE>} | requireStatsProjection ? withStatsColumns(columns) : columns; |
1,353,787 | public static void durableExecutorYamlGenerator(Map<String, Object> parent, Config config) {<NEW_LINE>if (config.getDurableExecutorConfigs().isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Map<String, Object> child = new LinkedHashMap<>();<NEW_LINE>for (DurableExecutorConfig subConfigAsObject : config.getDurableExecutorConfigs().values()) {<NEW_LINE>Map<String, Object> subConfigAsMap = new LinkedHashMap<>();<NEW_LINE>addNonNullToMap(subConfigAsMap, "pool-size", subConfigAsObject.getPoolSize());<NEW_LINE>addNonNullToMap(subConfigAsMap, "durability", subConfigAsObject.getDurability());<NEW_LINE>addNonNullToMap(subConfigAsMap, "capacity", subConfigAsObject.getCapacity());<NEW_LINE>addNonNullToMap(subConfigAsMap, "split-brain-protection-ref", subConfigAsObject.getSplitBrainProtectionName());<NEW_LINE>addNonNullToMap(subConfigAsMap, <MASK><NEW_LINE>child.put(subConfigAsObject.getName(), subConfigAsMap);<NEW_LINE>}<NEW_LINE>parent.put("durable-executor-service", child);<NEW_LINE>} | "statistics-enabled", subConfigAsObject.isStatisticsEnabled()); |
249,615 | private void checkMaterials() {<NEW_LINE>ItemStack[] totalMaterials = this.multiblock.getTotalMaterials();<NEW_LINE>if (totalMaterials != null) {<NEW_LINE>componentTooltip = new ArrayList<>();<NEW_LINE>componentTooltip.add(new TranslatableComponent("desc.immersiveengineering.info.reqMaterial"));<NEW_LINE>int maxOff = 1;<NEW_LINE>boolean hasAnyItems = false;<NEW_LINE>boolean[] hasItems = new boolean[totalMaterials.length];<NEW_LINE>for (int ss = 0; ss < totalMaterials.length; ss++) if (totalMaterials[ss] != null) {<NEW_LINE>ItemStack req = totalMaterials[ss];<NEW_LINE>int reqSize = req.getCount();<NEW_LINE>for (int slot = 0; slot < ManualUtils.mc().player.inventory.getContainerSize(); slot++) {<NEW_LINE>ItemStack inSlot = ManualUtils.mc().player.inventory.getItem(slot);<NEW_LINE>if (!inSlot.isEmpty() && ItemStack.isSame(inSlot, req))<NEW_LINE>if ((reqSize -= inSlot.getCount()) <= 0)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (reqSize <= 0) {<NEW_LINE>hasItems[ss] = true;<NEW_LINE>if (!hasAnyItems)<NEW_LINE>hasAnyItems = true;<NEW_LINE>}<NEW_LINE>maxOff = Math.max(maxOff, ("" + req.getCount()).length());<NEW_LINE>}<NEW_LINE>for (int ss = 0; ss < totalMaterials.length; ss++) if (totalMaterials[ss] != null) {<NEW_LINE>ItemStack req = totalMaterials[ss];<NEW_LINE>int indent = maxOff - ("" + req.getCount()).length();<NEW_LINE>StringBuilder sIndent = new StringBuilder();<NEW_LINE>if (indent > 0)<NEW_LINE>for (int ii = 0; ii < indent; ii++) sIndent.append("0");<NEW_LINE>MutableComponent s;<NEW_LINE>if (hasItems[ss])<NEW_LINE>s = greenTick.copy();<NEW_LINE>else<NEW_LINE>s = new TextComponent(hasAnyItems ? " " : "");<NEW_LINE>s.append(applyFormat(new TextComponent(sIndent.toString() + req.getCount() + "x "), ChatFormatting.GRAY));<NEW_LINE>if (!req.isEmpty())<NEW_LINE>s.append(applyFormat(req.getHoverName().copy(), req<MASK><NEW_LINE>else<NEW_LINE>s.append("???");<NEW_LINE>componentTooltip.add(s);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .getRarity().color)); |
1,226,649 | void populateAndNotifyAndroidEvent(@NonNull Event event, @Nullable OnErrorCallback onError) {<NEW_LINE>// Capture the state of the app and device and attach diagnostics to the event<NEW_LINE>event.setDevice(deviceDataCollector.generateDeviceWithState(new Date().getTime()));<NEW_LINE>event.addMetadata("device", deviceDataCollector.getDeviceMetadata());<NEW_LINE>// add additional info that belongs in metadata<NEW_LINE>// generate new object each time, as this can be mutated by end-users<NEW_LINE>event.setApp(appDataCollector.generateAppWithState());<NEW_LINE>event.addMetadata("app", appDataCollector.getAppDataMetadata());<NEW_LINE>// Attach breadcrumbState to the event<NEW_LINE>event.setBreadcrumbs(breadcrumbState.copy());<NEW_LINE>// Attach user info to the event<NEW_LINE>User user = userState.getUser();<NEW_LINE>event.setUser(user.getId(), user.getEmail(), user.getName());<NEW_LINE>// Attach context to the event<NEW_LINE>event.<MASK><NEW_LINE>notifyInternal(event, onError);<NEW_LINE>} | setContext(contextState.getContext()); |
785,433 | public DatabusRegistration register(Collection<DatabusCombinedConsumer> consumers, String... sources) throws DatabusClientException {<NEW_LINE>if ((null == consumers) || (consumers.isEmpty()))<NEW_LINE>throw new DatabusClientException("No consumer callbacks have been specified.");<NEW_LINE>if ((null == sources) || (sources.length == 0))<NEW_LINE>throw new DatabusClientException("Please specify Databus sources to be consumed: register(consumer, source1, source2, ...");<NEW_LINE>RegistrationId regId = RegistrationIdGenerator.generateNewId(consumers.iterator().next().getClass().getSimpleName(), DatabusSubscription.createSubscriptionList(Arrays.asList(sources)));<NEW_LINE>DatabusV2RegistrationImpl reg = new DatabusV2RegistrationImpl(<MASK><NEW_LINE>reg.addDatabusConsumers(consumers);<NEW_LINE>reg.addSubscriptions(sources);<NEW_LINE>_regList.add(reg);<NEW_LINE>reg.onRegister();<NEW_LINE>return reg;<NEW_LINE>} | regId, this, getCheckpointPersistenceProvider()); |
627,246 | private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(String deviceName, String storageAccountName, String resourceGroupName, 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 (deviceName == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>if (storageAccountName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter storageAccountName is required and cannot be null."));<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>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName 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.delete(this.client.getEndpoint(), deviceName, storageAccountName, this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), accept, context);<NEW_LINE>} | error(new IllegalArgumentException("Parameter deviceName is required and cannot be null.")); |
709,912 | private void parseStrategyRoute(Element element, StrategyReleaseEntity strategyReleaseEntity) {<NEW_LINE>List<StrategyRouteEntity> strategyRouteEntityList = strategyReleaseEntity.getStrategyRouteEntityList();<NEW_LINE>if (strategyRouteEntityList != null) {<NEW_LINE>throw new DiscoveryException("Allow only one element[" + XmlConfigConstant.ROUTES_ELEMENT_NAME + "] to be configed");<NEW_LINE>}<NEW_LINE>strategyRouteEntityList = new ArrayList<StrategyRouteEntity>();<NEW_LINE>strategyReleaseEntity.setStrategyRouteEntityList(strategyRouteEntityList);<NEW_LINE>for (Iterator<Element> elementIterator = element.elementIterator(); elementIterator.hasNext(); ) {<NEW_LINE>Element childElement = elementIterator.next();<NEW_LINE>if (StringUtils.equals(childElement.getName(), XmlConfigConstant.ROUTE_ELEMENT_NAME)) {<NEW_LINE>StrategyRouteEntity strategyRouteEntity = new StrategyRouteEntity();<NEW_LINE>Attribute idAttribute = childElement.attribute(XmlConfigConstant.ID_ATTRIBUTE_NAME);<NEW_LINE>if (idAttribute == null) {<NEW_LINE>throw new DiscoveryException("Attribute[" + XmlConfigConstant.ID_ATTRIBUTE_NAME + "] in element[" + <MASK><NEW_LINE>}<NEW_LINE>String id = idAttribute.getData().toString().trim();<NEW_LINE>strategyRouteEntity.setId(id);<NEW_LINE>Attribute typeAttribute = childElement.attribute(XmlConfigConstant.TYPE_ATTRIBUTE_NAME);<NEW_LINE>if (typeAttribute == null) {<NEW_LINE>throw new DiscoveryException("Attribute[" + XmlConfigConstant.TYPE_ATTRIBUTE_NAME + "] in element[" + childElement.getName() + "] is missing");<NEW_LINE>}<NEW_LINE>String type = typeAttribute.getData().toString().trim();<NEW_LINE>StrategyRouteType strategyRouteType = StrategyRouteType.fromString(type);<NEW_LINE>strategyRouteEntity.setType(strategyRouteType);<NEW_LINE>String value = childElement.getTextTrim();<NEW_LINE>strategyRouteEntity.setValue(value);<NEW_LINE>strategyRouteEntityList.add(strategyRouteEntity);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | childElement.getName() + "] is missing"); |
140,952 | public void addSendMetric(DispatchProfile currentRecord, String bid) {<NEW_LINE>Map<String, String> dimensions = new HashMap<>();<NEW_LINE>dimensions.put(DataProxyMetricItem.KEY_CLUSTER_ID, this.getClusterId());<NEW_LINE>// metric<NEW_LINE>fillInlongId(currentRecord, dimensions);<NEW_LINE>dimensions.put(DataProxyMetricItem.KEY_SINK_ID, this.getSinkName());<NEW_LINE>dimensions.put(DataProxyMetricItem.KEY_SINK_DATA_ID, bid);<NEW_LINE>long msgTime = currentRecord.getDispatchTime();<NEW_LINE>long auditFormatTime = msgTime - msgTime % CommonPropertiesHolder.getAuditFormatInterval();<NEW_LINE>dimensions.put(DataProxyMetricItem.KEY_MESSAGE_TIME, String.valueOf(auditFormatTime));<NEW_LINE>DataProxyMetricItem metricItem = this.getMetricItemSet().findMetricItem(dimensions);<NEW_LINE>long count = currentRecord.getCount();<NEW_LINE><MASK><NEW_LINE>metricItem.sendCount.addAndGet(count);<NEW_LINE>metricItem.sendSize.addAndGet(size);<NEW_LINE>} | long size = currentRecord.getSize(); |
277,777 | public Request<ListRetainedMessagesRequest> marshall(ListRetainedMessagesRequest listRetainedMessagesRequest) {<NEW_LINE>if (listRetainedMessagesRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(ListRetainedMessagesRequest)");<NEW_LINE>}<NEW_LINE>Request<ListRetainedMessagesRequest> request = new DefaultRequest<ListRetainedMessagesRequest>(listRetainedMessagesRequest, "AWSIotData");<NEW_LINE><MASK><NEW_LINE>String uriResourcePath = "/retainedMessage";<NEW_LINE>if (listRetainedMessagesRequest.getNextToken() != null) {<NEW_LINE>request.addParameter("nextToken", StringUtils.fromString(listRetainedMessagesRequest.getNextToken()));<NEW_LINE>}<NEW_LINE>if (listRetainedMessagesRequest.getMaxResults() != null) {<NEW_LINE>request.addParameter("maxResults", StringUtils.fromInteger(listRetainedMessagesRequest.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>} | request.setHttpMethod(HttpMethodName.GET); |
1,839,866 | private static final <T> RuleFactory<T> rulesOf(DynamoDBMapperConfig config, S3Link.Factory s3Links, DynamoDBMapperModelFactory models) {<NEW_LINE>final boolean ver1 = (config.getConversionSchema() == ConversionSchemas.V1);<NEW_LINE>final boolean ver2 = (config.getConversionSchema() == ConversionSchemas.V2);<NEW_LINE>final boolean v2Compatible = (config.getConversionSchema() == ConversionSchemas.V2_COMPATIBLE);<NEW_LINE>final DynamoDBTypeConverterFactory.Builder scalars = config.getTypeConverterFactory().override();<NEW_LINE>scalars.with(String.<MASK><NEW_LINE>final Rules<T> factory = new Rules<T>(scalars.build());<NEW_LINE>factory.add(factory.new NativeType(!ver1));<NEW_LINE>factory.add(factory.new V2CompatibleBool(v2Compatible));<NEW_LINE>factory.add(factory.new NativeBool(ver2));<NEW_LINE>factory.add(factory.new StringScalar(true));<NEW_LINE>factory.add(factory.new DateToEpochRule(true));<NEW_LINE>factory.add(factory.new NumberScalar(true));<NEW_LINE>factory.add(factory.new BinaryScalar(true));<NEW_LINE>factory.add(factory.new NativeBoolSet(ver2));<NEW_LINE>factory.add(factory.new StringScalarSet(true));<NEW_LINE>factory.add(factory.new NumberScalarSet(true));<NEW_LINE>factory.add(factory.new BinaryScalarSet(true));<NEW_LINE>factory.add(factory.new ObjectSet(ver2));<NEW_LINE>factory.add(factory.new ObjectStringSet(!ver2));<NEW_LINE>factory.add(factory.new ObjectList(!ver1));<NEW_LINE>factory.add(factory.new ObjectMap(!ver1));<NEW_LINE>factory.add(factory.new ObjectDocumentMap(!ver1, models, config));<NEW_LINE>return factory;<NEW_LINE>} | class, S3Link.class, s3Links); |
740,258 | private Mono<Response<Flux<ByteBuffer>>> startWithResponseAsync(String resourceGroupName, String virtualMachineName, Context context) {<NEW_LINE>if (this.client.getEndpoint() == 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>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getReferer() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getReferer() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (virtualMachineName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter virtualMachineName 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.start(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, this.client.getReferer(), virtualMachineName, this.client.getApiVersion(), accept, context);<NEW_LINE>} | error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); |
235,310 | final DeleteFieldLevelEncryptionConfigResult executeDeleteFieldLevelEncryptionConfig(DeleteFieldLevelEncryptionConfigRequest deleteFieldLevelEncryptionConfigRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteFieldLevelEncryptionConfigRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteFieldLevelEncryptionConfigRequest> request = null;<NEW_LINE>Response<DeleteFieldLevelEncryptionConfigResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new DeleteFieldLevelEncryptionConfigRequestMarshaller().marshall(super.beforeMarshalling(deleteFieldLevelEncryptionConfigRequest));<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, "CloudFront");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteFieldLevelEncryptionConfig");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DeleteFieldLevelEncryptionConfigResult> responseHandler = new StaxResponseHandler<DeleteFieldLevelEncryptionConfigResult>(new DeleteFieldLevelEncryptionConfigResultStaxUnmarshaller());<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); |
1,081,796 | protected void paintIcon(Graphics2D g2) {<NEW_LINE>// see HexDigit.getSegs()<NEW_LINE>final var segson = HexDigit.getSegs(isHexDisplay ? 10 : 7);<NEW_LINE>g2.setStroke(new BasicStroke(scale(2)));<NEW_LINE>g2.setColor(Color.WHITE);<NEW_LINE>g2.fillRect(scale(2), 0, scale(10), scale(16));<NEW_LINE>g2.setColor(Color.BLACK);<NEW_LINE>g2.drawRect(scale(2), 0, scale(10), scale(16));<NEW_LINE>g2.setColor((segson & HexDigit.SEG_A_MASK) != 0 ? Color.RED : Color.LIGHT_GRAY);<NEW_LINE>g2.drawLine(scale(5), scale(3), scale(8), scale(3));<NEW_LINE>g2.setColor((segson & HexDigit.SEG_B_MASK) != 0 ? Color.RED : Color.LIGHT_GRAY);<NEW_LINE>g2.drawLine(scale(9), scale(4), scale(9), scale(7));<NEW_LINE>g2.setColor((segson & HexDigit.SEG_C_MASK) != 0 ? <MASK><NEW_LINE>g2.drawLine(scale(9), scale(9), scale(9), scale(12));<NEW_LINE>g2.setColor((segson & HexDigit.SEG_D_MASK) != 0 ? Color.RED : Color.LIGHT_GRAY);<NEW_LINE>g2.drawLine(scale(5), scale(13), scale(8), scale(13));<NEW_LINE>g2.setColor((segson & HexDigit.SEG_F_MASK) != 0 ? Color.RED : Color.LIGHT_GRAY);<NEW_LINE>g2.drawLine(scale(4), scale(4), scale(4), scale(7));<NEW_LINE>g2.setColor((segson & HexDigit.SEG_E_MASK) != 0 ? Color.RED : Color.LIGHT_GRAY);<NEW_LINE>g2.drawLine(scale(4), scale(9), scale(4), scale(12));<NEW_LINE>g2.setColor((segson & HexDigit.SEG_G_MASK) != 0 ? Color.RED : Color.LIGHT_GRAY);<NEW_LINE>g2.drawLine(scale(5), scale(8), scale(8), scale(8));<NEW_LINE>} | Color.RED : Color.LIGHT_GRAY); |
211,772 | static TlsAuthentication receiveServerCertificate(TlsClientContext clientContext, TlsClient client, ByteArrayInputStream buf) throws IOException {<NEW_LINE>SecurityParameters securityParameters = clientContext.getSecurityParametersHandshake();<NEW_LINE>if (null != securityParameters.getPeerCertificate()) {<NEW_LINE>throw new TlsFatalAlert(AlertDescription.unexpected_message);<NEW_LINE>}<NEW_LINE>ByteArrayOutputStream endPointHash = new ByteArrayOutputStream();<NEW_LINE>Certificate.ParseOptions options = new Certificate.ParseOptions().setMaxChainLength(client.getMaxCertificateChainLength());<NEW_LINE>Certificate serverCertificate = Certificate.parse(options, clientContext, buf, endPointHash);<NEW_LINE>TlsProtocol.assertEmpty(buf);<NEW_LINE>if (serverCertificate.isEmpty()) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (securityParameters.isRenegotiating() && !isSafeRenegotiationServerCertificate(clientContext, serverCertificate)) {<NEW_LINE>throw new TlsFatalAlert(AlertDescription.certificate_unknown, "Server certificate changed unsafely in renegotiation handshake");<NEW_LINE>}<NEW_LINE>securityParameters.peerCertificate = serverCertificate;<NEW_LINE>securityParameters.tlsServerEndPoint = endPointHash.toByteArray();<NEW_LINE>TlsAuthentication authentication = client.getAuthentication();<NEW_LINE>if (null == authentication) {<NEW_LINE>throw new TlsFatalAlert(AlertDescription.internal_error);<NEW_LINE>}<NEW_LINE>return authentication;<NEW_LINE>} | throw new TlsFatalAlert(AlertDescription.decode_error); |
415,050 | // Inside the mCaptureThread<NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>if (mSettings.root_capture) {<NEW_LINE>runPacketLoop(-1, this, Build.VERSION.SDK_INT);<NEW_LINE>} else {<NEW_LINE>if (mParcelFileDescriptor != null) {<NEW_LINE>int fd = mParcelFileDescriptor.getFd();<NEW_LINE>int fd_setsize = getFdSetSize();<NEW_LINE>if ((fd > 0) && (fd < fd_setsize)) {<NEW_LINE>Log.d(TAG, "VPN fd: " + fd + " - FD_SETSIZE: " + fd_setsize);<NEW_LINE>runPacketLoop(fd, this, Build.VERSION.SDK_INT);<NEW_LINE>} else<NEW_LINE>Log.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>// After the capture is stopped<NEW_LINE>if (mMalwareDetectionEnabled)<NEW_LINE>mBlacklists.save();<NEW_LINE>// Important: the fd must be closed to properly terminate the VPN<NEW_LINE>if (mParcelFileDescriptor != null) {<NEW_LINE>try {<NEW_LINE>mParcelFileDescriptor.close();<NEW_LINE>} catch (IOException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>mParcelFileDescriptor = null;<NEW_LINE>}<NEW_LINE>// NOTE: join the threads here instead in onDestroy to avoid ANR<NEW_LINE>stopAndJoinThreads();<NEW_LINE>stopService();<NEW_LINE>// Notify<NEW_LINE>mHandler.post(() -> {<NEW_LINE>sendServiceStatus(SERVICE_STATUS_STOPPED);<NEW_LINE>CaptureCtrl.notifyCaptureStopped(this);<NEW_LINE>});<NEW_LINE>mCaptureThread = null;<NEW_LINE>} | e(TAG, "Invalid VPN fd: " + fd); |
1,181,160 | protected void prepare() {<NEW_LINE>try (final IAutoCloseable cacheFlagRestorer = CacheInterceptor.temporaryDisableCaching()) {<NEW_LINE>final ClientSetup clientSetup = getClientSetup();<NEW_LINE>for (final ProcessInfoParameter para : getParametersAsArray()) {<NEW_LINE>if (para.getParameter() == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>final String name = para.getParameterName();<NEW_LINE>if (PARAM_CompanyName.equalsIgnoreCase(name)) {<NEW_LINE>clientSetup.setCompanyName(para.getParameterAsString());<NEW_LINE>} else if (PARAM_VATaxID.equalsIgnoreCase(name)) {<NEW_LINE>clientSetup.setCompanyTaxID(para.getParameterAsString());<NEW_LINE>} else if (PARAM_C_Location_ID.equalsIgnoreCase(name)) {<NEW_LINE>clientSetup.setCompanyAddressByLocationId(para.getParameterAsInt());<NEW_LINE>} else if (PARAM_Logo_ID.equalsIgnoreCase(name)) {<NEW_LINE>clientSetup.setCompanyLogoByImageId(para.getParameterAsInt());<NEW_LINE>} else if (PARAM_AD_Language.equalsIgnoreCase(name)) {<NEW_LINE>clientSetup.setAD_Language(para.getParameterAsString());<NEW_LINE>} else if (PARAM_C_Currency_ID.equalsIgnoreCase(name)) {<NEW_LINE>clientSetup.setCurrencyId(para.getParameterAsRepoId(CurrencyId::ofRepoIdOrNull));<NEW_LINE>} else //<NEW_LINE>//<NEW_LINE>if (PARAM_FirstName.equalsIgnoreCase(name)) {<NEW_LINE>clientSetup.setContactFirstName(para.getParameterAsString());<NEW_LINE>} else if (PARAM_LastName.equalsIgnoreCase(name)) {<NEW_LINE>clientSetup.setContactLastName(para.getParameterAsString());<NEW_LINE>} else //<NEW_LINE>//<NEW_LINE>if (PARAM_AccountNo.equalsIgnoreCase(name)) {<NEW_LINE>clientSetup.setAccountNo(para.getParameterAsString());<NEW_LINE>} else if (PARAM_IBAN.equalsIgnoreCase(name)) {<NEW_LINE>clientSetup.setIBAN(para.getParameterAsString());<NEW_LINE>} else if (PARAM_C_Bank_ID.equalsIgnoreCase(name)) {<NEW_LINE>clientSetup.setC_Bank_ID(para.getParameterAsInt());<NEW_LINE>} else //<NEW_LINE>//<NEW_LINE>if (PARAM_Phone.equalsIgnoreCase(name)) {<NEW_LINE>clientSetup.setPhone(para.getParameterAsString());<NEW_LINE>} else if (PARAM_Fax.equalsIgnoreCase(name)) {<NEW_LINE>clientSetup.setFax(para.getParameterAsString());<NEW_LINE>} else if (PARAM_EMail.equalsIgnoreCase(name)) {<NEW_LINE>clientSetup.<MASK><NEW_LINE>} else //<NEW_LINE>//<NEW_LINE>if (PARAM_Description.equalsIgnoreCase(name)) {<NEW_LINE>clientSetup.setBPartnerDescription(para.getParameterAsString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | setEMail(para.getParameterAsString()); |
1,209,142 | private static void createTransform(CssContext c, Box box, PageBox page, AffineTransform result, TransformYOrigin transformYOrigin, int shadowPageNumber) {<NEW_LINE>FSDerivedValue transforms = box.getStyle().valueByName(CSSName.TRANSFORM);<NEW_LINE>float relOriginX = box.getStyle().getFloatPropertyProportionalWidth(CSSName.FS_TRANSFORM_ORIGIN_X, box.getWidth(), c);<NEW_LINE>float relOriginY = box.getStyle().getFloatPropertyProportionalHeight(CSSName.FS_TRANSFORM_ORIGIN_Y, box.getHeight(), c);<NEW_LINE>float flipFactor = transformYOrigin == <MASK><NEW_LINE>float absTranslateX = relOriginX + box.getAbsX();<NEW_LINE>float absTranslateY = relOriginY + box.getAbsY();<NEW_LINE>AffineTransform translateToOrigin;<NEW_LINE>AffineTransform translateBackFromOrigin;<NEW_LINE>if (transformYOrigin == TransformYOrigin.PAGE_BOTTOM || transformYOrigin == TransformYOrigin.PAGE_TOP) {<NEW_LINE>float pageTranslateX;<NEW_LINE>float pageTranslateY;<NEW_LINE>if (transformYOrigin == TransformYOrigin.PAGE_BOTTOM) {<NEW_LINE>// The transform point is the lower left of the page (PDF coordinate system).<NEW_LINE>pageTranslateX = getPageTranslateX(absTranslateX, shadowPageNumber, page, c, box);<NEW_LINE>float topDownPageTranslateY = (absTranslateY + page.getMarginBorderPadding(c, CalculatedStyle.TOP)) - page.getPaintingTop();<NEW_LINE>pageTranslateY = (page.getHeight(c) - topDownPageTranslateY);<NEW_LINE>} else {<NEW_LINE>// PAGE_TOP<NEW_LINE>// The transform point is the upper left of the page.<NEW_LINE>pageTranslateX = getPageTranslateX(absTranslateX, shadowPageNumber, page, c, box);<NEW_LINE>pageTranslateY = (absTranslateY - page.getPaintingTop()) + page.getMarginBorderPadding(c, CalculatedStyle.TOP);<NEW_LINE>}<NEW_LINE>translateToOrigin = AffineTransform.getTranslateInstance(pageTranslateX, pageTranslateY);<NEW_LINE>translateBackFromOrigin = AffineTransform.getTranslateInstance(-pageTranslateX, -pageTranslateY);<NEW_LINE>} else {<NEW_LINE>// DOCUMENT_TOP<NEW_LINE>translateToOrigin = AffineTransform.getTranslateInstance(absTranslateX, absTranslateY);<NEW_LINE>translateBackFromOrigin = AffineTransform.getTranslateInstance(-absTranslateX, -absTranslateY);<NEW_LINE>}<NEW_LINE>List<PropertyValue> transformList = ((ListValue) transforms).getValues();<NEW_LINE>result.concatenate(translateToOrigin);<NEW_LINE>applyTransformFunctions(flipFactor, transformList, result, box, c);<NEW_LINE>result.concatenate(translateBackFromOrigin);<NEW_LINE>} | TransformYOrigin.PAGE_BOTTOM ? -1 : 1; |
875,222 | protected void performDefaults() {<NEW_LINE>fBackupOnSaveButton.setSelection(getPreferenceStore<MASK><NEW_LINE>fOpenDiagramsOnLoadButton.setSelection(getPreferenceStore().getDefaultBoolean(OPEN_DIAGRAMS_ON_LOAD));<NEW_LINE>fMRUSizeSpinner.setSelection(getPreferenceStore().getDefaultInt(MRU_MAX));<NEW_LINE>fShowUnusedElementsInModelTreeButton.setSelection(getPreferenceStore().getDefaultBoolean(HIGHLIGHT_UNUSED_ELEMENTS_IN_MODEL_TREE));<NEW_LINE>fAutoSearchButton.setSelection(getPreferenceStore().getDefaultBoolean(TREE_SEARCH_AUTO));<NEW_LINE>fWarnOnDeleteButton.setSelection(getPreferenceStore().getDefaultBoolean(SHOW_WARNING_ON_DELETE_FROM_TREE));<NEW_LINE>fUseLabelExpressionsButton.setSelection(getPreferenceStore().getDefaultBoolean(USE_LABEL_EXPRESSIONS_IN_ANALYSIS_TABLE));<NEW_LINE>fScaleImagesButton.setSelection(getPreferenceStore().getDefaultBoolean(SCALE_IMAGE_EXPORT));<NEW_LINE>if (fUseEdgeBrowserButton != null) {<NEW_LINE>fUseEdgeBrowserButton.setSelection(getPreferenceStore().getDefaultBoolean(EDGE_BROWSER));<NEW_LINE>}<NEW_LINE>fEnableJSHintsButton.setSelection(getPreferenceStore().getDefaultBoolean(HINTS_BROWSER_JS_ENABLED));<NEW_LINE>fEnableExternalHostsHintsButton.setSelection(getPreferenceStore().getDefaultBoolean(HINTS_BROWSER_EXTERNAL_HOSTS_ENABLED));<NEW_LINE>if (AnimationUtil.supportsAnimation()) {<NEW_LINE>fDoAnimationViewButton.setSelection(getPreferenceStore().getDefaultBoolean(ANIMATE_VIEW));<NEW_LINE>fAnimationViewTimeSpinner.setSelection(getPreferenceStore().getDefaultInt(ANIMATION_VIEW_TIME));<NEW_LINE>fAnimateVisualiserNodesButton.setSelection(getPreferenceStore().getDefaultBoolean(ANIMATE_VISUALISER_NODES));<NEW_LINE>fAnimationVisualiserTimeSpinner.setSelection(getPreferenceStore().getDefaultInt(ANIMATE_VISUALISER_TIME));<NEW_LINE>}<NEW_LINE>super.performDefaults();<NEW_LINE>} | ().getDefaultBoolean(BACKUP_ON_SAVE)); |
591,135 | public SkeletalIndependentRegressionModel train(Dataset<Regressor> examples, Map<String, Provenance> runProvenance, int invocationCount) {<NEW_LINE>if (examples.getOutputInfo().getUnknownCount() > 0) {<NEW_LINE>throw new IllegalArgumentException("The supplied Dataset contained unknown Outputs, and this Trainer is supervised.");<NEW_LINE>}<NEW_LINE>SplittableRandom localRNG;<NEW_LINE>TrainerProvenance trainerProvenance;<NEW_LINE>synchronized (this) {<NEW_LINE>if (invocationCount != INCREMENT_INVOCATION_COUNT) {<NEW_LINE>setInvocationCount(invocationCount);<NEW_LINE>}<NEW_LINE>localRNG = rng.split();<NEW_LINE>trainerProvenance = getProvenance();<NEW_LINE>trainInvocationCounter++;<NEW_LINE>}<NEW_LINE>ImmutableOutputInfo<Regressor> outputInfo = examples.getOutputIDInfo();<NEW_LINE>ImmutableFeatureMap featureMap = examples.getFeatureIDMap();<NEW_LINE>Set<Regressor<MASK><NEW_LINE>LinkedHashMap<String, T> models = new LinkedHashMap<>();<NEW_LINE>int numExamples = examples.size();<NEW_LINE>boolean needBias = useBias();<NEW_LINE>float[] weights = new float[numExamples];<NEW_LINE>double[][] outputs = new double[outputInfo.size()][numExamples];<NEW_LINE>SparseVector[] inputs = new SparseVector[numExamples];<NEW_LINE>int i = 0;<NEW_LINE>for (Example<Regressor> e : examples) {<NEW_LINE>inputs[i] = SparseVector.createSparseVector(e, featureMap, needBias);<NEW_LINE>weights[i] = e.getWeight();<NEW_LINE>for (Regressor.DimensionTuple r : e.getOutput()) {<NEW_LINE>int id = outputInfo.getID(r);<NEW_LINE>outputs[id][i] = r.getValue();<NEW_LINE>}<NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>for (Regressor r : domain) {<NEW_LINE>int id = outputInfo.getID(r);<NEW_LINE>T innerModel = trainDimension(outputs[id], inputs, weights, localRNG);<NEW_LINE>models.put(r.getNames()[0], innerModel);<NEW_LINE>}<NEW_LINE>ModelProvenance provenance = new ModelProvenance(getModelClassName(), OffsetDateTime.now(), examples.getProvenance(), trainerProvenance, runProvenance);<NEW_LINE>return createModel(models, provenance, featureMap, outputInfo);<NEW_LINE>} | > domain = outputInfo.getDomain(); |
629,573 | public ContainerDistributionConfiguration unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ContainerDistributionConfiguration containerDistributionConfiguration = new ContainerDistributionConfiguration();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("description", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>containerDistributionConfiguration.setDescription(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("containerTags", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>containerDistributionConfiguration.setContainerTags(new ListUnmarshaller<String>(context.getUnmarshaller(String.class)).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("targetRepository", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>containerDistributionConfiguration.setTargetRepository(TargetContainerRepositoryJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return containerDistributionConfiguration;<NEW_LINE>} | class).unmarshall(context)); |
1,787,814 | private void processAttributes(Builder builder, Set<ClassMember> publicProperties) {<NEW_LINE>if (publicProperties == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>for (ClassMember classMember : publicProperties) {<NEW_LINE>if (classMember instanceof ClassProperty) {<NEW_LINE>ClassProperty property = (ClassProperty) classMember;<NEW_LINE><MASK><NEW_LINE>AttributeDefImpl.Builder attrBuilder = new AttributeDefImpl.Builder();<NEW_LINE>DefDescriptor<AttributeDef> attributeDefDesc = new DefDescriptorImpl<>(null, null, attributeName, AttributeDef.class);<NEW_LINE>attrBuilder.setDescriptor(attributeDefDesc);<NEW_LINE>attrBuilder.setAccess(new DefinitionAccessImpl(Access.GLOBAL));<NEW_LINE>if (property.getDocumentation() != null) {<NEW_LINE>attrBuilder.setRequired(property.getDocumentation().isRequired());<NEW_LINE>}<NEW_LINE>// Use the ClassPropertyValue to set the default value.<NEW_LINE>// Decided we shouldn't use the @default from the documentation as thats doc, not metadata.<NEW_LINE>// Commented because it needs tests still.<NEW_LINE>// if (property.getValue() != null) {<NEW_LINE>// final AttributeDefRefImpl.Builder defRefBuilder = new AttributeDefRefImpl.Builder();<NEW_LINE>// defRefBuilder.setValue(ClassPropertyValue.getValue(property.getValue().value));<NEW_LINE>// defRefBuilder.setAccess(new DefinitionAccessImpl(Access.GLOBAL));<NEW_LINE>// attrBuilder.setDefaultValue(defRefBuilder.build());<NEW_LINE>// }<NEW_LINE>Optional<String> description = property.getDescription();<NEW_LINE>if (description.isPresent()) {<NEW_LINE>attrBuilder.setDescription(description.get());<NEW_LINE>}<NEW_LINE>builder.addAttributeDef(attributeDefDesc, attrBuilder.build());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | String attributeName = property.getName(); |
860,533 | public void write(JsonWriter writer, @Nullable T value) {<NEW_LINE>if (value == null)<NEW_LINE>writer.writeNull();<NEW_LINE>else if (value.isEmpty())<NEW_LINE>writer.writeAscii(EMPTY);<NEW_LINE>else if (keyEncoder != null && valueEncoder != null) {<NEW_LINE>boolean pastFirst = false;<NEW_LINE>writer.writeByte(JsonWriter.OBJECT_START);<NEW_LINE>for (final Map.Entry<K, V> e : value.entrySet()) {<NEW_LINE>if (pastFirst) {<NEW_LINE>writer.writeByte(JsonWriter.COMMA);<NEW_LINE>} else {<NEW_LINE>pastFirst = true;<NEW_LINE>}<NEW_LINE>if (checkForConversionToString) {<NEW_LINE>writer.writeQuoted(keyEncoder, e.getKey());<NEW_LINE>} else<NEW_LINE>keyEncoder.write(writer, e.getKey());<NEW_LINE>writer.writeByte(JsonWriter.SEMI);<NEW_LINE>valueEncoder.write(writer, e.getValue());<NEW_LINE>}<NEW_LINE>writer.writeByte(JsonWriter.OBJECT_END);<NEW_LINE>} else {<NEW_LINE>boolean pastFirst = false;<NEW_LINE>writer.writeByte(JsonWriter.OBJECT_START);<NEW_LINE>Class<?> lastKeyClass = null;<NEW_LINE>Class<?> lastValueClass = null;<NEW_LINE>JsonWriter.WriteObject lastKeyEncoder = keyEncoder;<NEW_LINE>JsonWriter.WriteObject lastValueEncoder = null;<NEW_LINE>for (final Map.Entry<K, V> e : value.entrySet()) {<NEW_LINE>if (pastFirst) {<NEW_LINE>writer.writeByte(JsonWriter.COMMA);<NEW_LINE>} else {<NEW_LINE>pastFirst = true;<NEW_LINE>}<NEW_LINE>final Class<?> currentKeyClass = e.getKey().getClass();<NEW_LINE>if (lastKeyEncoder == null || currentKeyClass != lastKeyClass) {<NEW_LINE>lastKeyClass = currentKeyClass;<NEW_LINE>lastKeyEncoder = json.tryFindWriter(lastKeyClass);<NEW_LINE>if (lastKeyEncoder == null) {<NEW_LINE>throw new ConfigurationException("Unable to find writer for " + lastKeyClass);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>writer.writeQuoted(lastKeyEncoder, e.getKey());<NEW_LINE>writer.writeByte(JsonWriter.SEMI);<NEW_LINE>if (valueEncoder != null) {<NEW_LINE>valueEncoder.write(<MASK><NEW_LINE>} else {<NEW_LINE>if (e.getValue() == null) {<NEW_LINE>writer.writeNull();<NEW_LINE>} else {<NEW_LINE>final Class<?> currentValueClass = e.getValue().getClass();<NEW_LINE>if (currentValueClass != lastValueClass) {<NEW_LINE>lastValueClass = currentValueClass;<NEW_LINE>lastValueEncoder = json.tryFindWriter(lastValueClass);<NEW_LINE>if (lastValueEncoder == null)<NEW_LINE>throw new ConfigurationException("Unable to find writer for " + lastValueClass);<NEW_LINE>}<NEW_LINE>lastValueEncoder.write(writer, e.getValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>writer.writeByte(JsonWriter.OBJECT_END);<NEW_LINE>}<NEW_LINE>} | writer, e.getValue()); |
1,834,860 | public Type visitPi(PiExpression expr, Void params) {<NEW_LINE>if (expr.getResultSort().isProp())<NEW_LINE>return expr;<NEW_LINE>Type dom = visit(expr.<MASK><NEW_LINE>if (dom == null)<NEW_LINE>return null;<NEW_LINE>Type cod = visit(expr.getCodomain());<NEW_LINE>if (cod == null)<NEW_LINE>return null;<NEW_LINE>Sort sort = new Sort(dom.getSortOfType().getPLevel().max(cod.getSortOfType().getPLevel()), cod.getSortOfType().getHLevel());<NEW_LINE>if (sort.equals(expr.getResultSort()) || !sort.isLessOrEquals(expr.getResultSort())) {<NEW_LINE>return expr;<NEW_LINE>}<NEW_LINE>ExprSubstitution substitution = new ExprSubstitution();<NEW_LINE>LinkList list = new LinkList();<NEW_LINE>for (SingleDependentLink param = expr.getParameters(); param.hasNext(); param = param.getNext()) {<NEW_LINE>SingleDependentLink newParam = param instanceof TypedSingleDependentLink ? new TypedSingleDependentLink(param.isExplicit(), param.getName(), dom, param.isHidden()) : new UntypedSingleDependentLink(param.getName());<NEW_LINE>list.append(newParam);<NEW_LINE>substitution.add(param, new ReferenceExpression(newParam));<NEW_LINE>}<NEW_LINE>return new PiExpression(sort, (SingleDependentLink) list.getFirst(), cod.getExpr().subst(substitution));<NEW_LINE>} | getParameters().getTypeExpr()); |
1,077,602 | public Map doAnalysis(Map<String, String> header, String log) {<NEW_LINE>List<String> logfields = Lists.newArrayList(separator.split(log));<NEW_LINE>Map<String, String<MASK><NEW_LINE>int i = 0;<NEW_LINE>// collection specified fields<NEW_LINE>for (int point : SpecifiedFields) {<NEW_LINE>// add irregular process<NEW_LINE>if (logfields.size() >= point)<NEW_LINE>resultMap.put(fieldsName[i++], logfields.get(point - 1));<NEW_LINE>}<NEW_LINE>// add line number<NEW_LINE>resultMap.put("_lnum", header.get(TaildirSourceConfigurationConstants.READ_LINE_NUMBER));<NEW_LINE>// add timestamp<NEW_LINE>if (timeStampField == TIMESTAMP_NEED) {<NEW_LINE>resultMap.put("_timestamp", header.get(TaildirSourceConfigurationConstants.READ_TIMESTAMP));<NEW_LINE>} else if (timeStampField > TIMESTAMP_NEED) {<NEW_LINE>resultMap.put("_timestamp", logfields.get(timeStampField - 1));<NEW_LINE>}<NEW_LINE>this.getMainlogs().add(resultMap);<NEW_LINE>return resultMap;<NEW_LINE>} | > resultMap = Maps.newHashMap(); |
751,632 | public static ArrayList<Node> Astar(Node snakeHead, Node food) {<NEW_LINE>ArrayList<Node> open = new ArrayList<>();<NEW_LINE>HashSet<Node> close = new HashSet<>();<NEW_LINE>ArrayList<Node> result = new ArrayList<>();<NEW_LINE>setParentNull();<NEW_LINE>open.add(board[snakeHead.getX()][snakeHead.getY()]);<NEW_LINE>while (!open.isEmpty()) {<NEW_LINE>var <MASK><NEW_LINE>close.add(current);<NEW_LINE>open.remove(current);<NEW_LINE>f.repaint();<NEW_LINE>if (equal(current, food)) {<NEW_LINE>getPath(result, current);<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>ArrayList<Node> Children = getChildren(current);<NEW_LINE>for (var child : Children) {<NEW_LINE>if (close.contains(child))<NEW_LINE>continue;<NEW_LINE>child.setG(current.getG() + 1);<NEW_LINE>child.setH(getDis(child));<NEW_LINE>double tempF = child.getG() + child.getH();<NEW_LINE>if (open.contains(child) && child.getF() > tempF) {<NEW_LINE>child.setF(tempF);<NEW_LINE>child.setParent(current);<NEW_LINE>} else if (!open.contains(child)) {<NEW_LINE>child.setF(tempF);<NEW_LINE>open.add(child);<NEW_LINE>child.setParent(current);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>open.sort(Comparator.comparingDouble(Node::getF));<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | current = open.get(0); |
986,957 | public ResourceChangeDetail unmarshall(StaxUnmarshallerContext context) throws Exception {<NEW_LINE>ResourceChangeDetail resourceChangeDetail = new ResourceChangeDetail();<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 resourceChangeDetail;<NEW_LINE>if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {<NEW_LINE>if (context.testExpression("Target", targetDepth)) {<NEW_LINE>resourceChangeDetail.setTarget(ResourceTargetDefinitionStaxUnmarshaller.getInstance<MASK><NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("Evaluation", targetDepth)) {<NEW_LINE>resourceChangeDetail.setEvaluation(StringStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("ChangeSource", targetDepth)) {<NEW_LINE>resourceChangeDetail.setChangeSource(StringStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("CausingEntity", targetDepth)) {<NEW_LINE>resourceChangeDetail.setCausingEntity(StringStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>} else if (xmlEvent.isEndElement()) {<NEW_LINE>if (context.getCurrentDepth() < originalDepth) {<NEW_LINE>return resourceChangeDetail;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ().unmarshall(context)); |
1,548,211 | public ModelResponse<String> invoke(ModelRequest request) {<NEW_LINE>ModelResponse<String> response = new ModelResponse<String>();<NEW_LINE>Transaction t = newTransaction("ModelService", getClass().getSimpleName());<NEW_LINE>try {<NEW_LINE>URL url = buildUrl(request);<NEW_LINE>t.addData(url.toString());<NEW_LINE>InputStream in = Urls.forIO().connectTimeout(1000).readTimeout(5000).openStream(url.toExternalForm());<NEW_LINE>GZIPInputStream gzip = new GZIPInputStream(in);<NEW_LINE>String xml = Files.forIO().readFrom(gzip, "utf-8");<NEW_LINE>int len = xml == null ? 0 : xml.length();<NEW_LINE>t.addData("length", len);<NEW_LINE>if (len > 0) {<NEW_LINE>String report = buildModel(xml);<NEW_LINE>response.setModel(report);<NEW_LINE>t.addData("hit", "true");<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>t.setStatus(Message.SUCCESS);<NEW_LINE>} finally {<NEW_LINE>t.complete();<NEW_LINE>}<NEW_LINE>return response;<NEW_LINE>} | t.setStatus(Message.SUCCESS); |
824,860 | protected void notifyTransportErrors(final Event event) {<NEW_LINE>final Transport transport = event.getTransport();<NEW_LINE>final Connection connection = event.getConnection();<NEW_LINE>if (connection == null || transport == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final ErrorCondition errorCondition = transport.getCondition();<NEW_LINE>final String hostName = event.getReactor().getConnectionAddress(connection);<NEW_LINE>final <MASK><NEW_LINE>final boolean isProxyConfigured = proxySelector != null || (proxyConfiguration != null && proxyConfiguration.isProxyAddressConfigured());<NEW_LINE>if (errorCondition == null || !(errorCondition.getCondition().equals(ConnectionError.FRAMING_ERROR) || errorCondition.getCondition().equals(AmqpErrorCode.PROTON_IO_ERROR)) || !isProxyConfigured || StringUtil.isNullOrEmpty(hostName)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final String[] hostNameParts = hostName.split(":");<NEW_LINE>if (hostNameParts.length != 2) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int port;<NEW_LINE>try {<NEW_LINE>port = Integer.parseInt(hostNameParts[1]);<NEW_LINE>} catch (NumberFormatException ignore) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final IOException ioException = reconstructIOException(errorCondition);<NEW_LINE>final URI url = createURIFromHostNamePort(this.getAmqpConnection().getHostName(), this.getProtocolPort());<NEW_LINE>final InetSocketAddress address = new InetSocketAddress(hostNameParts[0], port);<NEW_LINE>if (TRACE_LOGGER.isErrorEnabled()) {<NEW_LINE>TRACE_LOGGER.error(String.format("Failed to connect to url: '%s', proxy host: '%s'", url.toString(), address.getHostString()), ioException);<NEW_LINE>}<NEW_LINE>if (proxySelector != null) {<NEW_LINE>proxySelector.connectFailed(url, address, ioException);<NEW_LINE>}<NEW_LINE>} | ProxySelector proxySelector = ProxySelector.getDefault(); |
372,956 | // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<NEW_LINE>static public void save() {<NEW_LINE>// On startup it'll be null, don't worry about it. It's trying to update<NEW_LINE>// the prefs for the open sketch before Preferences.init() has been called.<NEW_LINE>if (preferencesFile != null) {<NEW_LINE>try {<NEW_LINE>File dir = preferencesFile.getParentFile();<NEW_LINE>File preferencesTemp = File.createTempFile("preferences", ".txt", dir);<NEW_LINE>preferencesTemp.setWritable(true, false);<NEW_LINE>// Fix for 0163 to properly use Unicode when writing preferences.txt<NEW_LINE>PrintWriter writer = PApplet.createWriter(preferencesTemp);<NEW_LINE>String[] keyList = table.keySet().toArray(new String[table.size()]);<NEW_LINE>// Sorting is really helpful for debugging, diffing, and finding keys<NEW_LINE>keyList = PApplet.sort(keyList);<NEW_LINE>for (String key : keyList) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>writer.println(key + "=" + table.get(key));<NEW_LINE>}<NEW_LINE>writer.flush();<NEW_LINE>writer.close();<NEW_LINE>// Rename preferences.txt to preferences.old<NEW_LINE>File oldPreferences = new File(dir, "preferences.old");<NEW_LINE>if (oldPreferences.exists()) {<NEW_LINE>if (!oldPreferences.delete()) {<NEW_LINE>throw new IOException("Could not delete preferences.old");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (preferencesFile.exists() && !preferencesFile.renameTo(oldPreferences)) {<NEW_LINE>throw new IOException("Could not replace preferences.old");<NEW_LINE>}<NEW_LINE>// Make the temporary file into the real preferences<NEW_LINE>if (!preferencesTemp.renameTo(preferencesFile)) {<NEW_LINE>throw new IOException("Could not move preferences file into place");<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>Messages.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | showWarning("Preferences", "Could not save the Preferences file.", e); |
1,177,140 | // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .<NEW_LINE>public void handleRunEmulator(Sketch sketch, AndroidEditor editor, RunnerListener listener) throws SketchException, IOException {<NEW_LINE>listener.startIndeterminate();<NEW_LINE>listener.statusNotice<MASK><NEW_LINE>AndroidBuild build = new AndroidBuild(sketch, this, editor.getAppComponent());<NEW_LINE>listener.statusNotice(AndroidMode.getTextString("android_mode.status.building_project"));<NEW_LINE>build.build("debug");<NEW_LINE>boolean avd = AVD.ensureProperAVD(editor, this, sdk, build.isWear());<NEW_LINE>if (!avd) {<NEW_LINE>SketchException se = new SketchException(AndroidMode.getTextString("android_mode.error.cannot_create_avd"));<NEW_LINE>se.hideStackTrace();<NEW_LINE>throw se;<NEW_LINE>}<NEW_LINE>int comp = build.getAppComponent();<NEW_LINE>Future<Device> emu = Devices.getInstance().getEmulator(build.isWear());<NEW_LINE>runner = new AndroidRunner(build, listener);<NEW_LINE>runner.launch(emu, comp, true);<NEW_LINE>} | (AndroidMode.getTextString("android_mode.status.starting_project_build")); |
228,563 | public void archiveDisconnectedEvent(final String inode, final boolean putBack) throws PortalException, SystemException, DotDataException, DotSecurityException {<NEW_LINE>final WebContext ctx = WebContextFactory.get();<NEW_LINE>final HttpServletRequest request = ctx.getHttpServletRequest();<NEW_LINE>// Retrieving the current user<NEW_LINE>final User user = userAPI.getLoggedInUser(request);<NEW_LINE>final boolean respectFrontendRoles = true;<NEW_LINE>final Event ev = eventAPI.findbyInode(inode, user, respectFrontendRoles);<NEW_LINE>ev.setIndexPolicy(IndexPolicyProvider.getInstance().forSingleContent());<NEW_LINE>if (putBack) {<NEW_LINE>Event baseEvent = null;<NEW_LINE>try {<NEW_LINE>baseEvent = eventAPI.find(ev.getDisconnectedFrom(), false, user, respectFrontendRoles);<NEW_LINE>} catch (Exception e) {<NEW_LINE>Logger.error(this, "Base event not found");<NEW_LINE>}<NEW_LINE>if (baseEvent != null) {<NEW_LINE>try {<NEW_LINE>final Date originalStartDate = ev.getOriginalStartDate();<NEW_LINE>baseEvent.deleteDateToIgnore(originalStartDate);<NEW_LINE>APILocator.getContentletAPI().checkin(baseEvent, categoryAPI.getParents(baseEvent, user, true), perAPI.getPermissions(baseEvent), user, false);<NEW_LINE>} catch (Exception e) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>contAPI.archive(ev, user, respectFrontendRoles);<NEW_LINE>} | Logger.error(this, "Could not put back event in recurrence"); |
987,121 | public static void initializeBackendServices(ServerBuilder<?> serverBuilder, ServiceSet services, DAOSet daos, Executor executor) {<NEW_LINE>wrapService(serverBuilder, new FutureProjectServiceImpl(daos, executor));<NEW_LINE>LOGGER.trace("Project serviceImpl initialized");<NEW_LINE>wrapService(serverBuilder, new FutureExperimentServiceImpl(daos, executor));<NEW_LINE>LOGGER.trace("Experiment serviceImpl initialized");<NEW_LINE>wrapService(serverBuilder, new FutureExperimentRunServiceImpl(daos, executor));<NEW_LINE>LOGGER.trace("ExperimentRun serviceImpl initialized");<NEW_LINE>wrapService(serverBuilder, new CommentServiceImpl(services, daos));<NEW_LINE>LOGGER.trace("Comment serviceImpl initialized");<NEW_LINE>wrapService(serverBuilder, new DatasetServiceImpl(services, daos));<NEW_LINE>LOGGER.trace("Dataset serviceImpl initialized");<NEW_LINE>wrapService(serverBuilder, new DatasetVersionServiceImpl(services, daos));<NEW_LINE>LOGGER.trace("Dataset Version serviceImpl initialized");<NEW_LINE>wrapService(serverBuilder, new AdvancedServiceImpl(services, daos, executor));<NEW_LINE>LOGGER.trace("Hydrated serviceImpl initialized");<NEW_LINE>wrapService(serverBuilder, new LineageServiceImpl(daos));<NEW_LINE>LOGGER.trace("Lineage serviceImpl initialized");<NEW_LINE>wrapService(serverBuilder, new VersioningServiceImpl(services, <MASK><NEW_LINE>LOGGER.trace("Versioning serviceImpl initialized");<NEW_LINE>wrapService(serverBuilder, new MetadataServiceImpl(daos));<NEW_LINE>LOGGER.trace("Metadata serviceImpl initialized");<NEW_LINE>LOGGER.info("All services initialized and dependencies resolved");<NEW_LINE>} | daos, new FileHasher())); |
1,315,080 | public static void handle(String stmt, ServerConnection c, int offset) {<NEW_LINE>stmt = stmt.substring(offset).trim();<NEW_LINE>RouteResultset rrs = getRouteResultset(c, stmt);<NEW_LINE>if (rrs == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>// write header<NEW_LINE>ResultSetHeaderPacket header = PacketUtil.getHeader(FIELD_COUNT);<NEW_LINE>byte packetId = header.packetId;<NEW_LINE>buffer = header.write(buffer, c, true);<NEW_LINE>// write fields<NEW_LINE>for (FieldPacket field : fields) {<NEW_LINE>field.packetId = ++packetId;<NEW_LINE>buffer = field.write(buffer, c, true);<NEW_LINE>}<NEW_LINE>// write eof<NEW_LINE>EOFPacket eof = new EOFPacket();<NEW_LINE>eof.packetId = ++packetId;<NEW_LINE>buffer = eof.write(buffer, c, true);<NEW_LINE>// write rows<NEW_LINE>RouteResultsetNode[] rrsn = rrs.getNodes();<NEW_LINE>for (RouteResultsetNode node : rrsn) {<NEW_LINE>RowDataPacket row = getRow(node, c.getCharset());<NEW_LINE>row.packetId = ++packetId;<NEW_LINE>buffer = row.write(buffer, c, true);<NEW_LINE>}<NEW_LINE>// write last eof<NEW_LINE>EOFPacket lastEof = new EOFPacket();<NEW_LINE>lastEof.packetId = ++packetId;<NEW_LINE>buffer = lastEof.write(buffer, c, true);<NEW_LINE>// post write<NEW_LINE>c.write(buffer);<NEW_LINE>} | ByteBuffer buffer = c.allocate(); |
720,021 | protected void parseSSI(final byte[] in, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {<NEW_LINE>ByteBuffer buffer = new ByteBuffer(in);<NEW_LINE>OutputStream out = response.getOutputStream();<NEW_LINE>final byte[<MASK><NEW_LINE>int offset = 0;<NEW_LINE>int p = buffer.indexOf(inctxt, offset);<NEW_LINE>int end;<NEW_LINE>while (p >= 0 && (end = buffer.indexOf("-->".getBytes(), p + 24)) > 0) {<NEW_LINE>// min length 24; <!--#include virtual="a"<NEW_LINE>out.write(in, offset, p - offset);<NEW_LINE>out.flush();<NEW_LINE>// find right end quote<NEW_LINE>final int rightquote = buffer.indexOf("\"".getBytes(), p + 23);<NEW_LINE>if (rightquote > 0 && rightquote < end) {<NEW_LINE>final String path = buffer.toString(p + 22, rightquote - p - 22);<NEW_LINE>RequestDispatcher dispatcher = request.getRequestDispatcher(path);<NEW_LINE>try {<NEW_LINE>dispatcher.include(request, response);<NEW_LINE>} catch (IOException ex) {<NEW_LINE>if (path.indexOf("yacysearch") < 0)<NEW_LINE>ConcurrentLog.warn("FILEHANDLER", "YaCyDefaultServlet: parseSSI dispatcher problem - " + ex.getMessage() + ": " + path);<NEW_LINE>// this is probably a time-out; it may occur during search requests; for search requests we consider that normal<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>ConcurrentLog.warn("FILEHANDLER", "YaCyDefaultServlet: parseSSI closing quote missing " + buffer.toString(p, end - p) + " in " + request.getPathInfo());<NEW_LINE>}<NEW_LINE>// after "-->"<NEW_LINE>offset = end + 3;<NEW_LINE>p = buffer.indexOf(inctxt, offset);<NEW_LINE>}<NEW_LINE>out.write(in, offset, in.length - offset);<NEW_LINE>// DO NOT out.close(); because that would interrupt the server stream - it causes that the content is cut off from here on<NEW_LINE>buffer.close();<NEW_LINE>} | ] inctxt = "<!--#include virtual=\"".getBytes(); |
657,126 | public void translateToBedrock(GeyserSession session, CompoundTag itemTag, ItemMapping mapping) {<NEW_LINE>// Empty shulker box<NEW_LINE>if (!itemTag.contains("BlockEntityTag"))<NEW_LINE>return;<NEW_LINE>CompoundTag <MASK><NEW_LINE>if (blockEntityTag.get("Items") == null)<NEW_LINE>return;<NEW_LINE>ListTag itemsList = new ListTag("Items");<NEW_LINE>for (Tag item : (ListTag) blockEntityTag.get("Items")) {<NEW_LINE>// Information about the item<NEW_LINE>CompoundTag itemData = (CompoundTag) item;<NEW_LINE>// Final item tag to add to the list<NEW_LINE>CompoundTag boxItemTag = new CompoundTag("");<NEW_LINE>boxItemTag.put(new ByteTag("Slot", (byte) (MathUtils.getNbtByte(itemData.get("Slot").getValue()) & 255)));<NEW_LINE>// ???<NEW_LINE>boxItemTag.put(new ByteTag("WasPickedUp", (byte) 0));<NEW_LINE>ItemMapping boxMapping = session.getItemMappings().getMapping(Identifier.formalize(((StringTag) itemData.get("id")).getValue()));<NEW_LINE>boxItemTag.put(new StringTag("Name", boxMapping.getBedrockIdentifier()));<NEW_LINE>boxItemTag.put(new ShortTag("Damage", (short) boxMapping.getBedrockData()));<NEW_LINE>boxItemTag.put(new ByteTag("Count", MathUtils.getNbtByte(itemData.get("Count").getValue())));<NEW_LINE>// Only the display name is what we have interest in, so just translate that if relevant<NEW_LINE>CompoundTag displayTag = itemData.get("tag");<NEW_LINE>if (displayTag == null && boxMapping.hasTranslation()) {<NEW_LINE>displayTag = new CompoundTag("tag");<NEW_LINE>}<NEW_LINE>if (displayTag != null) {<NEW_LINE>boxItemTag.put(ItemTranslator.translateDisplayProperties(session, displayTag, boxMapping, '7'));<NEW_LINE>}<NEW_LINE>itemsList.add(boxItemTag);<NEW_LINE>}<NEW_LINE>itemTag.put(itemsList);<NEW_LINE>// Don't actually bother with removing the block entity tag. Too risky to translate<NEW_LINE>// if the user is on creative and messing with a shulker box<NEW_LINE>// itemTag.remove("BlockEntityTag");<NEW_LINE>} | blockEntityTag = itemTag.get("BlockEntityTag"); |
492,810 | public void init(GameEngine gameEngine) {<NEW_LINE>context = gameEngine.createChildContext();<NEW_LINE>headless = context.get(DisplayDevice.class).isHeadless();<NEW_LINE>initEntityAndComponentManagers(headless);<NEW_LINE>createLocalPlayer(context);<NEW_LINE>if (!headless) {<NEW_LINE>// TODO: REMOVE this and handle refreshing of core game state at the engine level - see Issue #1127<NEW_LINE>new RegisterInputSystem(context).step();<NEW_LINE>nuiManager = <MASK><NEW_LINE>eventSystem.registerEventHandler(nuiManager);<NEW_LINE>NUIEditorSystem nuiEditorSystem = new NUIEditorSystem();<NEW_LINE>context.put(NUIEditorSystem.class, nuiEditorSystem);<NEW_LINE>componentSystemManager.register(nuiEditorSystem, "engine:NUIEditorSystem");<NEW_LINE>NUISkinEditorSystem nuiSkinEditorSystem = new NUISkinEditorSystem();<NEW_LINE>context.put(NUISkinEditorSystem.class, nuiSkinEditorSystem);<NEW_LINE>componentSystemManager.register(nuiSkinEditorSystem, "engine:NUISkinEditorSystem");<NEW_LINE>inputSystem = context.get(InputSystem.class);<NEW_LINE>}<NEW_LINE>componentSystemManager.initialise();<NEW_LINE>console = context.get(Console.class);<NEW_LINE>storageServiceWorker = context.get(StorageServiceWorker.class);<NEW_LINE>playBackgroundMusic();<NEW_LINE>if (!headless) {<NEW_LINE>// guiManager.openWindow("main");<NEW_LINE>context.get(NUIManager.class).pushScreen("engine:mainMenuScreen");<NEW_LINE>}<NEW_LINE>if (!messageOnLoad.isEmpty()) {<NEW_LINE>TranslationSystem translationSystem = context.get(TranslationSystem.class);<NEW_LINE>if (headless) {<NEW_LINE>throw new RuntimeException(String.format("Game could not be started, server attempted to return to main menu: [%s]. See logs before", translationSystem.translate(messageOnLoad)));<NEW_LINE>} else {<NEW_LINE>MessagePopup popup = nuiManager.pushScreen(MessagePopup.ASSET_URI, MessagePopup.class);<NEW_LINE>popup.setMessage("Error", translationSystem.translate(messageOnLoad));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// TODO: enable it when exposing the telemetry to users<NEW_LINE>// pushLaunchPopup();<NEW_LINE>} | context.get(NUIManager.class); |
1,423,221 | IKeyframes<Double, Vector3[]> parseNormalKeyframes(@NotNull String DEF) throws XPathExpressionException {<NEW_LINE>Node tag;<NEW_LINE>Node node;<NEW_LINE>NodeList nodes;<NEW_LINE>XPathExpression expr;<NEW_LINE><MASK><NEW_LINE>Element scene = (Element) mDoc.getDocumentElement().getElementsByTagName("Scene").item(0);<NEW_LINE>expr = xpath.compile("//NormalInterpolator[@DEF=\"" + DEF + "\"]");<NEW_LINE>nodes = (NodeList) expr.evaluate(scene, XPathConstants.NODESET);<NEW_LINE>node = nodes.item(0);<NEW_LINE>Keyframes3D keyframes = new Keyframes3D();<NEW_LINE>tag = node.getAttributes().getNamedItem("key");<NEW_LINE>String[] keys = tag.getNodeValue().split("\\s+");<NEW_LINE>tag = node.getAttributes().getNamedItem("keyValue");<NEW_LINE>String[] values = tag.getNodeValue().split("\\s+");<NEW_LINE>if (keys.length < 1)<NEW_LINE>return null;<NEW_LINE>if (values.length < keys.length)<NEW_LINE>return null;<NEW_LINE>for (int i = 0; i < keys.length; i++) {<NEW_LINE>int framelength = values.length / keys.length;<NEW_LINE>double k = Double.parseDouble(keys[i]);<NEW_LINE>Vector3[] v = new Vector3[framelength / 3];<NEW_LINE>for (int j = 0; j < v.length; j++) {<NEW_LINE>int offset = i * framelength + j * 3;<NEW_LINE>double x = Double.parseDouble(values[offset + 0]);<NEW_LINE>double y = Double.parseDouble(values[offset + 1]);<NEW_LINE>double z = Double.parseDouble(values[offset + 2]);<NEW_LINE>v[j] = new Vector3(x, y, z);<NEW_LINE>}<NEW_LINE>keyframes.addPoint(k, v);<NEW_LINE>}<NEW_LINE>return keyframes;<NEW_LINE>} | XPath xpath = xPathfactory.newXPath(); |
1,583,784 | int compareSegments_(int left, int right, SimpleEdge segLeft, SimpleEdge segRight) {<NEW_LINE>if (m_b_intersection_detected)<NEW_LINE>return -1;<NEW_LINE>boolean sameY = m_prev_y == m_sweep_y && m_prev_x == m_sweep_x;<NEW_LINE>double xleft;<NEW_LINE>if (sameY && left == m_prev_1)<NEW_LINE>xleft = m_prevx_1;<NEW_LINE>else {<NEW_LINE>xleft = NumberUtils.NaN();<NEW_LINE>m_prev_1 = -1;<NEW_LINE>}<NEW_LINE>double xright;<NEW_LINE>if (sameY && right == m_prev_2)<NEW_LINE>xright = m_prevx_2;<NEW_LINE>else {<NEW_LINE>xright = NumberUtils.NaN();<NEW_LINE>m_prev_2 = -1;<NEW_LINE>}<NEW_LINE>// Quickly compare x projections.<NEW_LINE>Envelope1D envLeft = segLeft.m_segment.queryInterval(VertexDescription.Semantics.POSITION, 0);<NEW_LINE>Envelope1D envRight = segRight.m_segment.queryInterval(VertexDescription.Semantics.POSITION, 0);<NEW_LINE>if (envLeft.vmax < envRight.vmin)<NEW_LINE>return -1;<NEW_LINE>if (envRight.vmax < envLeft.vmin)<NEW_LINE>return 1;<NEW_LINE>m_prev_y = m_sweep_y;<NEW_LINE>m_prev_x = m_sweep_x;<NEW_LINE>// Now do intersection with the sweep line (it is a line parallel to the<NEW_LINE>// axis x.)<NEW_LINE>if (NumberUtils.isNaN(xleft)) {<NEW_LINE>m_prev_1 = left;<NEW_LINE>double x = segLeft.m_segment.intersectionOfYMonotonicWithAxisX(m_sweep_y, m_sweep_x);<NEW_LINE>xleft = x;<NEW_LINE>m_prevx_1 = x;<NEW_LINE>}<NEW_LINE>if (NumberUtils.isNaN(xright)) {<NEW_LINE>m_prev_2 = right;<NEW_LINE>double x = segRight.m_segment.intersectionOfYMonotonicWithAxisX(m_sweep_y, m_sweep_x);<NEW_LINE>xright = x;<NEW_LINE>m_prevx_2 = x;<NEW_LINE>}<NEW_LINE>if (Math.abs(xleft - xright) <= m_tolerance) {<NEW_LINE>// special processing as we cannot decide in a simple way.<NEW_LINE>return compareTwoSegments_(segLeft.m_segment, segRight.m_segment);<NEW_LINE>} else {<NEW_LINE>return xleft < xright ? -1 <MASK><NEW_LINE>}<NEW_LINE>} | : xleft > xright ? 1 : 0; |
266,624 | public void writeHeaderPart(AnnotatedOutput out) {<NEW_LINE>throwIfNotPrepared();<NEW_LINE>int sz = typeIds.size();<NEW_LINE>int offset = (sz == <MASK><NEW_LINE>if (sz > DexFormat.MAX_TYPE_IDX + 1) {<NEW_LINE>throw new DexIndexOverflowException(String.format("Too many type identifiers to fit in one dex file: %1$d; max is %2$d.%n" + "You may try using multi-dex. If multi-dex is enabled then the list of " + "classes for the boot dex list is too large.", items().size(), DexFormat.MAX_MEMBER_IDX + 1));<NEW_LINE>}<NEW_LINE>if (out.annotates()) {<NEW_LINE>out.annotate(4, "type_ids_size: " + Hex.u4(sz));<NEW_LINE>out.annotate(4, "type_ids_off: " + Hex.u4(offset));<NEW_LINE>}<NEW_LINE>out.writeInt(sz);<NEW_LINE>out.writeInt(offset);<NEW_LINE>} | 0) ? 0 : getFileOffset(); |
113,163 | public TriggerEvent createTriggerEvent(int when, String columnname) throws DDLException {<NEW_LINE>try {<NEW_LINE>Map gprops = (Map) getSpecification().getProperties();<NEW_LINE>Map props = (Map) getSpecification().getCommandProperties(Specification.CREATE_TRIGGER);<NEW_LINE>// NOI18N<NEW_LINE>Map bindmap = (Map) props.get("Binding");<NEW_LINE>// NOI18N<NEW_LINE>String tname = (String) bindmap.get("EVENT");<NEW_LINE>if (tname != null) {<NEW_LINE>Map typemap = (Map) gprops.get(tname);<NEW_LINE>if (typemap == null)<NEW_LINE>throw new InstantiationException(// NOI18N<NEW_LINE>MessageFormat.// NOI18N<NEW_LINE>format(NbBundle.getBundle("org.netbeans.lib.ddl.resources.Bundle").getString("EXC_UnableLocateObject"), new String[] { tname }));<NEW_LINE>// NOI18N<NEW_LINE>Class typeclass = Class.forName((String) typemap.get("Class"));<NEW_LINE>// NOI18N<NEW_LINE>String format = (String) typemap.get("Format");<NEW_LINE>TriggerEvent evt = (TriggerEvent) typeclass.newInstance();<NEW_LINE>// NOI18N<NEW_LINE>Map temap = (<MASK><NEW_LINE>evt.setName(TriggerEvent.getName(when));<NEW_LINE>evt.setColumn(columnname);<NEW_LINE>evt.setFormat(format);<NEW_LINE>return (TriggerEvent) evt;<NEW_LINE>} else<NEW_LINE>throw new InstantiationException(// NOI18N<NEW_LINE>MessageFormat.// NOI18N<NEW_LINE>format(// NOI18N<NEW_LINE>NbBundle.getBundle("org.netbeans.lib.ddl.resources.Bundle").getString("EXC_UnableLocateType"), new String[] { "EVENT", bindmap.toString() }));<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new DDLException(e.getMessage());<NEW_LINE>}<NEW_LINE>} | Map) props.get("TriggerEventMap"); |
93,614 | protected Object addValueAs(Object container, Function<Object, Object> merger) {<NEW_LINE>List<Object> list = castTo(container, List.class);<NEW_LINE>Object existingValue = getExistingValue(list);<NEW_LINE>Object newValue = merger.apply(existingValue);<NEW_LINE>if (newValue == NO_MERGE) {<NEW_LINE>return NO_MERGE;<NEW_LINE>}<NEW_LINE>if (existingValue == newValue) {<NEW_LINE>// the value is already there. Keep existing list<NEW_LINE>return list;<NEW_LINE>}<NEW_LINE>if (newValue == null) {<NEW_LINE>// nothing to add. Keep existing list<NEW_LINE>return list;<NEW_LINE>}<NEW_LINE>List<Object> newList = new ArrayList<>(<MASK><NEW_LINE>newList.addAll(list);<NEW_LINE>if (idx >= 0) {<NEW_LINE>while (idx >= newList.size()) {<NEW_LINE>newList.add(null);<NEW_LINE>}<NEW_LINE>newList.set(idx, newValue);<NEW_LINE>} else {<NEW_LINE>if (newValue instanceof Collection) {<NEW_LINE>newList.addAll((Collection) newValue);<NEW_LINE>} else {<NEW_LINE>newList.add(newValue);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return Collections.unmodifiableList(newList);<NEW_LINE>} | list.size() + 1); |
447,283 | protected void onCreate(Bundle savedInstanceState) {<NEW_LINE>// TODO Auto-generated method stub<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>setContentView(R.layout.about);<NEW_LINE>mWeixin = (TextView) findViewById(R.id.about_textview_weixin);<NEW_LINE>// http://weixin.qq.com/r/7HX_8R7EfiABhw_SnyDI<NEW_LINE>// http://e.weibo.com/eoeandroid00?ref=http%3A%2F%2Fwww.weibo.com%2Fu%2F1959452825%3Fwvr%3D5%26<NEW_LINE>String htmlLinkText = "<a href=\"http://weixin.qq.com/r/7HX_8R7EfiABhw_SnyDI\"> " + getResources().getString(R.string.about_weixin) + "</a>";<NEW_LINE>String htmlLinkTextWeibo = "<a href=\"#\"> " + getResources().getString(R.string.about_sina) + "</a>";<NEW_LINE>mWeixin.setText(Html.fromHtml(htmlLinkText));<NEW_LINE>mWeixin.setMovementMethod(LinkMovementMethod.getInstance());<NEW_LINE>mWeibo = (TextView) findViewById(R.id.about_textview_weibo);<NEW_LINE>mWeibo.setText<MASK><NEW_LINE>mWeibo.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>// TODO Auto-generated method stub<NEW_LINE>Intent intent = new Intent();<NEW_LINE>intent.setAction("android.intent.action.VIEW");<NEW_LINE>Uri content_url = Uri.parse("http://e.weibo.com/eoeandroid00?ref=http%3A%2F%2Fwww.weibo.com%2Fu%2F1959452825%3Fwvr%3D5%26");<NEW_LINE>intent.setData(content_url);<NEW_LINE>startActivity(intent);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>mBack = (ImageView) findViewById(R.id.about_imageview_gohome);<NEW_LINE>mBack.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>// TODO Auto-generated method stub<NEW_LINE>finish();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | (Html.fromHtml(htmlLinkTextWeibo)); |
334,437 | private PrivateKey parseKeyFromPem(String pemFormattedKey, Terminal terminal) throws UserException {<NEW_LINE>try {<NEW_LINE>return parsePKCS8PemString(pemFormattedKey);<NEW_LINE>} catch (Exception e) {<NEW_LINE>terminal.errorPrintln(<MASK><NEW_LINE>terminal.errorPrintln(Terminal.Verbosity.VERBOSE, "Failed to parse Private Key from the response of the Enroll Node API: " + e.getMessage());<NEW_LINE>terminal.errorPrintln(Terminal.Verbosity.VERBOSE, "");<NEW_LINE>terminal.errorPrintln(Terminal.Verbosity.VERBOSE, ExceptionsHelper.stackTrace(e));<NEW_LINE>terminal.errorPrintln(Terminal.Verbosity.VERBOSE, "");<NEW_LINE>throw new UserException(ExitCodes.DATA_ERROR, "Aborting enrolling to cluster. Failed to parse Private Key from the response of the Enroll Node API", e);<NEW_LINE>}<NEW_LINE>} | Terminal.Verbosity.VERBOSE, ""); |
1,088,329 | public DataEntryRecordId save(@NonNull final DataEntryRecord dataEntryRecord) {<NEW_LINE>final I_DataEntry_Record dataRecord;<NEW_LINE>final DataEntryRecordId existingId = dataEntryRecord.getId().orElse(null);<NEW_LINE>if (existingId == null) {<NEW_LINE>dataRecord = newInstance(I_DataEntry_Record.class);<NEW_LINE>} else {<NEW_LINE>dataRecord = getRecordById(existingId);<NEW_LINE>}<NEW_LINE>dataRecord.setAD_Table_ID(dataEntryRecord.getMainRecord().getAD_Table_ID());<NEW_LINE>dataRecord.setRecord_ID(dataEntryRecord.<MASK><NEW_LINE>dataRecord.setDataEntry_SubTab_ID(dataEntryRecord.getDataEntrySubTabId().getRepoId());<NEW_LINE>dataRecord.setIsActive(true);<NEW_LINE>final String jsonString = jsonDataEntryRecordMapper.serialize(dataEntryRecord.getFields());<NEW_LINE>dataRecord.setDataEntry_RecordData(jsonString);<NEW_LINE>saveRecord(dataRecord);<NEW_LINE>final DataEntryRecordId dataEntryRecordId = DataEntryRecordId.ofRepoId(dataRecord.getDataEntry_Record_ID());<NEW_LINE>dataEntryRecord.setId(dataEntryRecordId);<NEW_LINE>return dataEntryRecordId;<NEW_LINE>} | getMainRecord().getRecord_ID()); |
1,430,140 | public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject[] args, Block block) {<NEW_LINE>if (block.isGiven()) {<NEW_LINE>int len = args.length;<NEW_LINE>// too much array creation!<NEW_LINE>Object[] convertedArgs = new Object[len + 1];<NEW_LINE>IRubyObject[] intermediate = new IRubyObject[len + 1];<NEW_LINE>System.arraycopy(args, 0, intermediate, 0, len);<NEW_LINE>intermediate[len] = RubyProc.newProc(context.runtime, block, block.type);<NEW_LINE>JavaMethod method = (JavaMethod) findCallable(self, name, intermediate, len + 1);<NEW_LINE>final Class<?>[] paramTypes = method.getParameterTypes();<NEW_LINE>for (int i = 0; i < len + 1; i++) {<NEW_LINE>convertedArgs[i] = intermediate[i]<MASK><NEW_LINE>}<NEW_LINE>return method.invokeDirect(context, singleton, convertedArgs);<NEW_LINE>}<NEW_LINE>return call(context, self, clazz, name, args);<NEW_LINE>} | .toJava(paramTypes[i]); |
1,297,150 | private void writeSqlRequestExplainPlan() throws DocumentException {<NEW_LINE>try {<NEW_LINE>final String explainPlan;<NEW_LINE>if (collectorServer == null) {<NEW_LINE>explainPlan = DatabaseInformations.explainPlanFor(request.getName());<NEW_LINE>} else {<NEW_LINE>explainPlan = collectorServer.collectSqlRequestExplainPlan(collector.getApplication(), request.getName());<NEW_LINE>}<NEW_LINE>if (explainPlan != null) {<NEW_LINE>final Paragraph paragraph <MASK><NEW_LINE>paragraph.add(new Phrase('\n' + getString("Plan_d_execution") + '\n', boldFont));<NEW_LINE>paragraph.add(new Phrase(explainPlan, courierFont));<NEW_LINE>addToDocument(paragraph);<NEW_LINE>}<NEW_LINE>} catch (final Exception e) {<NEW_LINE>final Paragraph paragraph = new Paragraph("", cellFont);<NEW_LINE>paragraph.add(new Phrase('\n' + getString("Plan_d_execution") + '\n', boldFont));<NEW_LINE>paragraph.add(new Phrase(e.toString(), cellFont));<NEW_LINE>addToDocument(paragraph);<NEW_LINE>}<NEW_LINE>} | = new Paragraph("", cellFont); |
1,028,689 | public List<Integer> largestDivisibleSubset(int[] nums) {<NEW_LINE>int len = nums.length;<NEW_LINE>int[] count = new int[len];<NEW_LINE>int[] pre = new int[len];<NEW_LINE>Arrays.sort(nums);<NEW_LINE>int max = 0;<NEW_LINE>int index = -1;<NEW_LINE>for (int i = 0; i < len; i++) {<NEW_LINE>count[i] = 1;<NEW_LINE>pre[i] = -1;<NEW_LINE>for (int j = i - 1; j >= 0; j--) {<NEW_LINE>if (nums[i] % nums[j] == 0) {<NEW_LINE>if (1 + count[j] > count[i]) {<NEW_LINE>count[i] = count[j] + 1;<NEW_LINE>pre[i] = j;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (count[i] > max) {<NEW_LINE>max = count[i];<NEW_LINE>index = i;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List<Integer> <MASK><NEW_LINE>while (index != -1) {<NEW_LINE>res.add(nums[index]);<NEW_LINE>index = pre[index];<NEW_LINE>}<NEW_LINE>return res;<NEW_LINE>} | res = new ArrayList<>(); |
905,564 | public AttentionVertex build() {<NEW_LINE>this.nHeads = nHeads == 0 ? 1 : nHeads;<NEW_LINE>this.weightInit = weightInit == null ? WeightInit.XAVIER : weightInit;<NEW_LINE>Preconditions.checkArgument(nOut > 0, "You have to set nOut");<NEW_LINE>Preconditions.checkArgument(nInKeys > 0, "You have to set nInKeys");<NEW_LINE>Preconditions.checkArgument(nInQueries > 0, "You have to set nInQueries");<NEW_LINE>Preconditions.<MASK><NEW_LINE>Preconditions.checkArgument(headSize > 0 || nOut % this.nHeads == 0, "You have to set a head size if nOut isn't cleanly divided by nHeads");<NEW_LINE>Preconditions.checkArgument(projectInput || (nInQueries == nInKeys && nInKeys == nInValues && nInValues == nOut && nHeads == 1), "You may only disable projectInput if all nIn* equal to nOut and you want to use only a single attention head");<NEW_LINE>this.headSize = headSize == 0 ? nOut / nHeads : headSize;<NEW_LINE>return new AttentionVertex(this);<NEW_LINE>} | checkArgument(nInValues > 0, "You have to set nInValues"); |
458,072 | public void createNewProject(String projectPath, int originWidth, int originHeight, int pixelPerWorldUnit) {<NEW_LINE>if (projectPath == null || projectPath.equals("")) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String projectName = new File(projectPath).getName();<NEW_LINE>if (projectName.equals("")) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>createEmptyProject(<MASK><NEW_LINE>openProjectAndLoadAllData(projectPath);<NEW_LINE>String workSpacePath = projectPath.substring(0, projectPath.lastIndexOf(projectName));<NEW_LINE>if (workSpacePath.length() > 0) {<NEW_LINE>setLastOpenedPath(workSpacePath);<NEW_LINE>}<NEW_LINE>Sandbox.getInstance().loadCurrentProject();<NEW_LINE>facade.sendNotification(PROJECT_OPENED);<NEW_LINE>// Set title with opened file path<NEW_LINE>Gdx.graphics.setTitle(getFormatedTitle(projectPath));<NEW_LINE>} catch (IOException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>} | projectPath, originWidth, originHeight, pixelPerWorldUnit); |
651,951 | public static JavaClassAndMethod findInvocationLeastUpperBound(InvokeInstruction inv, ConstantPoolGen cpg, JavaClassAndMethodChooser methodChooser) throws ClassNotFoundException {<NEW_LINE>if (DEBUG_METHOD_LOOKUP) {<NEW_LINE>System.out.println("Find prototype method for " + SignatureConverter.convertMethodSignature(inv, cpg));<NEW_LINE>}<NEW_LINE>short opcode = inv.getOpcode();<NEW_LINE>if (opcode == Constants.INVOKESTATIC) {<NEW_LINE>if (methodChooser == INSTANCE_METHOD) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (methodChooser == STATIC_METHOD) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Find the method<NEW_LINE>if (opcode == Constants.INVOKESPECIAL) {<NEW_LINE>// Non-virtual dispatch<NEW_LINE>return findExactMethod(inv, cpg, methodChooser);<NEW_LINE>} else {<NEW_LINE>String className = inv.getClassName(cpg);<NEW_LINE>String methodName = inv.getName(cpg);<NEW_LINE>String <MASK><NEW_LINE>if (DEBUG_METHOD_LOOKUP) {<NEW_LINE>System.out.println("[Class name is " + className + "]");<NEW_LINE>System.out.println("[Method name is " + methodName + "]");<NEW_LINE>System.out.println("[Method signature is " + methodSig + "]");<NEW_LINE>}<NEW_LINE>if (className.startsWith("[")) {<NEW_LINE>// Java 1.5 allows array classes to appear as the class name<NEW_LINE>className = "java.lang.Object";<NEW_LINE>}<NEW_LINE>JavaClass jClass = Repository.lookupClass(className);<NEW_LINE>return findInvocationLeastUpperBound(jClass, methodName, methodSig, methodChooser, opcode == Constants.INVOKEINTERFACE);<NEW_LINE>}<NEW_LINE>} | methodSig = inv.getSignature(cpg); |
137,910 | public static void processChosenFromCompletion(FileLookup.LookupFile file, DocumentOwner doc, Finder finder, boolean nameOnly) {<NEW_LINE>if (file == null)<NEW_LINE>return;<NEW_LINE>if (nameOnly) {<NEW_LINE>try {<NEW_LINE>int caretPos = doc.getCaretPosition();<NEW_LINE>if (finder.getSeparator().equals(doc.getText(caretPos, 1))) {<NEW_LINE>for (; caretPos < doc.getLength(); caretPos++) {<NEW_LINE>final String eachChar = doc.getText(caretPos, 1);<NEW_LINE>if (!finder.getSeparator().equals(eachChar))<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int start = caretPos > 0 ? caretPos - 1 : caretPos;<NEW_LINE>while (start >= 0) {<NEW_LINE>final String each = <MASK><NEW_LINE>if (finder.getSeparator().equals(each)) {<NEW_LINE>start++;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>start--;<NEW_LINE>}<NEW_LINE>int end = Math.max(start, caretPos);<NEW_LINE>while (end <= doc.getLength()) {<NEW_LINE>final String each = doc.getText(end, 1);<NEW_LINE>if (finder.getSeparator().equals(each)) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>end++;<NEW_LINE>}<NEW_LINE>if (end > doc.getLength()) {<NEW_LINE>end = doc.getLength();<NEW_LINE>}<NEW_LINE>if (start > end || start < 0 || end > doc.getLength()) {<NEW_LINE>doc.setText(file.getAbsolutePath());<NEW_LINE>} else {<NEW_LINE>replacePathComponent(file, doc, finder, caretPos, start, end);<NEW_LINE>}<NEW_LINE>} catch (BadLocationException e) {<NEW_LINE>LOG.error(e);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>doc.setTextToFile(file);<NEW_LINE>}<NEW_LINE>} | doc.getText(start, 1); |
1,069,192 | protected void activateAsSchematicPrinter(MovementContext context, BlockPos pos, DeployerFakePlayer player, Level world, ItemStack filter) {<NEW_LINE>if (!filter.hasTag())<NEW_LINE>return;<NEW_LINE>if (!world.getBlockState(pos).getMaterial().isReplaceable())<NEW_LINE>return;<NEW_LINE>CompoundTag tag = filter.getTag();<NEW_LINE>if (!tag.getBoolean("Deployed"))<NEW_LINE>return;<NEW_LINE>SchematicWorld schematicWorld = SchematicInstances.get(world, filter);<NEW_LINE>if (schematicWorld == null)<NEW_LINE>return;<NEW_LINE>if (!schematicWorld.getBounds().isInside(pos.subtract(schematicWorld.anchor)))<NEW_LINE>return;<NEW_LINE>BlockState blockState = schematicWorld.getBlockState(pos);<NEW_LINE>ItemRequirement requirement = ItemRequirement.of(blockState, schematicWorld.getBlockEntity(pos));<NEW_LINE>if (requirement.isInvalid() || requirement.isEmpty())<NEW_LINE>return;<NEW_LINE>if (AllBlocks.BELT.has(blockState))<NEW_LINE>return;<NEW_LINE>List<ItemRequirement.StackRequirement> requiredItems = requirement.getRequiredItems();<NEW_LINE>ItemStack firstRequired = requiredItems.isEmpty() ? ItemStack.EMPTY : requiredItems.get(0).item;<NEW_LINE>if (!context.contraption.hasUniversalCreativeCrate) {<NEW_LINE>IItemHandler iItemHandler = context.contraption.inventory;<NEW_LINE>for (ItemRequirement.StackRequirement required : requiredItems) {<NEW_LINE>int amountFound = ItemHelper.extract(iItemHandler, s -> ItemRequirement.validate(required.item, s), ExtractionCountMode.UPTO, required.item.getCount(<MASK><NEW_LINE>if (amountFound < required.item.getCount())<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>for (ItemRequirement.StackRequirement required : requiredItems) ItemHelper.extract(iItemHandler, s -> ItemRequirement.validate(required.item, s), ExtractionCountMode.UPTO, required.item.getCount(), false);<NEW_LINE>}<NEW_LINE>CompoundTag data = null;<NEW_LINE>if (AllBlockTags.SAFE_NBT.matches(blockState)) {<NEW_LINE>BlockEntity tile = schematicWorld.getBlockEntity(pos);<NEW_LINE>if (tile != null) {<NEW_LINE>data = tile.saveWithFullMetadata();<NEW_LINE>data = NBTProcessors.process(tile, data, true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>BlockSnapshot blocksnapshot = BlockSnapshot.create(world.dimension(), world, pos);<NEW_LINE>BlockHelper.placeSchematicBlock(world, blockState, pos, firstRequired, data);<NEW_LINE>if (ForgeEventFactory.onBlockPlace(player, blocksnapshot, Direction.UP))<NEW_LINE>blocksnapshot.restore(true, false);<NEW_LINE>} | ), true).getCount(); |
431,550 | private void extractAndAttachRabbitHttpRequest(@NonNull final Exchange exchange) {<NEW_LINE>final Object dispatchMessageRequestCandidate = exchange.getIn().getBody();<NEW_LINE>if (!(dispatchMessageRequestCandidate instanceof DispatchMessageRequest)) {<NEW_LINE>throw new RuntimeCamelException("The route " + RABBITMQ_DISPATCHER_ROUTE_ID + " requires the body to be instanceof DispatchMessageRequest." + " However, it is " + (dispatchMessageRequestCandidate == null ? "null" : dispatchMessageRequestCandidate.getClass().getName()));<NEW_LINE>}<NEW_LINE>final DispatchMessageRequest dispatchMessageRequest = (DispatchMessageRequest) dispatchMessageRequestCandidate;<NEW_LINE>exchange.getIn().removeHeaders("CamelHttp*");<NEW_LINE>exchange.getIn().setHeader(<MASK><NEW_LINE>exchange.getIn().setHeader(Exchange.HTTP_URI, dispatchMessageRequest.getUrl());<NEW_LINE>exchange.getIn().setHeader(Exchange.HTTP_METHOD, HttpEndpointBuilderFactory.HttpMethods.POST);<NEW_LINE>exchange.getIn().setBody(dispatchMessageRequest.getMessage());<NEW_LINE>} | AUTHORIZATION, dispatchMessageRequest.getAuthToken()); |
928,899 | private Element processWsaProperty(Element header, boolean override, String elementLocalName, String wsaPropValue, boolean address, String refParamsContent) {<NEW_LINE>boolean existsWsa = getWsaProperty(header, <MASK><NEW_LINE>if (override) {<NEW_LINE>if (existsWsa) {<NEW_LINE>header = removeWsaProperty(override, header, elementLocalName);<NEW_LINE>}<NEW_LINE>if (address) {<NEW_LINE>header.appendChild(builder.createWsaAddressChildElement(elementLocalName, envelopeElement, wsaPropValue, refParamsContent));<NEW_LINE>} else {<NEW_LINE>header.appendChild(builder.createWsaChildElement(elementLocalName, envelopeElement, wsaPropValue));<NEW_LINE>}<NEW_LINE>} else if (!existsWsa) {<NEW_LINE>if (address) {<NEW_LINE>header.appendChild(builder.createWsaAddressChildElement(elementLocalName, envelopeElement, wsaPropValue, refParamsContent));<NEW_LINE>} else {<NEW_LINE>header.appendChild(builder.createWsaChildElement(elementLocalName, envelopeElement, wsaPropValue));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return header;<NEW_LINE>} | elementLocalName) != null ? true : false; |
941,290 | public void handleGET(CoapExchange exchange) {<NEW_LINE>// get request to read out details<NEW_LINE>Request request = exchange.advanced().getRequest();<NEW_LINE>int accept = request.getOptions().getAccept();<NEW_LINE>if (accept == UNDEFINED) {<NEW_LINE>accept = TEXT_PLAIN;<NEW_LINE>}<NEW_LINE>Response response = new Response(CONTENT);<NEW_LINE>response.getOptions().setContentFormat(accept);<NEW_LINE>byte[] payload = null;<NEW_LINE>switch(accept) {<NEW_LINE>case TEXT_PLAIN:<NEW_LINE>payload = handleGetFormat(exchange, "%1$s");<NEW_LINE>break;<NEW_LINE>case APPLICATION_JSON:<NEW_LINE>payload = handleGetFormat(exchange, "{ \"ip\" : \"%2$s\",\n \"port\" : %3$d }");<NEW_LINE>break;<NEW_LINE>case APPLICATION_XML:<NEW_LINE>payload = handleGetFormat(exchange, "<ip host=\"%2$s\" port=\"%3$d\" />");<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>String <MASK><NEW_LINE>exchange.respond(NOT_ACCEPTABLE, "Type \"" + ct + "\" is not supported for this resource!", TEXT_PLAIN);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>response.setPayload(payload);<NEW_LINE>exchange.respond(response);<NEW_LINE>} | ct = MediaTypeRegistry.toString(accept); |
1,584,068 | public void keyPressed(KeyEvent event) {<NEW_LINE>if (event.stateMask == SWT.MOD1) {<NEW_LINE>int key = event.character;<NEW_LINE>if (key <= 26 && key > 0) {<NEW_LINE>key += 'a' - 1;<NEW_LINE>}<NEW_LINE>if (key == 'a') {<NEW_LINE>partial_buddy_table.selectAll();<NEW_LINE>event.doit = false;<NEW_LINE>}<NEW_LINE>} else if (event.stateMask == 0 && event.keyCode == SWT.DEL) {<NEW_LINE>TableItem[] selection = partial_buddy_table.getSelection();<NEW_LINE>String str = "";<NEW_LINE>for (int i = 0; i < selection.length; i++) {<NEW_LINE>PartialBuddy buddy = (PartialBuddy) selection[i].getData();<NEW_LINE>str += (str.isEmpty() ? "" : ", ") + buddy.getName();<NEW_LINE>}<NEW_LINE>MessageBoxShell mb = new MessageBoxShell(MessageText.getString("message.confirm.delete.title"), MessageText.getString("message.confirm.delete.text", new String[] { str }), new String[] { MessageText.getString("Button.yes"), MessageText.<MASK><NEW_LINE>mb.open(new UserPrompterResultListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void prompterClosed(int result) {<NEW_LINE>if (result == 0) {<NEW_LINE>for (int i = 0; i < selection.length; i++) {<NEW_LINE>PartialBuddy buddy = (PartialBuddy) selection[i].getData();<NEW_LINE>buddy.remove();<NEW_LINE>}<NEW_LINE>partial_buddy_table.setSelection(new int[0]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>event.doit = false;<NEW_LINE>}<NEW_LINE>} | getString("Button.no") }, 1); |
828,575 | public void onClick(View v) {<NEW_LINE>controller.clearSelectedText();<NEW_LINE>Context c = anchor.getContext();<NEW_LINE>String trim = editText.getText()<MASK><NEW_LINE>if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {<NEW_LINE>ClipboardManager clipboard = (ClipboardManager) c.getSystemService(Context.CLIPBOARD_SERVICE);<NEW_LINE>clipboard.setText(trim);<NEW_LINE>} else {<NEW_LINE>android.content.ClipboardManager clipboard = (android.content.ClipboardManager) c.getSystemService(Context.CLIPBOARD_SERVICE);<NEW_LINE>ClipData clip = ClipData.newPlainText(c.getString(R.string.copied_text), trim);<NEW_LINE>clipboard.setPrimaryClip(clip);<NEW_LINE>}<NEW_LINE>Toast.makeText(c, c.getString(R.string.copied_text) + ": " + trim, Toast.LENGTH_SHORT).show();<NEW_LINE>closeDialog();<NEW_LINE>} | .toString().trim(); |
321,098 | private void drawReal(Graphics2D g) {<NEW_LINE>int width = parameters.getWidth();<NEW_LINE>int height = parameters.getHeight();<NEW_LINE>// Font<NEW_LINE><MASK><NEW_LINE>FontMetrics fontMetrics = null;<NEW_LINE>double factor = parameters.getFontFactor();<NEW_LINE>int fontSize = Math.min(parameters.getFontSize(), (int) (height / factor));<NEW_LINE>fontSize = fontSize > parameters.getFontSize() / (factor * 2) && fontSize <= parameters.getFontSize() / (factor / 4) ? (int) (parameters.getFontSize() / (factor / 4)) : fontSize;<NEW_LINE>if (font != null && fontSize > parameters.getFontSize() / (factor / 2)) {<NEW_LINE>font = font.deriveFont(Font.PLAIN, fontSize);<NEW_LINE>fontMetrics = g.getFontMetrics(font);<NEW_LINE>g.setFont(font);<NEW_LINE>} else {<NEW_LINE>font = null;<NEW_LINE>}<NEW_LINE>// 50<NEW_LINE>// int fifty = (int) ((50 - min) * (width / (max - min)));<NEW_LINE>// g.setColor(Color.BLUE);<NEW_LINE>// g.drawLine(fifty, 0, fifty, height);<NEW_LINE>RealTick graduation = RealTick.create(min, max, width);<NEW_LINE>int numberTicks = graduation.getNumberTicks();<NEW_LINE>for (int i = 0; i <= numberTicks; i++) {<NEW_LINE>int x = graduation.getTickPixelPosition(i, width);<NEW_LINE>int rank = graduation.getTickRank(i);<NEW_LINE>int h = Math.min(40, (int) (height / 15.0));<NEW_LINE>h = rank == 2 ? (h + h) : rank == 1 ? (int) (h + h / 2.) : h;<NEW_LINE>if (x > 0) {<NEW_LINE>g.setColor(parameters.getRealColor(rank));<NEW_LINE>g.drawLine(x, 0, x, h);<NEW_LINE>if (font != null && rank >= 1) {<NEW_LINE>String label = graduation.getTickValue(i);<NEW_LINE>int xLabel = x - (fontMetrics.stringWidth(label) / 2);<NEW_LINE>g.drawString(label, xLabel, (int) (h + fontSize * 1.2));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Font font = parameters.getFont(); |
1,114,902 | public static InstanceEntry snapshot() {<NEW_LINE>SystemInfo systemInfo = new SystemInfo();<NEW_LINE>CentralProcessor processor = systemInfo.getHardware().getProcessor();<NEW_LINE>long[] prevTicks = processor.getSystemCpuLoadTicks();<NEW_LINE>long[] ticks = processor.getSystemCpuLoadTicks();<NEW_LINE>long nice = ticks[CentralProcessor.TickType.NICE.getIndex()] - prevTicks[CentralProcessor.TickType.NICE.getIndex()];<NEW_LINE>long irq = ticks[CentralProcessor.TickType.IRQ.getIndex()] - prevTicks[CentralProcessor.TickType.IRQ.getIndex()];<NEW_LINE>long softirq = ticks[CentralProcessor.TickType.SOFTIRQ.getIndex()] - prevTicks[CentralProcessor.TickType.SOFTIRQ.getIndex()];<NEW_LINE>long steal = ticks[CentralProcessor.TickType.STEAL.getIndex()] - prevTicks[CentralProcessor.TickType.STEAL.getIndex()];<NEW_LINE>long cSys = ticks[CentralProcessor.TickType.SYSTEM.getIndex()] - prevTicks[CentralProcessor.TickType.SYSTEM.getIndex()];<NEW_LINE>long user = ticks[CentralProcessor.TickType.USER.getIndex()] - prevTicks[CentralProcessor.TickType.USER.getIndex()];<NEW_LINE>long iowait = ticks[CentralProcessor.TickType.IOWAIT.getIndex()] - prevTicks[CentralProcessor.TickType.IOWAIT.getIndex()];<NEW_LINE>long idle = ticks[CentralProcessor.TickType.IDLE.getIndex()] - prevTicks[CentralProcessor.TickType.IDLE.getIndex()];<NEW_LINE>long totalCpu = user + nice + cSys + idle + iowait + irq + softirq + steal;<NEW_LINE>double cpuRes = 1.0 - (idle * 1.0 / totalCpu);<NEW_LINE>if (Double.isNaN(cpuRes)) {<NEW_LINE>cpuRes = 0;<NEW_LINE>}<NEW_LINE>if (Double.isInfinite(cpuRes)) {<NEW_LINE>cpuRes = 1;<NEW_LINE>}<NEW_LINE>// double memRes = getMemRes(systemInfo);<NEW_LINE>InstanceEntry e = new InstanceEntry();<NEW_LINE>e.cpu = cpuRes;<NEW_LINE>e.mem = (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) * 1.0 / Runtime.getRuntime().totalMemory();<NEW_LINE>e.lqps = InstanceMonitor.getLqps();<NEW_LINE>e.pqps = InstanceMonitor.getPqps();<NEW_LINE>e.lrt = InstanceMonitor.getLrt();<NEW_LINE>e.prt = InstanceMonitor.getPrt();<NEW_LINE>e.thread = MetaClusterCurrent.wrapper(IOExecutor.class).count();<NEW_LINE>e.con = MetaClusterCurrent.wrapper(<MASK><NEW_LINE>return e;<NEW_LINE>} | MycatServer.class).countConnection(); |
46,785 | public SendUsersMessageResponse unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>SendUsersMessageResponse sendUsersMessageResponse = new SendUsersMessageResponse();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("ApplicationId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>sendUsersMessageResponse.setApplicationId(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("RequestId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>sendUsersMessageResponse.setRequestId(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("Result", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>sendUsersMessageResponse.setResult(new MapUnmarshaller<String, java.util.Map<String, EndpointMessageResult>>(context.getUnmarshaller(String.class), new MapUnmarshaller<String, EndpointMessageResult>(context.getUnmarshaller(String.class), EndpointMessageResultJsonUnmarshaller.getInstance())).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return sendUsersMessageResponse;<NEW_LINE>} | class).unmarshall(context)); |
1,236,503 | public Map<String, Set<String>> fieldsInIndices(String[] writeIndexWildcards) {<NEW_LINE>final String indices = String.join(",", writeIndexWildcards);<NEW_LINE>final State request = new State.Builder().indices(indices).withMetadata().build();<NEW_LINE>final JestResult jestResult = JestUtils.execute(jestClient, request, () -> "Couldn't read cluster state for indices " + indices);<NEW_LINE>final JsonNode indicesJson = <MASK><NEW_LINE>final ImmutableMap.Builder<String, Set<String>> fields = ImmutableMap.builder();<NEW_LINE>final Iterator<Map.Entry<String, JsonNode>> it = indicesJson.fields();<NEW_LINE>while (it.hasNext()) {<NEW_LINE>final Map.Entry<String, JsonNode> entry = it.next();<NEW_LINE>final String indexName = entry.getKey();<NEW_LINE>final Set<String> fieldNames = ImmutableSet.copyOf(entry.getValue().path("mappings").path(IndexMapping.TYPE_MESSAGE).path("properties").fieldNames());<NEW_LINE>if (!fieldNames.isEmpty()) {<NEW_LINE>fields.put(indexName, fieldNames);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return fields.build();<NEW_LINE>} | getClusterStateIndicesMetadata(jestResult.getJsonObject()); |
1,416,073 | public void renderFont(RenderFont font, String str, int x, int y, Color color, float sizeX, float sizeY) {<NEW_LINE>if (str.length() == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>RenderFontJme jmeFont = (RenderFontJme) font;<NEW_LINE>ColorRGBA colorRgba = convertColor(color, tempColor);<NEW_LINE>CachedTextKey key = new CachedTextKey(jmeFont.getFont(), str);<NEW_LINE>BitmapText text = textCacheLastFrame.get(key);<NEW_LINE>if (text == null) {<NEW_LINE>text = jmeFont.createText();<NEW_LINE>text.setText(str);<NEW_LINE>text.updateLogicalState(0);<NEW_LINE>}<NEW_LINE>textCacheCurrentFrame.put(key, text);<NEW_LINE>// float width = text.getLineWidth();<NEW_LINE>// float height = text.getLineHeight();<NEW_LINE>// + 0.5f * width * (1f - sizeX);<NEW_LINE>float x0 = x;<NEW_LINE>// + 0.5f * height * (1f - sizeY);<NEW_LINE>float y0 = y;<NEW_LINE>tempMat.loadIdentity();<NEW_LINE>tempMat.setTranslation(x0, getHeight() - y0, 0);<NEW_LINE>tempMat.<MASK><NEW_LINE>rm.setWorldMatrix(tempMat);<NEW_LINE>rm.setForcedRenderState(renderState);<NEW_LINE>text.setColor(colorRgba);<NEW_LINE>text.updateLogicalState(0);<NEW_LINE>text.render(rm, colorRgba);<NEW_LINE>// System.out.format("renderFont(%s, %s, %d, %d, %s, %f, %f)\n", jmeFont.getFont(), str, x, y, color.toString(), sizeX, sizeY);<NEW_LINE>} | setScale(sizeX, sizeY, 0); |
1,370,073 | public static double reLnBn(int n) {<NEW_LINE>if (n < 0)<NEW_LINE>return Double.NaN;<NEW_LINE>if (n == 1)<NEW_LINE>return -log(2);<NEW_LINE>if (n % 2 != 0)<NEW_LINE>return Double.NEGATIVE_INFINITY;<NEW_LINE>if (// rel err < 1e-14<NEW_LINE>n >= 50) {<NEW_LINE>// Log[-2^(3/2 - n) ((3 i)/e)^n n^(1/2 + n) ((3 + 40 n^2)/(-1 + 120 n^2))^n Pi^(1/2 - n)]<NEW_LINE>double x = 0;<NEW_LINE>// ignoring + imaginary pi here<NEW_LINE>x += (3.0 / 2.0 - n) * log(2);<NEW_LINE>// ignoring + imaginary pi/2 in the parenthesis<NEW_LINE>x += n * (log(3) - 1);<NEW_LINE>x += (n <MASK><NEW_LINE>x += n * (log(40 * n * n + 3) - log(120 * n * n - 1));<NEW_LINE>x += (0.5 - n) * log(PI);<NEW_LINE>return x;<NEW_LINE>}<NEW_LINE>return reLnBn_sub_50[n / 2];<NEW_LINE>} | + 0.5) * log(n); |
243,846 | public static QueryAccountBillResponse unmarshall(QueryAccountBillResponse queryAccountBillResponse, UnmarshallerContext _ctx) {<NEW_LINE>queryAccountBillResponse.setRequestId(_ctx.stringValue("QueryAccountBillResponse.RequestId"));<NEW_LINE>queryAccountBillResponse.setCode(_ctx.stringValue("QueryAccountBillResponse.Code"));<NEW_LINE>queryAccountBillResponse.setMessage(_ctx.stringValue("QueryAccountBillResponse.Message"));<NEW_LINE>queryAccountBillResponse.setSuccess(_ctx.booleanValue("QueryAccountBillResponse.Success"));<NEW_LINE>Data data = new Data();<NEW_LINE>data.setPageNum(_ctx.integerValue("QueryAccountBillResponse.Data.PageNum"));<NEW_LINE>data.setBillingCycle(_ctx.stringValue("QueryAccountBillResponse.Data.BillingCycle"));<NEW_LINE>data.setAccountID<MASK><NEW_LINE>data.setPageSize(_ctx.integerValue("QueryAccountBillResponse.Data.PageSize"));<NEW_LINE>data.setTotalCount(_ctx.integerValue("QueryAccountBillResponse.Data.TotalCount"));<NEW_LINE>data.setAccountName(_ctx.stringValue("QueryAccountBillResponse.Data.AccountName"));<NEW_LINE>List<Item> items = new ArrayList<Item>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("QueryAccountBillResponse.Data.Items.Length"); i++) {<NEW_LINE>Item item = new Item();<NEW_LINE>item.setPipCode(_ctx.stringValue("QueryAccountBillResponse.Data.Items[" + i + "].PipCode"));<NEW_LINE>item.setPretaxAmount(_ctx.floatValue("QueryAccountBillResponse.Data.Items[" + i + "].PretaxAmount"));<NEW_LINE>item.setBillingDate(_ctx.stringValue("QueryAccountBillResponse.Data.Items[" + i + "].BillingDate"));<NEW_LINE>item.setProductName(_ctx.stringValue("QueryAccountBillResponse.Data.Items[" + i + "].ProductName"));<NEW_LINE>item.setAdjustAmount(_ctx.floatValue("QueryAccountBillResponse.Data.Items[" + i + "].AdjustAmount"));<NEW_LINE>item.setOwnerName(_ctx.stringValue("QueryAccountBillResponse.Data.Items[" + i + "].OwnerName"));<NEW_LINE>item.setCurrency(_ctx.stringValue("QueryAccountBillResponse.Data.Items[" + i + "].Currency"));<NEW_LINE>item.setBillAccountName(_ctx.stringValue("QueryAccountBillResponse.Data.Items[" + i + "].BillAccountName"));<NEW_LINE>item.setSubscriptionType(_ctx.stringValue("QueryAccountBillResponse.Data.Items[" + i + "].SubscriptionType"));<NEW_LINE>item.setDeductedByCashCoupons(_ctx.floatValue("QueryAccountBillResponse.Data.Items[" + i + "].DeductedByCashCoupons"));<NEW_LINE>item.setBizType(_ctx.stringValue("QueryAccountBillResponse.Data.Items[" + i + "].BizType"));<NEW_LINE>item.setOwnerID(_ctx.stringValue("QueryAccountBillResponse.Data.Items[" + i + "].OwnerID"));<NEW_LINE>item.setDeductedByPrepaidCard(_ctx.floatValue("QueryAccountBillResponse.Data.Items[" + i + "].DeductedByPrepaidCard"));<NEW_LINE>item.setDeductedByCoupons(_ctx.floatValue("QueryAccountBillResponse.Data.Items[" + i + "].DeductedByCoupons"));<NEW_LINE>item.setBillAccountID(_ctx.stringValue("QueryAccountBillResponse.Data.Items[" + i + "].BillAccountID"));<NEW_LINE>item.setPaymentAmount(_ctx.floatValue("QueryAccountBillResponse.Data.Items[" + i + "].PaymentAmount"));<NEW_LINE>item.setInvoiceDiscount(_ctx.floatValue("QueryAccountBillResponse.Data.Items[" + i + "].InvoiceDiscount"));<NEW_LINE>item.setOutstandingAmount(_ctx.floatValue("QueryAccountBillResponse.Data.Items[" + i + "].OutstandingAmount"));<NEW_LINE>item.setCostUnit(_ctx.stringValue("QueryAccountBillResponse.Data.Items[" + i + "].CostUnit"));<NEW_LINE>item.setPretaxGrossAmount(_ctx.floatValue("QueryAccountBillResponse.Data.Items[" + i + "].PretaxGrossAmount"));<NEW_LINE>item.setCashAmount(_ctx.floatValue("QueryAccountBillResponse.Data.Items[" + i + "].CashAmount"));<NEW_LINE>item.setProductCode(_ctx.stringValue("QueryAccountBillResponse.Data.Items[" + i + "].ProductCode"));<NEW_LINE>items.add(item);<NEW_LINE>}<NEW_LINE>data.setItems(items);<NEW_LINE>queryAccountBillResponse.setData(data);<NEW_LINE>return queryAccountBillResponse;<NEW_LINE>} | (_ctx.stringValue("QueryAccountBillResponse.Data.AccountID")); |
1,699,721 | public DoubleMatrix differentiateTwiceX0(PiecewisePolynomialResult2D pp, double[] x0Keys, double[] x1Keys) {<NEW_LINE>ArgChecker.notNull(pp, "pp");<NEW_LINE>int order0 = pp.getOrder()[0];<NEW_LINE>int order1 = pp.getOrder()[1];<NEW_LINE>ArgChecker.isFalse(order0 < 3, "polynomial degree of x0 < 2");<NEW_LINE>DoubleArray knots0 = pp.getKnots0();<NEW_LINE>DoubleArray knots1 = pp.getKnots1();<NEW_LINE><MASK><NEW_LINE>int nKnots1 = knots1.size();<NEW_LINE>DoubleMatrix[][] coefs = pp.getCoefs();<NEW_LINE>DoubleMatrix[][] res = new DoubleMatrix[nKnots0][nKnots1];<NEW_LINE>for (int i = 0; i < nKnots0 - 1; ++i) {<NEW_LINE>for (int j = 0; j < nKnots1 - 1; ++j) {<NEW_LINE>DoubleMatrix coef = coefs[i][j];<NEW_LINE>res[i][j] = DoubleMatrix.of(order0 - 2, order1, (k, l) -> coef.get(k, l) * (order0 - k - 1) * (order0 - k - 2));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>PiecewisePolynomialResult2D ppDiff = new PiecewisePolynomialResult2D(knots0, knots1, res, new int[] { order0 - 2, order1 });<NEW_LINE>return evaluate(ppDiff, x0Keys, x1Keys);<NEW_LINE>} | int nKnots0 = knots0.size(); |
432,012 | private UserDashboardItemId createUserDashboardItemAndSave(@NonNull final UserDashboardId dashboardId, @NonNull final UserDashboardItemAddRequest request) {<NEW_LINE>//<NEW_LINE>// Get the KPI<NEW_LINE>final int kpiId = request.getKpiId();<NEW_LINE>if (kpiId <= 0) {<NEW_LINE>throw new AdempiereException("kpiId is not set").setParameter("request", request);<NEW_LINE>}<NEW_LINE>final I_WEBUI_KPI kpi = InterfaceWrapperHelper.loadOutOfTrx(kpiId, I_WEBUI_KPI.class);<NEW_LINE>final <MASK><NEW_LINE>final int seqNo = retrieveLastSeqNo(dashboardId, widgetType) + 10;<NEW_LINE>//<NEW_LINE>final I_WEBUI_DashboardItem webuiDashboardItem = InterfaceWrapperHelper.newInstance(I_WEBUI_DashboardItem.class);<NEW_LINE>webuiDashboardItem.setWEBUI_Dashboard_ID(dashboardId.getRepoId());<NEW_LINE>webuiDashboardItem.setIsActive(true);<NEW_LINE>webuiDashboardItem.setName(kpi.getName());<NEW_LINE>webuiDashboardItem.setSeqNo(seqNo);<NEW_LINE>webuiDashboardItem.setWEBUI_KPI_ID(kpiId);<NEW_LINE>webuiDashboardItem.setWEBUI_DashboardWidgetType(widgetType.getCode());<NEW_LINE>// will be set by change request:<NEW_LINE>// webuiDashboardItem.setES_TimeRange(esTimeRange);<NEW_LINE>// webuiDashboardItem.setES_TimeRange_End(esTimeRangeEnd);<NEW_LINE>InterfaceWrapperHelper.save(webuiDashboardItem);<NEW_LINE>logger.trace("Created {} for dashboard {}", webuiDashboardItem, dashboardId);<NEW_LINE>// TODO: copy trl but also consider the request.getCaption() and use it only for the current language trl.<NEW_LINE>//<NEW_LINE>// Apply the change request<NEW_LINE>if (request.getChangeRequest() != null) {<NEW_LINE>changeUserDashboardItemAndSave(webuiDashboardItem, request.getChangeRequest());<NEW_LINE>}<NEW_LINE>return UserDashboardItemId.ofRepoId(webuiDashboardItem.getWEBUI_DashboardItem_ID());<NEW_LINE>} | DashboardWidgetType widgetType = request.getWidgetType(); |
1,205,407 | final CreateAttributeGroupResult executeCreateAttributeGroup(CreateAttributeGroupRequest createAttributeGroupRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createAttributeGroupRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateAttributeGroupRequest> request = null;<NEW_LINE>Response<CreateAttributeGroupResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateAttributeGroupRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createAttributeGroupRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Service Catalog AppRegistry");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateAttributeGroup");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateAttributeGroupResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateAttributeGroupResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); |
1,228,137 | private SessionFactory buildSessionFactory(HibernateBundle<?> bundle, PooledDataSourceFactory dbConfig, ConnectionProvider connectionProvider, Map<String, String> properties, List<Class<?>> entities) {<NEW_LINE>final BootstrapServiceRegistry bootstrapServiceRegistry = configureBootstrapServiceRegistryBuilder(new BootstrapServiceRegistryBuilder()).build();<NEW_LINE>final Configuration configuration = new Configuration(bootstrapServiceRegistry);<NEW_LINE>configuration.setProperty(AvailableSettings.CURRENT_SESSION_CONTEXT_CLASS, "managed");<NEW_LINE>configuration.setProperty(AvailableSettings.USE_SQL_COMMENTS, Boolean.toString(dbConfig.isAutoCommentsEnabled()));<NEW_LINE>configuration.setProperty(AvailableSettings.USE_GET_GENERATED_KEYS, "true");<NEW_LINE>configuration.setProperty(AvailableSettings.GENERATE_STATISTICS, "true");<NEW_LINE>configuration.setProperty(AvailableSettings.USE_REFLECTION_OPTIMIZER, "true");<NEW_LINE>configuration.setProperty(AvailableSettings.ORDER_UPDATES, "true");<NEW_LINE>configuration.setProperty(AvailableSettings.ORDER_INSERTS, "true");<NEW_LINE>configuration.setProperty(AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, "true");<NEW_LINE>configuration.setProperty("jadira.usertype.autoRegisterUserTypes", "true");<NEW_LINE>for (Map.Entry<String, String> property : properties.entrySet()) {<NEW_LINE>configuration.setProperty(property.getKey(), property.getValue());<NEW_LINE>}<NEW_LINE>addAnnotatedClasses(configuration, entities);<NEW_LINE>bundle.configure(configuration);<NEW_LINE>final ServiceRegistry registry = new StandardServiceRegistryBuilder(bootstrapServiceRegistry).addService(ConnectionProvider.class, connectionProvider).applySettings(configuration.<MASK><NEW_LINE>configure(configuration, registry);<NEW_LINE>return configuration.buildSessionFactory(registry);<NEW_LINE>} | getProperties()).build(); |
1,154,279 | private static ValidateResult updateValidate(String dbName, String sql, int[] paramsTypes, Object[] mockedVals) {<NEW_LINE>ValidateResult status = new ValidateResult(sql);<NEW_LINE>Connection connection = null;<NEW_LINE>PreparedStatement preparedStatement = null;<NEW_LINE>try {<NEW_LINE>connection = DataSourceUtil.getConnection(dbName);<NEW_LINE>connection.setAutoCommit(false);<NEW_LINE>preparedStatement = connection.prepareStatement(SqlBuilder.net2Java(sql));<NEW_LINE>if (paramsTypes != null) {<NEW_LINE>for (int i = 1; i <= paramsTypes.length; i++) {<NEW_LINE>if (paramsTypes[i - 1] == 10001) {<NEW_LINE>preparedStatement.setObject(i, mockedVals[i <MASK><NEW_LINE>} else {<NEW_LINE>preparedStatement.setObject(i, mockedVals[i - 1], paramsTypes[i - 1]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int rows = preparedStatement.executeUpdate();<NEW_LINE>status.setAffectRows(rows);<NEW_LINE>status.setPassed(true).append("Validate Successfully");<NEW_LINE>} catch (Exception e) {<NEW_LINE>status.append(e.getMessage());<NEW_LINE>} finally {<NEW_LINE>ResourceUtils.close(preparedStatement);<NEW_LINE>ResourceUtils.rollback(connection);<NEW_LINE>ResourceUtils.close(connection);<NEW_LINE>}<NEW_LINE>return status;<NEW_LINE>} | - 1], Types.CHAR); |
1,819,754 | private void pauseVm(final PauseVmOnHypervisorMsg msg, final NoErrorCompletion completion) {<NEW_LINE>checkStatus();<NEW_LINE>final VmInstanceInventory vminv = msg.getVmInventory();<NEW_LINE>PauseVmOnHypervisorReply reply = new PauseVmOnHypervisorReply();<NEW_LINE>PauseVmCmd cmd = new PauseVmCmd();<NEW_LINE>cmd.setUuid(vminv.getUuid());<NEW_LINE>cmd.setTimeout(120);<NEW_LINE>new Http<>(pauseVmPath, cmd, PauseVmResponse.class).call(new ReturnValueCompletion<PauseVmResponse>(msg, completion) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void success(PauseVmResponse ret) {<NEW_LINE>if (!ret.isSuccess()) {<NEW_LINE>reply.setError(err(HostErrors.FAILED_TO_STOP_VM_ON_HYPERVISOR, "unable to pause vm[uuid:%s, name:%s] on kvm host[uuid:%s, ip:%s], because %s", vminv.getUuid(), vminv.getName(), self.getUuid(), self.getManagementIp(), ret.getError()));<NEW_LINE>logger.warn(reply.getError().getDetails());<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>completion.done();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void fail(ErrorCode err) {<NEW_LINE>reply.setError(err);<NEW_LINE>bus.reply(msg, reply);<NEW_LINE>completion.done();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | bus.reply(msg, reply); |
46,773 | private String asArgument(Class<?> cl, String name) {<NEW_LINE>if (cl.isPrimitive()) {<NEW_LINE>if (Boolean.TYPE == cl) {<NEW_LINE>return name + "==null?false:((Boolean)" + name + ").booleanValue()";<NEW_LINE>}<NEW_LINE>if (Byte.TYPE == cl) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (Character.TYPE == cl) {<NEW_LINE>return name + "==null?(char)0:((Character)" + name + ").charValue()";<NEW_LINE>}<NEW_LINE>if (Double.TYPE == cl) {<NEW_LINE>return name + "==null?(double)0:((Double)" + name + ").doubleValue()";<NEW_LINE>}<NEW_LINE>if (Float.TYPE == cl) {<NEW_LINE>return name + "==null?(float)0:((Float)" + name + ").floatValue()";<NEW_LINE>}<NEW_LINE>if (Integer.TYPE == cl) {<NEW_LINE>return name + "==null?(int)0:((Integer)" + name + ").intValue()";<NEW_LINE>}<NEW_LINE>if (Long.TYPE == cl) {<NEW_LINE>return name + "==null?(long)0:((Long)" + name + ").longValue()";<NEW_LINE>}<NEW_LINE>if (Short.TYPE == cl) {<NEW_LINE>return name + "==null?(short)0:((Short)" + name + ").shortValue()";<NEW_LINE>}<NEW_LINE>throw new RuntimeException(name + " is unknown primitive type.");<NEW_LINE>}<NEW_LINE>return "(" + ClassTypeUtils.getTypeStr(cl) + ")" + name;<NEW_LINE>} | return name + "==null?(byte)0:((Byte)" + name + ").byteValue()"; |
1,022,699 | public static void checkGsiColumnLen(SqlAlterTable query, ExecutionContext ec, SqlValidator validator) {<NEW_LINE>for (SqlAlterSpecification alter : query.getAlters()) {<NEW_LINE>// not alter add index or not alter add global index<NEW_LINE>if (!(alter instanceof SqlAddIndex) || !SqlIndexDefinition.SqlIndexResiding.GLOBAL.equals(((SqlAddIndex) alter).getIndexDef().getIndexResiding())) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>VariableManager variableManager = OptimizerContext.getContext(ec.getSchemaName()).getVariableManager();<NEW_LINE>// if not UK and sql mode not strict, no need to check<NEW_LINE>if (!(alter instanceof SqlAddUniqueIndex) && !variableManager.isSqlModeStrict(ec)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>final Map<String, SqlNumericLiteral> gsiColInfo = getGsiColInfoByCols(((SqlAddIndex) alter).getIndexDef().getColumns());<NEW_LINE>final ImmutableMap<String, Integer> charsetLen = getCharsetLenMap();<NEW_LINE>final int maxKeyLen = variableManager.getMaxKeyLen(query);<NEW_LINE>TableMeta table = null;<NEW_LINE>try {<NEW_LINE>table = ec.getSchemaManager().getTable(query.<MASK><NEW_LINE>} catch (Exception ignored) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (null != table) {<NEW_LINE>checkColMaxLen(gsiColInfo, table, charsetLen, maxKeyLen, ((SqlAddIndex) alter).getIndexName().getLastName(), query.getName(), validator);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getOriginTableName().getLastName()); |
250,460 | private static Factory fromVersion(RecognisedVersion version) {<NEW_LINE>if (RecognisedVersion.isOlderOrEqualTo(version, BetaMinecraftInterface.LAST_COMPATIBLE_VERSION)) {<NEW_LINE>return new Factory(BetaClassTranslator.get(version), BetaMinecraftInterface::new);<NEW_LINE>} else if (RecognisedVersion.isOlderOrEqualTo(version, LegacyMinecraftInterface.LAST_COMPATIBLE_VERSION)) {<NEW_LINE>return new Factory(LegacyClassTranslator.get(), LegacyMinecraftInterface::new);<NEW_LINE>} else if (RecognisedVersion.isOlderOrEqualTo(version, _1_13MinecraftInterface.LAST_COMPATIBLE_VERSION)) {<NEW_LINE>return new Factory(_1_13ClassTranslator.<MASK><NEW_LINE>} else if (RecognisedVersion.isOlderOrEqualTo(version, _1_15MinecraftInterface.LAST_COMPATIBLE_VERSION)) {<NEW_LINE>return new Factory(_1_15ClassTranslator.get(), _1_15MinecraftInterface::new);<NEW_LINE>} else {<NEW_LINE>return new Factory(DefaultClassTranslator.get(), LocalMinecraftInterface::new);<NEW_LINE>}<NEW_LINE>} | get(), _1_13MinecraftInterface::new); |
1,192,054 | public void onPause() {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>if (mCaptureSession != null) {<NEW_LINE>mCaptureSession.stopRepeating();<NEW_LINE>mCaptureSession = null;<NEW_LINE>mSessionCallback.getStateWaiter().waitForState(BlockingSessionCallback.SESSION_READY, SESSION_WAIT_TIMEOUT_MS);<NEW_LINE>}<NEW_LINE>} catch (CameraAccessException e) {<NEW_LINE>Log.e(TAG, "Could not stop repeating request.");<NEW_LINE>} catch (TimeoutRuntimeException e) {<NEW_LINE>Log.e(TAG, "Timed out waiting for camera to stop repeating.");<NEW_LINE>}<NEW_LINE>Log.d(TAG, "stopped repeating(), closing camera");<NEW_LINE>if (mCameraDevice != null) {<NEW_LINE>mCameraDevice.close();<NEW_LINE>mCameraDevice = null;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>mDeviceCallback.waitForState(BlockingStateCallback.STATE_CLOSED, STATE_TIMEOUT_MS);<NEW_LINE>Log.d(TAG, "camera closed");<NEW_LINE>} catch (TimeoutRuntimeException e) {<NEW_LINE>Log.e(TAG, "Timed out waiting for camera to close.");<NEW_LINE>}<NEW_LINE>Log.d(TAG, "camera closed, closing ImageReader");<NEW_LINE>if (mImageReader != null) {<NEW_LINE>mImageReader.close();<NEW_LINE>mImageReader = null;<NEW_LINE>}<NEW_LINE>stopBackgroundThread();<NEW_LINE>// Make the SurfaceView GONE so that on resume, surfaceCreated() is called,<NEW_LINE>// and on pause, surfaceDestroyed() is called.<NEW_LINE>mSurfaceView.getHolder().removeCallback(mSurfaceCallback);<NEW_LINE>mSurfaceView.setVisibility(View.GONE);<NEW_LINE>super.onPause();<NEW_LINE>} | Log.d(TAG, "onPause()"); |
455,557 | public Object invoke(MethodInvocation invocation) throws Throwable {<NEW_LINE>String method = invocation.getMethod().getName();<NEW_LINE>Object[] arguments = invocation.getArguments();<NEW_LINE>switch(method) {<NEW_LINE>case "addFirst":<NEW_LINE>envCopy.addFirst((PropertySource<?>) arguments[0]);<NEW_LINE>return invocation.getMethod().invoke(invocation.getThis(), makeEncryptable(arguments[0]));<NEW_LINE>case "addLast":<NEW_LINE>envCopy.addLast((PropertySource<<MASK><NEW_LINE>return invocation.getMethod().invoke(invocation.getThis(), makeEncryptable(arguments[0]));<NEW_LINE>case "addBefore":<NEW_LINE>envCopy.addBefore((String) arguments[0], (PropertySource<?>) arguments[1]);<NEW_LINE>return invocation.getMethod().invoke(invocation.getThis(), arguments[0], makeEncryptable(arguments[1]));<NEW_LINE>case "addAfter":<NEW_LINE>envCopy.addAfter((String) arguments[0], (PropertySource<?>) arguments[1]);<NEW_LINE>return invocation.getMethod().invoke(invocation.getThis(), arguments[0], makeEncryptable(arguments[1]));<NEW_LINE>case "replace":<NEW_LINE>envCopy.replace((String) arguments[0], (PropertySource<?>) arguments[1]);<NEW_LINE>return invocation.getMethod().invoke(invocation.getThis(), arguments[0], makeEncryptable(arguments[1]));<NEW_LINE>case "remove":<NEW_LINE>envCopy.remove((String) arguments[0]);<NEW_LINE>return invocation.proceed();<NEW_LINE>default:<NEW_LINE>return invocation.proceed();<NEW_LINE>}<NEW_LINE>} | ?>) arguments[0]); |
905,632 | Object resolveConstantExpressionValue(Expression expression) {<NEW_LINE>org.eclipse.jdt.internal.compiler.ast.ASTNode node = (org.eclipse.jdt.internal.compiler.ast.ASTNode) this.newAstToOldAst.get(expression);<NEW_LINE>if (node instanceof org.eclipse.jdt.internal.compiler.ast.FieldDeclaration) {<NEW_LINE>node = ((org.eclipse.jdt.internal.compiler.ast.FieldDeclaration) node).initialization;<NEW_LINE>}<NEW_LINE>if (node instanceof org.eclipse.jdt.internal.compiler.ast.Expression && ((org.eclipse.jdt.internal.compiler.ast.Expression) node).isTrulyExpression()) {<NEW_LINE>org.eclipse.jdt.internal.compiler.ast.Expression compilerExpression = (org.eclipse.jdt.internal.compiler.ast.Expression) node;<NEW_LINE>Constant constant = compilerExpression.constant;<NEW_LINE>if (constant != null && constant != Constant.NotAConstant) {<NEW_LINE>switch(constant.typeID()) {<NEW_LINE>case TypeIds.T_int:<NEW_LINE>return Integer.valueOf(constant.intValue());<NEW_LINE>case TypeIds.T_byte:<NEW_LINE>return Byte.valueOf(constant.byteValue());<NEW_LINE>case TypeIds.T_short:<NEW_LINE>return Short.valueOf(constant.shortValue());<NEW_LINE>case TypeIds.T_char:<NEW_LINE>return Character.valueOf(constant.charValue());<NEW_LINE>case TypeIds.T_float:<NEW_LINE>return Float.valueOf(constant.floatValue());<NEW_LINE>case TypeIds.T_double:<NEW_LINE>return Double.valueOf(constant.doubleValue());<NEW_LINE>case TypeIds.T_boolean:<NEW_LINE>return constant.booleanValue() ? Boolean.TRUE : Boolean.FALSE;<NEW_LINE>case TypeIds.T_long:<NEW_LINE>return Long.<MASK><NEW_LINE>case TypeIds.T_JavaLangString:<NEW_LINE>return constant.stringValue();<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | valueOf(constant.longValue()); |
71,442 | private void commitJob(DeleteJob job, Database db, long timeoutMs) throws DdlException, QueryStateException {<NEW_LINE>TransactionStatus status = null;<NEW_LINE>try {<NEW_LINE>if (unprotectedCommitJob(job, db, timeoutMs)) {<NEW_LINE>updateTableDeleteInfo(Catalog.getCurrentCatalog(), db.getId(), job.getDeleteInfo().getTableId());<NEW_LINE>}<NEW_LINE>status = Catalog.getCurrentGlobalTransactionMgr().getTransactionState(db.getId(), job.getTransactionId()).getTransactionStatus();<NEW_LINE>} catch (UserException e) {<NEW_LINE>if (cancelJob(job, CancelType.COMMIT_FAIL, e.getMessage())) {<NEW_LINE>throw new DdlException(e.getMessage(), e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>sb.append("{'label':'").append(job.getLabel()).append("', 'status':'").append(status.name());<NEW_LINE>sb.append("', 'txnId':'").append(job.getTransactionId()).append("'");<NEW_LINE>switch(status) {<NEW_LINE>case COMMITTED:<NEW_LINE>{<NEW_LINE>// Although publish is unfinished we should tell user that commit already success.<NEW_LINE>String errMsg = "delete job is committed but may be taking effect later";<NEW_LINE>sb.append(", 'err':'").append(errMsg).append("'");<NEW_LINE>sb.append("}");<NEW_LINE>throw new QueryStateException(MysqlStateType.OK, sb.toString());<NEW_LINE>}<NEW_LINE>case VISIBLE:<NEW_LINE>{<NEW_LINE>sb.append("}");<NEW_LINE>throw new QueryStateException(MysqlStateType.<MASK><NEW_LINE>}<NEW_LINE>default:<NEW_LINE>throw new IllegalStateException("wrong transaction status: " + status.name());<NEW_LINE>}<NEW_LINE>} | OK, sb.toString()); |
313,414 | private void sendMessage() {<NEW_LINE>if (mediaPreviewAdapter.hasAttachments()) {<NEW_LINE>commitAttachments();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final Editable text = this.binding.textinput.getText();<NEW_LINE>final String body = text == null ? "" : text.toString();<NEW_LINE>final Conversation conversation = this.conversation;<NEW_LINE>if (body.length() == 0 || conversation == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (trustKeysIfNeeded(conversation, REQUEST_TRUST_KEYS_TEXT)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final Message message;<NEW_LINE>if (conversation.getCorrectingMessage() == null) {<NEW_LINE>message = new Message(conversation, body, conversation.getNextEncryption());<NEW_LINE>Message.configurePrivateMessage(message);<NEW_LINE>} else {<NEW_LINE>message = conversation.getCorrectingMessage();<NEW_LINE>message.setBody(body);<NEW_LINE>message.putEdited(message.getUuid(), message.getServerMsgId());<NEW_LINE>message.setServerMsgId(null);<NEW_LINE>message.setUuid(UUID.<MASK><NEW_LINE>}<NEW_LINE>switch(conversation.getNextEncryption()) {<NEW_LINE>case Message.ENCRYPTION_PGP:<NEW_LINE>sendPgpMessage(message);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>sendMessage(message);<NEW_LINE>}<NEW_LINE>} | randomUUID().toString()); |
805,066 | private void initView() {<NEW_LINE>binding.txtLanguage.setText(LocaleUtil.getCurrentLanguage(getActivity()));<NEW_LINE>binding.languageSettingsContainer.setOnClickListener(v -> showLanguagesDialog());<NEW_LINE>DefaultPrefs prefs = DefaultPrefs.get(getContext());<NEW_LINE>boolean shouldNotify = prefs.getNotificationFlag();<NEW_LINE>binding.notificationSwitchRow.init(shouldNotify, ((v, isChecked) -> {<NEW_LINE>prefs.putNotificationFlag(isChecked);<NEW_LINE>binding.headsUpSwitchRow.setEnabled(isChecked);<NEW_LINE>}));<NEW_LINE>binding.headsUpSwitchRow.setEnabled(shouldNotify);<NEW_LINE>binding.localTimeSwitchRow.init(prefs.getShowLocalTimeFlag(), ((buttonView, isChecked) -> {<NEW_LINE>prefs.putShowLocalTimeFlag(isChecked);<NEW_LINE>}));<NEW_LINE>if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {<NEW_LINE><MASK><NEW_LINE>binding.headsUpSwitchRow.init(headsUp, (v, isChecked) -> {<NEW_LINE>prefs.putHeadsUpFlag(isChecked);<NEW_LINE>});<NEW_LINE>binding.headsUpSwitchRow.setVisibility(View.VISIBLE);<NEW_LINE>binding.headsUpBorder.setVisibility(View.VISIBLE);<NEW_LINE>}<NEW_LINE>} | boolean headsUp = prefs.getHeadsUpFlag(); |
1,280,720 | /*<NEW_LINE>* -----------<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public void print(StringBuilder toStringBuilder) {<NEW_LINE>super.print(toStringBuilder);<NEW_LINE>toStringBuilder.append("WebComponentDescriptor\n");<NEW_LINE>toStringBuilder.append("\n initializationParameters ").append(initializationParameters);<NEW_LINE>toStringBuilder.append("\n urlPatterns ").append(urlPatterns);<NEW_LINE>toStringBuilder.append("\n canonicalName ").append(canonicalName);<NEW_LINE>toStringBuilder.append("\n loadOnStartUp ").append(loadOnStartUp);<NEW_LINE>toStringBuilder.append("\n enabled ").append(enabled);<NEW_LINE>toStringBuilder.append("\n asyncSupported ").append(asyncSupported);<NEW_LINE>toStringBuilder.append("\n securityRoleReferences ").append(securityRoleReferences);<NEW_LINE>toStringBuilder.append<MASK><NEW_LINE>if (isServlet()) {<NEW_LINE>toStringBuilder.append("\n servlet className ").append(getWebComponentImplementation());<NEW_LINE>} else {<NEW_LINE>toStringBuilder.append("\n jspFileName ").append(getWebComponentImplementation());<NEW_LINE>}<NEW_LINE>} | ("\n multipartConfig ").append(multipartConfig); |
946,348 | void scrollUp(float dx, float dy) {<NEW_LINE>mDragStarted = false;<NEW_LINE>float pos = mMotionLayout.getProgress();<NEW_LINE>mMotionLayout.getAnchorDpDt(mTouchAnchorId, pos, mTouchAnchorX, mTouchAnchorY, mAnchorDpDt);<NEW_LINE>float movmentInDir = mTouchDirectionX * mAnchorDpDt[0] + mTouchDirectionY * mAnchorDpDt[1];<NEW_LINE>float velocity;<NEW_LINE>if (mTouchDirectionX != 0) {<NEW_LINE>velocity = dx * mTouchDirectionX / mAnchorDpDt[0];<NEW_LINE>} else {<NEW_LINE>velocity = <MASK><NEW_LINE>}<NEW_LINE>if (!Float.isNaN(velocity)) {<NEW_LINE>// TODO calibration & animation speed based on velocity<NEW_LINE>pos += velocity / 3;<NEW_LINE>}<NEW_LINE>if (pos != 0.0f && pos != 1.0f & mOnTouchUp != MotionLayout.TOUCH_UP_STOP) {<NEW_LINE>mMotionLayout.touchAnimateTo(mOnTouchUp, (pos < 0.5) ? 0.0f : 1.0f, velocity);<NEW_LINE>}<NEW_LINE>} | dy * mTouchDirectionY / mAnchorDpDt[1]; |
811,074 | private static TreeArtifactValue transformSharedTree(Artifact newArtifact, TreeArtifactValue tree) {<NEW_LINE>Preconditions.checkState(newArtifact.isTreeArtifact(), "Expected tree artifact, got %s", newArtifact);<NEW_LINE>if (TreeArtifactValue.OMITTED_TREE_MARKER.equals(tree)) {<NEW_LINE>return TreeArtifactValue.OMITTED_TREE_MARKER;<NEW_LINE>}<NEW_LINE>SpecialArtifact newParent = (SpecialArtifact) newArtifact;<NEW_LINE>TreeArtifactValue.Builder <MASK><NEW_LINE>for (Map.Entry<TreeFileArtifact, FileArtifactValue> child : tree.getChildValues().entrySet()) {<NEW_LINE>newTree.putChild(TreeFileArtifact.createTreeOutput(newParent, child.getKey().getParentRelativePath()), child.getValue());<NEW_LINE>}<NEW_LINE>tree.getArchivedRepresentation().ifPresent(archivedRepresentation -> newTree.setArchivedRepresentation(ArchivedTreeArtifact.createForTree(newParent), archivedRepresentation.archivedFileValue()));<NEW_LINE>return newTree.build();<NEW_LINE>} | newTree = TreeArtifactValue.newBuilder(newParent); |
1,253,362 | private void continueGroup(VideoGroup group) {<NEW_LINE>boolean updateInProgress = mScrollAction != null && !mScrollAction.isDisposed();<NEW_LINE>if (updateInProgress) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Log.d(TAG, "continueGroup: start continue group: " + group.getTitle());<NEW_LINE>getController().showProgressBar(true);<NEW_LINE>MediaGroup mediaGroup = group.getMediaGroup();<NEW_LINE>MediaItemManager mediaItemManager = YouTubeMediaService<MASK><NEW_LINE>mScrollAction = mediaItemManager.continueGroupObserve(mediaGroup).subscribeOn(Schedulers.newThread()).observeOn(AndroidSchedulers.mainThread()).subscribe(continueMediaGroup -> {<NEW_LINE>getController().showProgressBar(false);<NEW_LINE>VideoGroup videoGroup = VideoGroup.from(continueMediaGroup, group.getSection());<NEW_LINE>getController().updateSuggestions(videoGroup);<NEW_LINE>// Merge remote queue with player's queue<NEW_LINE>Video video = getController().getVideo();<NEW_LINE>if (video != null && video.isRemote && getController().getSuggestionsIndex(videoGroup) == 0) {<NEW_LINE>Playlist.instance().addAll(videoGroup.getVideos());<NEW_LINE>Playlist.instance().setCurrent(video);<NEW_LINE>}<NEW_LINE>}, error -> {<NEW_LINE>getController().showProgressBar(false);<NEW_LINE>Log.e(TAG, "continueGroup error: %s", error.getMessage());<NEW_LINE>});<NEW_LINE>} | .instance().getMediaItemManager(); |
376,779 | private void loadEdgesImpl(String filePath) throws ExecutionException, InterruptedException {<NEW_LINE>// Try to get number of lines<NEW_LINE>long numOfLines = getNumLinesOfFile(filePath);<NEW_LINE>long linesPerWorker = (numOfLines + (workerNum - 1)) / workerNum;<NEW_LINE>long start = Math.min(linesPerWorker * workerId, numOfLines);<NEW_LINE>long end = Math.min(linesPerWorker * (workerId + 1), numOfLines);<NEW_LINE>long chunkSize = (end - start + threadNum - 1) / threadNum;<NEW_LINE>proxy.reserveNumEdges((int) (end - start));<NEW_LINE>logger.debug("[reading edge] total lines {}, worker {} read {}, thread num {}, chunkSize {}", numOfLines, workerId, end - start, threadNum, chunkSize);<NEW_LINE>long cur = start;<NEW_LINE>Future[] futures = new Future[threadNum];<NEW_LINE>for (int i = 0; i < threadNum; ++i) {<NEW_LINE>EdgeLoaderCallable edgeLoaderCallable = new EdgeLoaderCallable(i, filePath, Math.min(cur, end), Math.min<MASK><NEW_LINE>futures[i] = executor.submit(edgeLoaderCallable);<NEW_LINE>cur += chunkSize;<NEW_LINE>}<NEW_LINE>long sum = 0;<NEW_LINE>for (int i = 0; i < threadNum; ++i) {<NEW_LINE>sum += (Long) futures[i].get();<NEW_LINE>}<NEW_LINE>logger.info("[edges] worker {} loaded {} lines ", workerId, sum);<NEW_LINE>} | (cur + chunkSize, end)); |
1,407,073 | private void generateFPVarRef(BLangExpression fpVarRef, BInvokableSymbol funcSymbol) {<NEW_LINE>// fpload instruction<NEW_LINE>BIRVariableDcl tempVarLambda = new BIRVariableDcl(fpVarRef.getBType(), this.env.nextLocalVarId(names), VarScope.FUNCTION, VarKind.TEMP);<NEW_LINE>this.env.enclFunc.localVars.add(tempVarLambda);<NEW_LINE>BIROperand lhsOp = new BIROperand(tempVarLambda);<NEW_LINE>Name funcName = getFuncName(funcSymbol);<NEW_LINE>List<BIRVariableDcl> params = new ArrayList<>();<NEW_LINE>funcSymbol.params.forEach(param -> {<NEW_LINE>BIRVariableDcl birVarDcl = new BIRVariableDcl(fpVarRef.pos, param.type, this.env.nextLambdaVarId(names), VarScope.FUNCTION, VarKind.ARG, null);<NEW_LINE>params.add(birVarDcl);<NEW_LINE>});<NEW_LINE>BVarSymbol restParam = funcSymbol.restParam;<NEW_LINE>if (restParam != null) {<NEW_LINE>BIRVariableDcl birVarDcl = new BIRVariableDcl(fpVarRef.pos, restParam.type, this.env.nextLambdaVarId(names), VarScope.FUNCTION, VarKind.ARG, null);<NEW_LINE>params.add(birVarDcl);<NEW_LINE>}<NEW_LINE>setScopeAndEmit(new BIRNonTerminator.FPLoad(fpVarRef.pos, funcSymbol.pkgID, funcName, lhsOp, params, new ArrayList<>(), funcSymbol.type, funcSymbol<MASK><NEW_LINE>this.env.targetOperand = lhsOp;<NEW_LINE>} | .strandName, funcSymbol.schedulerPolicy)); |
1,050,625 | private JToggleButton initGapButton() {<NEW_LINE>JToggleButton button = new JToggleButton();<NEW_LINE>// NOI18N<NEW_LINE>ImageIcon image = ImageUtilities.loadImageIcon("org/netbeans/modules/form/layoutsupport/griddesigner/resources/gaps.png", false);<NEW_LINE>button.setIcon(image);<NEW_LINE>button.setFocusPainted(false);<NEW_LINE>button.addActionListener(new ActionListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(ActionEvent e) {<NEW_LINE>boolean gapSupport = ((JToggleButton) e.getSource()).isSelected();<NEW_LINE>gapWidthSpinner.setEnabled(gapSupport);<NEW_LINE>gapHeightSpinner.setEnabled(gapSupport);<NEW_LINE>gapWidthSpinnerLabel.setEnabled(gapSupport);<NEW_LINE>gapHeightSpinnerLabel.setEnabled(gapSupport);<NEW_LINE>gapWidthSpinnerBox.setEnabled(gapSupport);<NEW_LINE>gapHeightSpinnerBox.setEnabled(gapSupport);<NEW_LINE>if (gapSupport) {<NEW_LINE>assert !gridManager.getGridInfo().hasGaps();<NEW_LINE>// NOI18N<NEW_LINE>((JToggleButton) e.getSource()).setToolTipText(NbBundle.getMessage(GridDesigner.class, "GridDesigner.gapSupportDisable"));<NEW_LINE>int gapWidth = FormLoaderSettings<MASK><NEW_LINE>int gapHeight = FormLoaderSettings.getInstance().getGapHeight();<NEW_LINE>gapWidthSpinner.setValue(gapWidth);<NEW_LINE>gapHeightSpinner.setValue(gapHeight);<NEW_LINE>glassPane.performAction(new AddGapsAction());<NEW_LINE>} else {<NEW_LINE>assert gridManager.getGridInfo().hasGaps();<NEW_LINE>// NOI18N<NEW_LINE>((JToggleButton) e.getSource()).setToolTipText(NbBundle.getMessage(GridDesigner.class, "GridDesigner.gapSupportEnable"));<NEW_LINE>glassPane.performAction(new RemoveGapsAction());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return button;<NEW_LINE>} | .getInstance().getGapWidth(); |
1,408,161 | public void update2(final VariantContext eval, final VariantContext comp, final VariantEvalContext context) {<NEW_LINE>if (comp != null) {<NEW_LINE>// we only need to consider sites in comp<NEW_LINE>if (REQUIRE_IDENTICAL_ALLELES && (eval != null && haveDifferentAltAlleles(eval, comp)))<NEW_LINE>nDifferentAlleleSites++;<NEW_LINE>else {<NEW_LINE>final SiteStatus evalStatus = calcSiteStatus(eval);<NEW_LINE>final Set<String> evalSamples = context.getSampleNamesForEvaluation();<NEW_LINE>// if we have genotypes in both eval and comp, subset comp down just the samples in eval<NEW_LINE>final boolean doSubset = comp.hasGenotypes() && !evalSamples.isEmpty(<MASK><NEW_LINE>final SiteStatus compStatus = calcSiteStatus(doSubset ? comp.subContextFromSamples(evalSamples, false) : comp);<NEW_LINE>counts[compStatus.ordinal()][evalStatus.ordinal()]++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ) && comp.hasGenotypes(evalSamples); |
344,694 | private static TieredIdentity fromScript(AlluxioConfiguration conf) {<NEW_LINE>String scriptName = conf.getString(PropertyKey.LOCALITY_SCRIPT);<NEW_LINE>Path script = Paths.get(scriptName);<NEW_LINE>if (!Files.exists(script)) {<NEW_LINE>URL resource = TieredIdentityFactory.class.getClassLoader().getResource(scriptName);<NEW_LINE>if (resource != null) {<NEW_LINE>script = Paths.get(resource.getPath());<NEW_LINE>} else {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>LOG.debug("Found tiered identity script at {}", script);<NEW_LINE>String identityString;<NEW_LINE>try {<NEW_LINE>identityString = ShellUtils.<MASK><NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new RuntimeException(String.format("Failed to run script %s: %s", script, e.toString()), e);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>return fromString(identityString, conf);<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new RuntimeException(String.format("Failed to parse output of running %s: %s", script, e.getMessage()), e);<NEW_LINE>}<NEW_LINE>} | execCommand(script.toString()); |
384,329 | public void marshall(APNSVoipSandboxChannelResponse aPNSVoipSandboxChannelResponse, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (aPNSVoipSandboxChannelResponse == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(aPNSVoipSandboxChannelResponse.getApplicationId(), APPLICATIONID_BINDING);<NEW_LINE>protocolMarshaller.marshall(aPNSVoipSandboxChannelResponse.getCreationDate(), CREATIONDATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(aPNSVoipSandboxChannelResponse.getDefaultAuthenticationMethod(), DEFAULTAUTHENTICATIONMETHOD_BINDING);<NEW_LINE>protocolMarshaller.marshall(aPNSVoipSandboxChannelResponse.getEnabled(), ENABLED_BINDING);<NEW_LINE>protocolMarshaller.marshall(aPNSVoipSandboxChannelResponse.getHasCredential(), HASCREDENTIAL_BINDING);<NEW_LINE>protocolMarshaller.marshall(aPNSVoipSandboxChannelResponse.getHasTokenKey(), HASTOKENKEY_BINDING);<NEW_LINE>protocolMarshaller.marshall(aPNSVoipSandboxChannelResponse.getId(), ID_BINDING);<NEW_LINE>protocolMarshaller.marshall(aPNSVoipSandboxChannelResponse.getIsArchived(), ISARCHIVED_BINDING);<NEW_LINE>protocolMarshaller.marshall(aPNSVoipSandboxChannelResponse.getLastModifiedBy(), LASTMODIFIEDBY_BINDING);<NEW_LINE>protocolMarshaller.marshall(aPNSVoipSandboxChannelResponse.getLastModifiedDate(), LASTMODIFIEDDATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(aPNSVoipSandboxChannelResponse.getVersion(), VERSION_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | aPNSVoipSandboxChannelResponse.getPlatform(), PLATFORM_BINDING); |
554,692 | @PutMapping(value = "/app-repository/app-definitions/{appDefinitionId}", produces = "application/json")<NEW_LINE>public AppDefinitionResponse executeAppDefinitionAction(@ApiParam(name = "appDefinitionId") @PathVariable String appDefinitionId, @ApiParam(required = true) @RequestBody AppDefinitionActionRequest actionRequest, HttpServletRequest request) {<NEW_LINE>if (actionRequest == null) {<NEW_LINE>throw new FlowableIllegalArgumentException("No action found in request body.");<NEW_LINE>}<NEW_LINE>AppDefinition appDefinition = appRepositoryService.getAppDefinition(appDefinitionId);<NEW_LINE>if (appDefinition == null) {<NEW_LINE>throw new FlowableObjectNotFoundException("Could not find an app definition with id '" + appDefinitionId + "'.", AppDefinition.class);<NEW_LINE>}<NEW_LINE>if (restApiInterceptor != null) {<NEW_LINE>restApiInterceptor.accessAppDefinitionInfoById(appDefinition);<NEW_LINE>}<NEW_LINE>if (actionRequest.getCategory() != null) {<NEW_LINE>// Update of category required<NEW_LINE>appRepositoryService.setAppDefinitionCategory(appDefinition.getId(), actionRequest.getCategory());<NEW_LINE>// No need to re-fetch the AppDefinition entity, just update category in response<NEW_LINE>AppDefinitionResponse response = appRestResponseFactory.createAppDefinitionResponse(appDefinition);<NEW_LINE>response.setCategory(actionRequest.getCategory());<NEW_LINE>return response;<NEW_LINE>}<NEW_LINE>throw new FlowableIllegalArgumentException("Invalid action: '" + <MASK><NEW_LINE>} | actionRequest.getAction() + "'."); |
677,122 | public void jimplify1phase2() {<NEW_LINE>String name = "<init>";<NEW_LINE>ArrayList parameters = new ArrayList();<NEW_LINE>ArrayList paramnames = new ArrayList();<NEW_LINE>// this$0<NEW_LINE>TypeDecl typeDecl = hostType();<NEW_LINE>if (typeDecl.needsEnclosing())<NEW_LINE>parameters.add(typeDecl.enclosingType().getSootType());<NEW_LINE>if (typeDecl.needsSuperEnclosing()) {<NEW_LINE>TypeDecl superClass = ((<MASK><NEW_LINE>parameters.add(superClass.enclosingType().getSootType());<NEW_LINE>}<NEW_LINE>// args<NEW_LINE>for (int i = 0; i < getNumParameter(); i++) {<NEW_LINE>parameters.add(getParameter(i).type().getSootType());<NEW_LINE>paramnames.add(getParameter(i).name());<NEW_LINE>}<NEW_LINE>soot.Type returnType = soot.VoidType.v();<NEW_LINE>int modifiers = sootTypeModifiers();<NEW_LINE>ArrayList throwtypes = new ArrayList();<NEW_LINE>for (int i = 0; i < getNumException(); i++) throwtypes.add(getException(i).type().getSootClassDecl());<NEW_LINE>String signature = SootMethod.getSubSignature(name, parameters, returnType);<NEW_LINE>if (!hostType().getSootClassDecl().declaresMethod(signature)) {<NEW_LINE>SootMethod m = Scene.v().makeSootMethod(name, parameters, returnType, modifiers, throwtypes);<NEW_LINE>hostType().getSootClassDecl().addMethod(m);<NEW_LINE>m.addTag(new soot.tagkit.ParamNamesTag(paramnames));<NEW_LINE>sootMethod = m;<NEW_LINE>} else {<NEW_LINE>sootMethod = hostType().getSootClassDecl().getMethod(signature);<NEW_LINE>}<NEW_LINE>addAttributes();<NEW_LINE>} | ClassDecl) typeDecl).superclass(); |
691,803 | public Xid[] recover(int flag) throws XAException {<NEW_LINE>System.out.println("recover(" + _key + ", " + flag + ")");<NEW_LINE>if (self() == null) {<NEW_LINE>if (DEBUG_OUTPUT)<NEW_LINE>System.out.println("No XARecoveryData - returning null xid array");<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>System.out.println("XAResource state in recover(): " + self());<NEW_LINE>_XAEvents.add(new XAEvent(XAEventCode.RECOVER, _key));<NEW_LINE>final int recoverAction <MASK><NEW_LINE>if (recoverAction != XAResource.XA_OK) {<NEW_LINE>final int repeatCount = self().getRecoverRepeatCount();<NEW_LINE>self().setRecoverRepeatCount(repeatCount - 1);<NEW_LINE>if (repeatCount > 0) {<NEW_LINE>switch(recoverAction) {<NEW_LINE>case RUNTIME_EXCEPTION:<NEW_LINE>throw new RuntimeException();<NEW_LINE>case DIE:<NEW_LINE>killDoomedServers(true);<NEW_LINE>default:<NEW_LINE>throw new XAException(recoverAction);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>setState(RECOVERED);<NEW_LINE>if (self().inState(PREPARED) && !self().inState(COMMITTED) && !self().inState(ROLLEDBACK)) {<NEW_LINE>return new Xid[] { getXid() };<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | = self().getRecoverAction(); |
754,276 | public static void average(InterleavedS8 from, GrayS8 to) {<NEW_LINE>final int numBands = from.getNumBands();<NEW_LINE>if (numBands == 1) {<NEW_LINE>for (int y = 0; y < from.height; y++) {<NEW_LINE>int indexFrom = from.getIndex(0, y);<NEW_LINE>int indexTo = to.getIndex(0, y);<NEW_LINE>System.arraycopy(from.data, indexFrom, to.data, indexTo, from.width);<NEW_LINE>}<NEW_LINE>} else if (numBands == 2) {<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, from.height, y -> {<NEW_LINE>for (int y = 0; y < from.height; y++) {<NEW_LINE>int indexFrom = from.getIndex(0, y);<NEW_LINE>int indexTo = to.getIndex(0, y);<NEW_LINE>int indexEndTo = indexTo + from.width;<NEW_LINE>while (indexTo < indexEndTo) {<NEW_LINE>// for (int x = 0; x < from.width; x++ ) {<NEW_LINE>int sum = from.data[indexFrom++];<NEW_LINE>sum += from.data[indexFrom++];<NEW_LINE>to.data[indexTo++] = (byte) (sum / 2);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} else if (numBands == 3) {<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, from.height, y -> {<NEW_LINE>for (int y = 0; y < from.height; y++) {<NEW_LINE>int indexFrom = from.getIndex(0, y);<NEW_LINE>int indexTo = to.getIndex(0, y);<NEW_LINE>int indexEndTo = indexTo + from.width;<NEW_LINE>while (indexTo < indexEndTo) {<NEW_LINE>// for (int x = 0; x < from.width; x++ ) {<NEW_LINE>int sum = from.data[indexFrom++];<NEW_LINE>sum += from.data[indexFrom++];<NEW_LINE>sum += from.data[indexFrom++];<NEW_LINE>to.data[indexTo++] = (byte) (sum / 3);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} else {<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, from.height, y -> {<NEW_LINE>for (int y = 0; y < from.height; y++) {<NEW_LINE>int indexFrom = from.getIndex(0, y);<NEW_LINE>int indexTo = to.getIndex(0, y);<NEW_LINE>for (int x = 0; x < from.width; x++) {<NEW_LINE>int sum = 0;<NEW_LINE>int indexFromEnd = indexFrom + numBands;<NEW_LINE>while (indexFrom < indexFromEnd) {<NEW_LINE>sum <MASK><NEW_LINE>}<NEW_LINE>to.data[indexTo++] = (byte) (sum / numBands);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>}<NEW_LINE>} | += from.data[indexFrom++]; |
12,457 | public String handleRequest(String uri, String content, HttpResponse output) {<NEW_LINE>try (Connection connection = db.getConnection()) {<NEW_LINE>if (connection == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>output.setStatus(HttpResponseStatus.OK);<NEW_LINE>output.headers().set(HttpHeaders.Names.CONTENT_TYPE, "text/plain; charset=UTF-8");<NEW_LINE>output.headers().set(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE);<NEW_LINE>String sql = null;<NEW_LINE>switch(uri) {<NEW_LINE>case "likesong":<NEW_LINE>sql = "UPDATE AUDIOTRACKS set LIKESONG = true where MBID_TRACK = ?";<NEW_LINE>try {<NEW_LINE>PreparedStatement ps = connection.prepareStatement(sql);<NEW_LINE>ps.setString(1, content);<NEW_LINE>ps.executeUpdate();<NEW_LINE>} catch (SQLException e) {<NEW_LINE>LOG.warn("error preparing statement", e);<NEW_LINE>return "ERROR:" + e.getMessage();<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case "likealbum":<NEW_LINE>sql = "MERGE INTO MUSIC_BRAINZ_RELEASE_LIKE KEY (MBID_RELEASE) values (?)";<NEW_LINE>try {<NEW_LINE>PreparedStatement ps = connection.prepareStatement(sql);<NEW_LINE>ps.setString(1, content);<NEW_LINE>ps.executeUpdate();<NEW_LINE>} catch (SQLException e) {<NEW_LINE>LOG.warn("error preparing statement", e);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case "dislikesong":<NEW_LINE>sql = "UPDATE AUDIOTRACKS set LIKESONG = false where MBID_TRACK = ?";<NEW_LINE>try {<NEW_LINE>PreparedStatement ps = connection.prepareStatement(sql);<NEW_LINE>ps.setString(1, content);<NEW_LINE>ps.executeUpdate();<NEW_LINE>} catch (SQLException e) {<NEW_LINE>LOG.warn("error preparing statement", e);<NEW_LINE>return "ERROR:" + e.getMessage();<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case "dislikealbum":<NEW_LINE>sql = "DELETE FROM MUSIC_BRAINZ_RELEASE_LIKE where MBID_RELEASE = ?";<NEW_LINE>try {<NEW_LINE>PreparedStatement ps = connection.prepareStatement(sql);<NEW_LINE>ps.setString(1, content);<NEW_LINE>ps.executeUpdate();<NEW_LINE>} catch (SQLException e) {<NEW_LINE>LOG.warn("error preparing statement", e);<NEW_LINE>return "ERROR:" + e.getMessage();<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case "isalbumliked":<NEW_LINE>sql = "SELECT COUNT(*) FROM MUSIC_BRAINZ_RELEASE_LIKE where MBID_RELEASE = ?";<NEW_LINE>return Boolean.toString(isCountGreaterZero(sql, connection, content));<NEW_LINE>case "issongliked":<NEW_LINE>sql = "SELECT COUNT(*) FROM AUDIOTRACKS where MBID_TRACK = ?";<NEW_LINE>return Boolean.toString(isCountGreaterZero(sql, connection, content));<NEW_LINE>case "backupLikedAlbums":<NEW_LINE>backupLikedAlbums();<NEW_LINE>return "OK";<NEW_LINE>case "restoreLikedAlbums":<NEW_LINE>restoreLikedAlbums();<NEW_LINE>return "OK";<NEW_LINE>default:<NEW_LINE>output.setStatus(HttpResponseStatus.NOT_FOUND);<NEW_LINE>return "ERROR";<NEW_LINE>}<NEW_LINE>return "ERROR";<NEW_LINE>} catch (SQLException e) {<NEW_LINE>throw new RuntimeException("cannot handle request", e);<NEW_LINE>} catch (FileNotFoundException e) {<NEW_LINE>throw new RuntimeException("backup file not found.", e);<NEW_LINE>}<NEW_LINE>} | return "ERROR:" + e.getMessage(); |
542,278 | static TrieLogLayer readFrom(final RLPInput input) {<NEW_LINE>final TrieLogLayer newLayer = new TrieLogLayer();<NEW_LINE>input.enterList();<NEW_LINE>newLayer.blockHash = Hash.wrap(input.readBytes32());<NEW_LINE>while (!input.isEndOfCurrentList()) {<NEW_LINE>input.enterList();<NEW_LINE>final Address address = Address.readFrom(input);<NEW_LINE>if (input.nextIsNull()) {<NEW_LINE>input.skipNext();<NEW_LINE>} else {<NEW_LINE>input.enterList();<NEW_LINE>final StateTrieAccountValue oldValue = nullOrValue(input, StateTrieAccountValue::readFrom);<NEW_LINE>final StateTrieAccountValue newValue = nullOrValue(input, StateTrieAccountValue::readFrom);<NEW_LINE>input.leaveList();<NEW_LINE>newLayer.accounts.put(address, new BonsaiValue<>(oldValue, newValue));<NEW_LINE>}<NEW_LINE>if (input.nextIsNull()) {<NEW_LINE>input.skipNext();<NEW_LINE>} else {<NEW_LINE>input.enterList();<NEW_LINE>final Bytes oldCode = nullOrValue(input, RLPInput::readBytes);<NEW_LINE>final Bytes newCode = nullOrValue(input, RLPInput::readBytes);<NEW_LINE>input.leaveList();<NEW_LINE>newLayer.code.put(address, new BonsaiValue<>(oldCode, newCode));<NEW_LINE>}<NEW_LINE>if (input.nextIsNull()) {<NEW_LINE>input.skipNext();<NEW_LINE>} else {<NEW_LINE>final Map<Hash, BonsaiValue<UInt256>> <MASK><NEW_LINE>input.enterList();<NEW_LINE>while (!input.isEndOfCurrentList()) {<NEW_LINE>input.enterList();<NEW_LINE>final Hash slotHash = Hash.wrap(input.readBytes32());<NEW_LINE>final UInt256 oldValue = nullOrValue(input, RLPInput::readUInt256Scalar);<NEW_LINE>final UInt256 newValue = nullOrValue(input, RLPInput::readUInt256Scalar);<NEW_LINE>storageChanges.put(slotHash, new BonsaiValue<>(oldValue, newValue));<NEW_LINE>input.leaveList();<NEW_LINE>}<NEW_LINE>input.leaveList();<NEW_LINE>newLayer.storage.put(address, storageChanges);<NEW_LINE>}<NEW_LINE>// TODO add trie nodes<NEW_LINE>// lenient leave list for forward compatible additions.<NEW_LINE>input.leaveListLenient();<NEW_LINE>}<NEW_LINE>input.leaveListLenient();<NEW_LINE>newLayer.freeze();<NEW_LINE>return newLayer;<NEW_LINE>} | storageChanges = new TreeMap<>(); |
1,512,716 | public void leave(DelegateExecution childExecution) {<NEW_LINE>DelegateExecution multiInstanceRootExecution = getMultiInstanceRootExecution(childExecution);<NEW_LINE>int nrOfInstances = getLoopVariable(multiInstanceRootExecution, NUMBER_OF_INSTANCES);<NEW_LINE>int loopCounter = getLoopVariable(childExecution, getCollectionElementIndexVariable()) + 1;<NEW_LINE>int nrOfCompletedInstances = getLoopVariable(multiInstanceRootExecution, NUMBER_OF_COMPLETED_INSTANCES) + 1;<NEW_LINE>int nrOfActiveInstances = getLoopVariable(multiInstanceRootExecution, NUMBER_OF_ACTIVE_INSTANCES);<NEW_LINE>setLoopVariable(multiInstanceRootExecution, NUMBER_OF_COMPLETED_INSTANCES, nrOfCompletedInstances);<NEW_LINE>setLoopVariable(childExecution, getCollectionElementIndexVariable(), loopCounter);<NEW_LINE>logLoopDetails(childExecution, "instance completed", loopCounter, nrOfCompletedInstances, nrOfActiveInstances, nrOfInstances);<NEW_LINE>updateResultCollection(childExecution, multiInstanceRootExecution);<NEW_LINE>Context.getCommandContext().getHistoryManager().recordActivityEnd<MASK><NEW_LINE>callActivityEndListeners(childExecution);<NEW_LINE>if (loopCounter >= nrOfInstances || completionConditionSatisfied(multiInstanceRootExecution)) {<NEW_LINE>propagateLoopDataOutputRefToProcessInstance((ExecutionEntity) multiInstanceRootExecution);<NEW_LINE>removeLocalLoopVariable(childExecution, getCollectionElementIndexVariable());<NEW_LINE>multiInstanceRootExecution.setMultiInstanceRoot(false);<NEW_LINE>multiInstanceRootExecution.setScope(false);<NEW_LINE>multiInstanceRootExecution.setCurrentFlowElement(childExecution.getCurrentFlowElement());<NEW_LINE>Context.getCommandContext().getExecutionEntityManager().deleteChildExecutions((ExecutionEntity) multiInstanceRootExecution, "MI_END");<NEW_LINE>dispatchActivityCompletedEvent(childExecution);<NEW_LINE>super.leave(multiInstanceRootExecution);<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>if (childExecution.getCurrentFlowElement() instanceof SubProcess) {<NEW_LINE>ExecutionEntityManager executionEntityManager = Context.getCommandContext().getExecutionEntityManager();<NEW_LINE>ExecutionEntity executionToContinue = executionEntityManager.createChildExecution((ExecutionEntity) multiInstanceRootExecution);<NEW_LINE>executionToContinue.setCurrentFlowElement(childExecution.getCurrentFlowElement());<NEW_LINE>executionToContinue.setScope(true);<NEW_LINE>setLoopVariable(executionToContinue, getCollectionElementIndexVariable(), loopCounter);<NEW_LINE>executeOriginalBehavior(executionToContinue, loopCounter);<NEW_LINE>} else {<NEW_LINE>executeOriginalBehavior(childExecution, loopCounter);<NEW_LINE>}<NEW_LINE>dispatchActivityCompletedEvent(childExecution);<NEW_LINE>} catch (BpmnError error) {<NEW_LINE>// re-throw business fault so that it can be caught by an Error<NEW_LINE>// Intermediate Event or Error Event Sub-Process in the process<NEW_LINE>throw error;<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new ActivitiException("Could not execute inner activity behavior of multi instance behavior", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ((ExecutionEntity) childExecution, null); |
1,772,675 | public void manualNetworkTrace() throws Exception {<NEW_LINE>byte[] data = "badgerbadgerbadgerbadgerMUSHROOM!".getBytes();<NEW_LINE>// [START perf_manual_network_trace]<NEW_LINE>HttpMetric metric = FirebasePerformance.getInstance().newHttpMetric("https://www.google.com", FirebasePerformance.HttpMethod.GET);<NEW_LINE>final <MASK><NEW_LINE>metric.start();<NEW_LINE>HttpURLConnection conn = (HttpURLConnection) url.openConnection();<NEW_LINE>conn.setDoOutput(true);<NEW_LINE>conn.setRequestProperty("Content-Type", "application/json");<NEW_LINE>try {<NEW_LINE>DataOutputStream outputStream = new DataOutputStream(conn.getOutputStream());<NEW_LINE>outputStream.write(data);<NEW_LINE>} catch (IOException ignored) {<NEW_LINE>}<NEW_LINE>metric.setRequestPayloadSize(data.length);<NEW_LINE>metric.setHttpResponseCode(conn.getResponseCode());<NEW_LINE>printStreamContent(conn.getInputStream());<NEW_LINE>conn.disconnect();<NEW_LINE>metric.stop();<NEW_LINE>// [END perf_manual_network_trace]<NEW_LINE>} | URL url = new URL("https://www.google.com"); |
1,287,476 | public static void main(String[] args) {<NEW_LINE>ArrayList<Integer> v = new ArrayList<>();<NEW_LINE>v.add(10);<NEW_LINE>v.add(7);<NEW_LINE>v.add(2);<NEW_LINE>v.add(15);<NEW_LINE>v.add(4);<NEW_LINE>// sort descending with vector<NEW_LINE>Collections.sort(v);<NEW_LINE>// if we want to modify comparison function, use the overloaded method: Collections.sort(List list, Comparator c);<NEW_LINE>Collections.reverse(v);<NEW_LINE><MASK><NEW_LINE>System.out.printf("==================\n");<NEW_LINE>// shuffle the content again<NEW_LINE>Collections.shuffle(v);<NEW_LINE>System.out.println(v);<NEW_LINE>System.out.printf("==================\n");<NEW_LINE>// sort ascending<NEW_LINE>Collections.sort(v);<NEW_LINE>System.out.println(v);<NEW_LINE>System.out.printf("==================\n");<NEW_LINE>ArrayList<team> nus = new ArrayList<>();<NEW_LINE>nus.add(new team(1, 1, 10));<NEW_LINE>nus.add(new team(2, 3, 60));<NEW_LINE>nus.add(new team(3, 1, 20));<NEW_LINE>nus.add(new team(4, 3, 60));<NEW_LINE>// without sorting, they will be ranked like this:<NEW_LINE>for (int i = 0; i < 4; ++i) System.out.println(nus.get(i));<NEW_LINE>// sort using a comparison function<NEW_LINE>Collections.sort(nus);<NEW_LINE>System.out.printf("==================\n");<NEW_LINE>// after sorting using ICPC rule, they will be ranked like this:<NEW_LINE>for (int i = 0; i < 4; ++i) System.out.println(nus.get(i));<NEW_LINE>System.out.printf("==================\n");<NEW_LINE>int pos = Collections.binarySearch(v, 7);<NEW_LINE>System.out.println("Trying to search for 7 in v, found at index = " + pos);<NEW_LINE>pos = Collections.binarySearch(v, 77);<NEW_LINE>// output is -5 (explanation below)<NEW_LINE>System.out.println("Trying to search for 77 in v, found at index = " + pos);<NEW_LINE>// sometimes these two useful simple macros are used<NEW_LINE>System.out.printf("min(10, 7) = %d\n", Math.min(10, 7));<NEW_LINE>System.out.printf("max(10, 7) = %d\n", Math.max(10, 7));<NEW_LINE>} | System.out.println(v); |
1,149,368 | private void initializeXTools() {<NEW_LINE>System.out.println("Initializing XTools...");<NEW_LINE>ClientConfig config = new ClientConfig(ClientRole.Primary);<NEW_LINE>config.SetServerAddress("osserver.redmond.corp.microsoft.com");<NEW_LINE>_myMgr = SharingManager.Create(config);<NEW_LINE>if (_myMgr != null) {<NEW_LINE>_onSightConnection = _myMgr.GetServerConnection();<NEW_LINE>// _rootObject = new SyncRoot(_myMgr.GetRootSyncObject());<NEW_LINE>_sessionMgrListener = new MSliverSessionManagerListener();<NEW_LINE>_myMgr.GetSessionManager().AddListener(_sessionMgrListener);<NEW_LINE>final PairingListener pairingListener = new PairingListener() {<NEW_LINE><NEW_LINE>public void PairingConnectionSucceeded() {<NEW_LINE>System.out.println("********* INCOMING CONNECTION SUCCEEDED *********");<NEW_LINE>}<NEW_LINE><NEW_LINE>public void PairingConnectionFailed(PairingResult reason) {<NEW_LINE>System.out.println("********* INCOMING CONNECTION FAILED *********");<NEW_LINE>}<NEW_LINE>};<NEW_LINE>_networkListener = new NetworkConnectionListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void OnDisconnected(NetworkConnection connection) {<NEW_LINE>System.out.println("Begin pairing again");<NEW_LINE>_myMgr.GetPairingManager().BeginPairing<MASK><NEW_LINE>}<NEW_LINE>};<NEW_LINE>_myMgr.GetPairingManager().BeginPairing(new DirectPairReceiver(), pairingListener);<NEW_LINE>_myMgr.GetPairedConnection().AddListener((byte) MessageID.StatusOnly.swigValue(), _networkListener);<NEW_LINE>}<NEW_LINE>System.gc();<NEW_LINE>} | (new DirectPairReceiver(), pairingListener); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.