idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,197,771 | public Set<String> prune(BrokerRequest brokerRequest, Set<String> segments) {<NEW_LINE>PinotQuery pinotQuery = brokerRequest.getPinotQuery();<NEW_LINE>if (pinotQuery != null) {<NEW_LINE>// SQL<NEW_LINE>Expression filterExpression = pinotQuery.getFilterExpression();<NEW_LINE>if (filterExpression == null) {<NEW_LINE>return segments;<NEW_LINE>}<NEW_LINE>Set<String> selectedSegments = new HashSet<>();<NEW_LINE>for (String segment : segments) {<NEW_LINE>PartitionInfo partitionInfo = _partitionInfoMap.get(segment);<NEW_LINE>if (partitionInfo == null || partitionInfo == INVALID_PARTITION_INFO || isPartitionMatch(filterExpression, partitionInfo)) {<NEW_LINE>selectedSegments.add(segment);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return selectedSegments;<NEW_LINE>} else {<NEW_LINE>// PQL<NEW_LINE>FilterQueryTree filterQueryTree = RequestUtils.generateFilterQueryTree(brokerRequest);<NEW_LINE>if (filterQueryTree == null) {<NEW_LINE>return segments;<NEW_LINE>}<NEW_LINE>Set<String> selectedSegments = new HashSet<>();<NEW_LINE>for (String segment : segments) {<NEW_LINE>PartitionInfo <MASK><NEW_LINE>if (partitionInfo == null || partitionInfo == INVALID_PARTITION_INFO || isPartitionMatch(filterQueryTree, partitionInfo)) {<NEW_LINE>selectedSegments.add(segment);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return selectedSegments;<NEW_LINE>}<NEW_LINE>} | partitionInfo = _partitionInfoMap.get(segment); |
1,774,395 | public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block) {<NEW_LINE>if (block.isGiven()) {<NEW_LINE>Object target = unwrapIfJavaProxy(self);<NEW_LINE>RubyProc proc = RubyProc.newProc(context.runtime, block, block.type);<NEW_LINE>JavaMethod method = (JavaMethod) findCallableArityFour(self, name, <MASK><NEW_LINE>final Class<?>[] paramTypes = method.getParameterTypes();<NEW_LINE>Object cArg0 = arg0.toJava(paramTypes[0]);<NEW_LINE>Object cArg1 = arg1.toJava(paramTypes[1]);<NEW_LINE>Object cArg2 = arg2.toJava(paramTypes[2]);<NEW_LINE>Object cArg3 = proc.toJava(paramTypes[3]);<NEW_LINE>return method.invokeDirect(context, target, cArg0, cArg1, cArg2, cArg3);<NEW_LINE>}<NEW_LINE>return call(context, self, clazz, name, arg0, arg1, arg2);<NEW_LINE>} | arg0, arg1, arg2, proc); |
1,490,040 | public void install(Addon addon) throws MarketplaceHandlerException {<NEW_LINE>try {<NEW_LINE>String jsonDownloadUrl = (String) addon.getProperties().get(JSON_DOWNLOAD_URL_PROPERTY);<NEW_LINE>String yamlDownloadUrl = (String) addon.getProperties().get(YAML_DOWNLOAD_URL_PROPERTY);<NEW_LINE>String jsonContent = (String) addon.getProperties().get(JSON_CONTENT_PROPERTY);<NEW_LINE>String yamlContent = (String) addon.getProperties().get(YAML_CONTENT_PROPERTY);<NEW_LINE>if (jsonDownloadUrl != null) {<NEW_LINE>marketplaceRuleTemplateProvider.addTemplateAsJSON(addon.getId(), getTemplateFromURL(jsonDownloadUrl));<NEW_LINE>} else if (yamlDownloadUrl != null) {<NEW_LINE>marketplaceRuleTemplateProvider.addTemplateAsYAML(addon.getId(), getTemplateFromURL(yamlDownloadUrl));<NEW_LINE>} else if (jsonContent != null) {<NEW_LINE>marketplaceRuleTemplateProvider.addTemplateAsJSON(addon.getId(), jsonContent);<NEW_LINE>} else if (yamlContent != null) {<NEW_LINE>marketplaceRuleTemplateProvider.addTemplateAsYAML(addon.getId(), yamlContent);<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>logger.error("Rule template from marketplace cannot be downloaded: {}", e.getMessage());<NEW_LINE>throw new MarketplaceHandlerException("Template cannot be downloaded.", e);<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.error("Rule template from marketplace is invalid: {}", e.getMessage());<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | throw new MarketplaceHandlerException("Template is not valid.", e); |
979,693 | protected ExecutableDdlJob doCreate() {<NEW_LINE>ValidateGsiExistenceTask validateTask = new ValidateGsiExistenceTask(schemaName, primaryTableName, indexTableName, null, null);<NEW_LINE>List<DdlTask> taskList = new ArrayList<>();<NEW_LINE>// 1. validate<NEW_LINE>taskList.add(validateTask);<NEW_LINE>// 2. GSI status: public -> write_only -> delete_only -> absent<NEW_LINE>if (!skipSchemaChange) {<NEW_LINE>List<DdlTask> bringDownTasks = GsiTaskFactory.dropGlobalIndexTasks(schemaName, primaryTableName, indexTableName);<NEW_LINE>taskList.addAll(bringDownTasks);<NEW_LINE>}<NEW_LINE>// remove indexes meta for primary table<NEW_LINE>GsiDropCleanUpTask gsiDropCleanUpTask = new GsiDropCleanUpTask(schemaName, primaryTableName, indexTableName);<NEW_LINE>taskList.add(gsiDropCleanUpTask);<NEW_LINE>TableSyncTask tableSyncTaskAfterCleanUpGsiIndexesMeta = new TableSyncTask(schemaName, primaryTableName);<NEW_LINE>taskList.add(tableSyncTaskAfterCleanUpGsiIndexesMeta);<NEW_LINE>// drop gsi physical table<NEW_LINE>DropGsiPhyDdlTask dropGsiPhyDdlTask = new DropGsiPhyDdlTask(schemaName, primaryTableName, indexTableName);<NEW_LINE>taskList.add(dropGsiPhyDdlTask);<NEW_LINE>// table status: public -> absent<NEW_LINE>DropGsiTableRemoveMetaTask dropGsiTableRemoveTableMetaTask = new DropGsiTableRemoveMetaTask(schemaName, primaryTableName, indexTableName);<NEW_LINE>taskList.add(dropGsiTableRemoveTableMetaTask);<NEW_LINE>// 4. sync after drop table<NEW_LINE>TablesSyncTask dropTableSyncTask = new TablesSyncTask(schemaName, Lists.newArrayList(primaryTableName, indexTableName));<NEW_LINE>taskList.add(dropTableSyncTask);<NEW_LINE><MASK><NEW_LINE>executableDdlJob.addSequentialTasks(taskList);<NEW_LINE>// todo delete me<NEW_LINE>executableDdlJob.labelAsHead(validateTask);<NEW_LINE>executableDdlJob.labelAsTail(dropTableSyncTask);<NEW_LINE>executableDdlJob.labelTask(HIDE_TABLE_TASK, dropGsiTableRemoveTableMetaTask);<NEW_LINE>executableDdlJob.setValidateTask(validateTask);<NEW_LINE>// executableDdlJob.setBringDownTaskList();<NEW_LINE>executableDdlJob.setGsiDropCleanUpTask(gsiDropCleanUpTask);<NEW_LINE>executableDdlJob.setTableSyncTaskAfterCleanUpGsiIndexesMeta(tableSyncTaskAfterCleanUpGsiIndexesMeta);<NEW_LINE>executableDdlJob.setDropGsiPhyDdlTask(dropGsiPhyDdlTask);<NEW_LINE>executableDdlJob.setDropGsiTableRemoveMetaTask(dropGsiTableRemoveTableMetaTask);<NEW_LINE>executableDdlJob.setFinalSyncTask(dropTableSyncTask);<NEW_LINE>return executableDdlJob;<NEW_LINE>} | final ExecutableDdlJob4DropGsi executableDdlJob = new ExecutableDdlJob4DropGsi(); |
602,752 | private int hash32(byte[] data) {<NEW_LINE>int n = data.length;<NEW_LINE>// 'm' and 'r' are mixing constants generated offline.<NEW_LINE>// They're not really 'magic', they just happen to work well.<NEW_LINE>int m = 0x5bd1e995;<NEW_LINE>int r = 24;<NEW_LINE>// Initialize the hash to a 'random' value<NEW_LINE>int h = (seed ^ n);<NEW_LINE>// Mix 4 bytes at a time into the hash<NEW_LINE>int i = 0;<NEW_LINE>while (n >= 4) {<NEW_LINE>int <MASK><NEW_LINE>k *= m;<NEW_LINE>// use unsigned shift<NEW_LINE>k ^= k >>> r;<NEW_LINE>k *= m;<NEW_LINE>h *= m;<NEW_LINE>h ^= k;<NEW_LINE>i += 4;<NEW_LINE>n -= 4;<NEW_LINE>}<NEW_LINE>// Handle the last few bytes of the input array<NEW_LINE>if (n == 3) {<NEW_LINE>h ^= Byte.toUnsignedInt(data[i + 2]) << 16;<NEW_LINE>}<NEW_LINE>if (n >= 2) {<NEW_LINE>h ^= Byte.toUnsignedInt(data[i + 1]) << 8;<NEW_LINE>}<NEW_LINE>if (n >= 1) {<NEW_LINE>h ^= Byte.toUnsignedInt(data[i]);<NEW_LINE>h *= m;<NEW_LINE>}<NEW_LINE>// Do a few final mixes of the hash to ensure the last few<NEW_LINE>// bytes are well-incorporated.<NEW_LINE>// use unsigned shift<NEW_LINE>h ^= h >>> 13;<NEW_LINE>h *= m;<NEW_LINE>// use unsigned shift<NEW_LINE>h ^= h >>> 15;<NEW_LINE>return h;<NEW_LINE>} | k = decodeFixed32(data, i); |
1,217,737 | private ImageResource iconForSourceItem(SourceItem sourceItem) {<NEW_LINE>// check for bookdown xref<NEW_LINE>if (sourceItem.hasXRef()) {<NEW_LINE>XRef xref = sourceItem.getXRef();<NEW_LINE>ImageResource icon = iconForXRef(xref);<NEW_LINE>if (icon != null)<NEW_LINE>return icon;<NEW_LINE>}<NEW_LINE>// compute image<NEW_LINE>ImageResource image = null;<NEW_LINE>switch(sourceItem.getType()) {<NEW_LINE>case SourceItem.FUNCTION:<NEW_LINE>image = new ImageResource2x(StandardIcons.INSTANCE.functionLetter2x());<NEW_LINE>break;<NEW_LINE>case SourceItem.METHOD:<NEW_LINE>image = new ImageResource2x(<MASK><NEW_LINE>break;<NEW_LINE>case SourceItem.CLASS:<NEW_LINE>image = new ImageResource2x(CodeIcons.INSTANCE.clazz2x());<NEW_LINE>break;<NEW_LINE>case SourceItem.ENUM:<NEW_LINE>image = new ImageResource2x(CodeIcons.INSTANCE.enumType2x());<NEW_LINE>break;<NEW_LINE>case SourceItem.ENUM_VALUE:<NEW_LINE>image = new ImageResource2x(CodeIcons.INSTANCE.enumValue2x());<NEW_LINE>break;<NEW_LINE>case SourceItem.NAMESPACE:<NEW_LINE>image = new ImageResource2x(CodeIcons.INSTANCE.namespace2x());<NEW_LINE>break;<NEW_LINE>case SourceItem.SECTION:<NEW_LINE>image = new ImageResource2x(CodeIcons.INSTANCE.section2x());<NEW_LINE>break;<NEW_LINE>case SourceItem.NONE:<NEW_LINE>default:<NEW_LINE>image = new ImageResource2x(CodeIcons.INSTANCE.keyword2x());<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>return image;<NEW_LINE>} | StandardIcons.INSTANCE.methodLetter2x()); |
817,123 | public List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo, boolean bypassStorageTypeCheck) {<NEW_LINE>List<StoragePool> suitablePools = new ArrayList<StoragePool>();<NEW_LINE><MASK><NEW_LINE>Long podId = plan.getPodId();<NEW_LINE>Long clusterId = plan.getClusterId();<NEW_LINE>if (podId == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>s_logger.debug("Looking for pools in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId);<NEW_LINE>List<StoragePoolVO> pools = storagePoolDao.listBy(dcId, podId, clusterId, ScopeType.CLUSTER);<NEW_LINE>if (pools.size() == 0) {<NEW_LINE>if (s_logger.isDebugEnabled()) {<NEW_LINE>s_logger.debug("No storage pools available for allocation, returning");<NEW_LINE>}<NEW_LINE>return suitablePools;<NEW_LINE>}<NEW_LINE>Collections.shuffle(pools);<NEW_LINE>if (s_logger.isDebugEnabled()) {<NEW_LINE>s_logger.debug("RandomStoragePoolAllocator has " + pools.size() + " pools to check for allocation");<NEW_LINE>}<NEW_LINE>for (StoragePoolVO pool : pools) {<NEW_LINE>if (suitablePools.size() == returnUpTo) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>StoragePool pol = (StoragePool) this.dataStoreMgr.getPrimaryDataStore(pool.getId());<NEW_LINE>if (filter(avoid, pol, dskCh, plan)) {<NEW_LINE>suitablePools.add(pol);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (s_logger.isDebugEnabled()) {<NEW_LINE>s_logger.debug("RandomStoragePoolAllocator returning " + suitablePools.size() + " suitable storage pools");<NEW_LINE>}<NEW_LINE>return suitablePools;<NEW_LINE>} | long dcId = plan.getDataCenterId(); |
556,490 | public void informInsertionStarts(Collection<VehicleRoute> vehicleRoutes, Collection<Job> unassignedJobs) {<NEW_LINE>for (VehicleRoute route : vehicleRoutes) {<NEW_LINE>Break aBreak = route<MASK><NEW_LINE>if (aBreak != null && !route.getTourActivities().servesJob(aBreak)) {<NEW_LINE>if (route.getEnd().getArrTime() > aBreak.getTimeWindow().getEnd()) {<NEW_LINE>InsertionData iData = breakInsertionCalculator.getInsertionData(route, aBreak, route.getVehicle(), route.getDepartureTime(), route.getDriver(), Double.MAX_VALUE);<NEW_LINE>if (!(iData instanceof InsertionData.NoInsertionFound)) {<NEW_LINE>logger.trace("insert: [jobId={}]{}", aBreak.getId(), iData);<NEW_LINE>for (Event e : iData.getEvents()) {<NEW_LINE>eventListeners.inform(e);<NEW_LINE>}<NEW_LINE>stateManager.informJobInserted(aBreak, route, iData);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .getVehicle().getBreak(); |
1,659,015 | synchronized void registerView(View view, Clock clock) {<NEW_LINE>exportedViews = null;<NEW_LINE>View existing = registeredViews.get(view.getName());<NEW_LINE>if (existing != null) {<NEW_LINE>if (existing.equals(view)) {<NEW_LINE>// Ignore views that are already registered.<NEW_LINE>return;<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("A different view with the same name is already registered: " + existing);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Measure measure = view.getMeasure();<NEW_LINE>Measure registeredMeasure = registeredMeasures.get(measure.getName());<NEW_LINE>if (registeredMeasure != null && !registeredMeasure.equals(measure)) {<NEW_LINE>throw new IllegalArgumentException("A different measure with the same name is already registered: " + registeredMeasure);<NEW_LINE>}<NEW_LINE>registeredViews.put(view.getName(), view);<NEW_LINE>if (registeredMeasure == null) {<NEW_LINE>registeredMeasures.put(measure.getName(), measure);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>mutableMap.put(view.getMeasure().getName(), MutableViewData.create(view, now));<NEW_LINE>} | Timestamp now = clock.now(); |
1,393,691 | private static void writeToSigner(Signature signer, VespaUniqueInstanceId providerUniqueId, AthenzService providerService, String configServerHostname, String instanceHostname, Instant createdAt, Set<String> ipAddresses, IdentityType identityType) throws SignatureException {<NEW_LINE>signer.update(providerUniqueId.asDottedString().getBytes(UTF_8));<NEW_LINE>signer.update(providerService.getFullName().getBytes(UTF_8));<NEW_LINE>signer.update(configServerHostname.getBytes(UTF_8));<NEW_LINE>signer.update(instanceHostname.getBytes(UTF_8));<NEW_LINE>ByteBuffer timestampAsBuffer = ByteBuffer.allocate(Long.BYTES);<NEW_LINE>timestampAsBuffer.<MASK><NEW_LINE>signer.update(timestampAsBuffer.array());<NEW_LINE>for (String ipAddress : new TreeSet<>(ipAddresses)) {<NEW_LINE>signer.update(ipAddress.getBytes(UTF_8));<NEW_LINE>}<NEW_LINE>signer.update(identityType.id().getBytes(UTF_8));<NEW_LINE>} | putLong(createdAt.toEpochMilli()); |
568,238 | private ListenableFuture<PageData<AlarmInfo>> fetchAlarmsOriginators(TenantId tenantId, PageData<AlarmInfo> alarms) {<NEW_LINE>List<ListenableFuture<AlarmInfo>> alarmFutures = new ArrayList<>(alarms.getData().size());<NEW_LINE>for (AlarmInfo alarmInfo : alarms.getData()) {<NEW_LINE>alarmFutures.add(Futures.transform(entityService.fetchEntityNameAsync(tenantId, alarmInfo.getOriginator()), originatorName -> {<NEW_LINE>if (originatorName == null) {<NEW_LINE>originatorName = "Deleted";<NEW_LINE>}<NEW_LINE>alarmInfo.setOriginatorName(originatorName);<NEW_LINE>return alarmInfo;<NEW_LINE>}, MoreExecutors.directExecutor()));<NEW_LINE>}<NEW_LINE>return Futures.transform(Futures.successfulAsList(alarmFutures), alarmInfos -> new PageData<>(alarmInfos, alarms.getTotalPages(), alarms.getTotalElements(), alarms.hasNext()<MASK><NEW_LINE>} | ), MoreExecutors.directExecutor()); |
526,382 | private Map<String, String> createMessageDigests(File targetFile) {<NEW_LINE>if (includeMessageDigests.isEmpty()) {<NEW_LINE>return Collections.<String, String>emptyMap();<NEW_LINE>}<NEW_LINE>Map<String, MessageDigest> digests = new HashMap<<MASK><NEW_LINE>for (String messageDigest : includeMessageDigests) {<NEW_LINE>try {<NEW_LINE>digests.put(messageDigest, MessageDigest.getInstance(messageDigest));<NEW_LINE>} catch (NoSuchAlgorithmException ex) {<NEW_LINE>throw new BuildException("Failed to load requested messageDigest: " + messageDigest, ex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try (FileInputStream fis = new FileInputStream(targetFile)) {<NEW_LINE>byte[] buffer = new byte[102400];<NEW_LINE>int read;<NEW_LINE>while ((read = fis.read(buffer)) >= 0) {<NEW_LINE>for (MessageDigest md : digests.values()) {<NEW_LINE>md.update(buffer, 0, read);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException ex) {<NEW_LINE>Logger.getLogger(MakeUpdateDesc.class.getName()).log(Level.SEVERE, null, ex);<NEW_LINE>}<NEW_LINE>Map<String, String> result = new HashMap<>();<NEW_LINE>for (Entry<String, MessageDigest> md : digests.entrySet()) {<NEW_LINE>result.put(md.getKey(), hexEncode(md.getValue().digest()));<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | >(includeMessageDigests.size()); |
585,942 | private void buildQueue() {<NEW_LINE>final StatsDReplicator statsDReplicator = createStatsDReplicator();<NEW_LINE>final <MASK><NEW_LINE>serviceBuilder.getRequestQueueBuilder().setUnableToEnqueueHandler(new UnableToEnqueueHandler() {<NEW_LINE><NEW_LINE>public boolean unableToEnqueue(BlockingQueue<Object> queue, String queueName, Object item) {<NEW_LINE>final Logger logger = LoggerFactory.getLogger(StatsDReplicator.class);<NEW_LINE>logger.error("Unable to send method call to StatsDReplicator " + queueName);<NEW_LINE>queue.clear();<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>serviceBuilder.getResponseQueueBuilder().setUnableToEnqueueHandler(new UnableToEnqueueHandler() {<NEW_LINE><NEW_LINE>public boolean unableToEnqueue(BlockingQueue<Object> queue, String queueName, Object item) {<NEW_LINE>final Logger logger = LoggerFactory.getLogger(StatsDReplicator.class);<NEW_LINE>logger.error("Unable to send response from method call from StatsDReplicator " + queueName);<NEW_LINE>queue.clear();<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>serviceBuilder.setServiceObject(statsDReplicator);<NEW_LINE>this.serviceQueue = serviceBuilder.buildAndStartAll();<NEW_LINE>} | ServiceBuilder serviceBuilder = this.getServiceBuilder(); |
511,154 | public void uncaughtException(final Thread thread, final Throwable ex) {<NEW_LINE>File file = getAppPath(EXCEPTION_PATH);<NEW_LINE>try {<NEW_LINE>ByteArrayOutputStream out = new ByteArrayOutputStream();<NEW_LINE>PrintStream printStream = new PrintStream(out);<NEW_LINE>ex.printStackTrace(printStream);<NEW_LINE>StringBuilder msg = new StringBuilder();<NEW_LINE>msg.append("Version ").append(Version.getFullVersion(OsmandApplication.this)).append("\n").append(DateFormat.format("dd.MM.yyyy h:mm:ss", System.currentTimeMillis()));<NEW_LINE>try {<NEW_LINE>PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), 0);<NEW_LINE>if (info != null) {<NEW_LINE>msg.append("\nApk Version : ").append(info.versionName).append(" ").append(info.versionCode);<NEW_LINE>}<NEW_LINE>} catch (Throwable e) {<NEW_LINE>}<NEW_LINE>msg.append("\n").append("Exception occured in thread ").append(thread.toString()).append(" : \n").append(out.toString());<NEW_LINE>if (file.getParentFile().canWrite()) {<NEW_LINE>BufferedWriter writer = new BufferedWriter(new FileWriter(file, true));<NEW_LINE>writer.write(msg.toString());<NEW_LINE>writer.close();<NEW_LINE>}<NEW_LINE>if (routingHelper.isFollowingMode()) {<NEW_LINE>AlarmManager mgr = (AlarmManager) getSystemService(Context.ALARM_SERVICE);<NEW_LINE>if (Build.VERSION.SDK_INT >= 19) {<NEW_LINE>mgr.setExact(AlarmManager.RTC, System.currentTimeMillis() + 2000, intent);<NEW_LINE>} else {<NEW_LINE>mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 2000, intent);<NEW_LINE>}<NEW_LINE>System.exit(2);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>// swallow all exceptions<NEW_LINE>android.util.Log.e(PlatformUtil.TAG, "Exception while handle other exception", e);<NEW_LINE>}<NEW_LINE>} | defaultHandler.uncaughtException(thread, ex); |
720,976 | public JWSHeader convert(JoseHeader headers) {<NEW_LINE>JWSHeader.Builder builder = new JWSHeader.Builder(JWSAlgorithm.parse(headers.getAlgorithm().getName()));<NEW_LINE>if (headers.getJwkSetUrl() != null) {<NEW_LINE>builder.jwkURL(convertAsURI(JoseHeaderNames.JKU, headers.getJwkSetUrl()));<NEW_LINE>}<NEW_LINE>Map<String, Object> jwk = headers.getJwk();<NEW_LINE>if (!CollectionUtils.isEmpty(jwk)) {<NEW_LINE>try {<NEW_LINE>builder.jwk(JWK.parse(jwk));<NEW_LINE>} catch (Exception ex) {<NEW_LINE>throw new JwtEncodingException(String.format(ENCODING_ERROR_MESSAGE_TEMPLATE, "Unable to convert '" + JoseHeaderNames<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>String keyId = headers.getKeyId();<NEW_LINE>if (StringUtils.hasText(keyId)) {<NEW_LINE>builder.keyID(keyId);<NEW_LINE>}<NEW_LINE>if (headers.getX509Url() != null) {<NEW_LINE>builder.x509CertURL(convertAsURI(JoseHeaderNames.X5U, headers.getX509Url()));<NEW_LINE>}<NEW_LINE>List<String> x509CertificateChain = headers.getX509CertificateChain();<NEW_LINE>if (!CollectionUtils.isEmpty(x509CertificateChain)) {<NEW_LINE>List<Base64> x5cList = new ArrayList<>();<NEW_LINE>x509CertificateChain.forEach((x5c) -> x5cList.add(new Base64(x5c)));<NEW_LINE>if (!x5cList.isEmpty()) {<NEW_LINE>builder.x509CertChain(x5cList);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>String x509SHA1Thumbprint = headers.getX509SHA1Thumbprint();<NEW_LINE>if (StringUtils.hasText(x509SHA1Thumbprint)) {<NEW_LINE>builder.x509CertThumbprint(new Base64URL(x509SHA1Thumbprint));<NEW_LINE>}<NEW_LINE>String x509SHA256Thumbprint = headers.getX509SHA256Thumbprint();<NEW_LINE>if (StringUtils.hasText(x509SHA256Thumbprint)) {<NEW_LINE>builder.x509CertSHA256Thumbprint(new Base64URL(x509SHA256Thumbprint));<NEW_LINE>}<NEW_LINE>String type = headers.getType();<NEW_LINE>if (StringUtils.hasText(type)) {<NEW_LINE>builder.type(new JOSEObjectType(type));<NEW_LINE>}<NEW_LINE>String contentType = headers.getContentType();<NEW_LINE>if (StringUtils.hasText(contentType)) {<NEW_LINE>builder.contentType(contentType);<NEW_LINE>}<NEW_LINE>Set<String> critical = headers.getCritical();<NEW_LINE>if (!CollectionUtils.isEmpty(critical)) {<NEW_LINE>builder.criticalParams(critical);<NEW_LINE>}<NEW_LINE>Map<String, Object> customHeaders = new HashMap<>();<NEW_LINE>headers.getHeaders().forEach((name, value) -> {<NEW_LINE>if (!JWSHeader.getRegisteredParameterNames().contains(name)) {<NEW_LINE>customHeaders.put(name, value);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>if (!customHeaders.isEmpty()) {<NEW_LINE>builder.customParams(customHeaders);<NEW_LINE>}<NEW_LINE>return builder.build();<NEW_LINE>} | .JWK + "' JOSE header"), ex); |
685,041 | public void enterSs_server(A10Parser.Ss_serverContext ctx) {<NEW_LINE>Optional<String> maybeName = toString(ctx, ctx.slb_server_name());<NEW_LINE>if (!maybeName.isPresent()) {<NEW_LINE>// dummy<NEW_LINE>_currentServer = new Server(ctx.slb_server_name().getText(), new ServerTargetAddress(Ip.ZERO));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String name = maybeName.get();<NEW_LINE>if (ctx.slb_server_target() == null) {<NEW_LINE>_currentServer = _c.getServers().get(name);<NEW_LINE>// No match<NEW_LINE>if (_currentServer == null) {<NEW_LINE>warn(ctx, "Server target must be specified for a new server");<NEW_LINE>// dummy<NEW_LINE>_currentServer = new Server(ctx.slb_server_name().getText(), new ServerTargetAddress(Ip.ZERO));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Updating existing server<NEW_LINE>_c.<MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// TODO enforce no target reuse<NEW_LINE>Optional<ServerTarget> target = toServerTarget(ctx.slb_server_target());<NEW_LINE>_c.defineStructure(SERVER, name, ctx);<NEW_LINE>if (target.isPresent()) {<NEW_LINE>_currentServer = _c.getServers().computeIfAbsent(name, n -> new Server(n, target.get()));<NEW_LINE>// Make sure target is up-to-date<NEW_LINE>_currentServer.setTarget(target.get());<NEW_LINE>} else {<NEW_LINE>// dummy for internal fields<NEW_LINE>_currentServer = new Server("~dummy~", new ServerTargetAddress(Ip.ZERO));<NEW_LINE>}<NEW_LINE>} | defineStructure(SERVER, name, ctx); |
1,121,204 | private ClientSideSlbConfig createConfig(Clock clock, BuckEventBus eventBus) {<NEW_LINE>ImmutableClientSideSlbConfig.Builder configBuilder = ImmutableClientSideSlbConfig.builder().setServerPoolName("buckconfig_" + parentSection).setClock(clock).setServerPool(getServerPool<MASK><NEW_LINE>if (buckConfig.getValue(parentSection, PING_ENDPOINT).isPresent()) {<NEW_LINE>configBuilder.setPingEndpoint(buckConfig.getValue(parentSection, PING_ENDPOINT).get());<NEW_LINE>}<NEW_LINE>if (buckConfig.getValue(parentSection, TIMEOUT_MILLIS).isPresent()) {<NEW_LINE>configBuilder.setConnectionTimeoutMillis(buckConfig.getLong(parentSection, TIMEOUT_MILLIS).get().intValue());<NEW_LINE>}<NEW_LINE>if (buckConfig.getValue(parentSection, HEALTH_CHECK_INTERVAL_MILLIS).isPresent()) {<NEW_LINE>configBuilder.setHealthCheckIntervalMillis(buckConfig.getLong(parentSection, HEALTH_CHECK_INTERVAL_MILLIS).get().intValue());<NEW_LINE>}<NEW_LINE>if (buckConfig.getValue(parentSection, ERROR_CHECK_TIME_RANGE_MILLIS).isPresent()) {<NEW_LINE>configBuilder.setErrorCheckTimeRangeMillis(buckConfig.getLong(parentSection, ERROR_CHECK_TIME_RANGE_MILLIS).get().intValue());<NEW_LINE>}<NEW_LINE>if (buckConfig.getValue(parentSection, MAX_ACCEPTABLE_LATENCY_MILLIS).isPresent()) {<NEW_LINE>configBuilder.setMaxAcceptableLatencyMillis(buckConfig.getLong(parentSection, MAX_ACCEPTABLE_LATENCY_MILLIS).get().intValue());<NEW_LINE>}<NEW_LINE>if (buckConfig.getValue(parentSection, LATENCY_CHECK_TIME_RANGE_MILLIS).isPresent()) {<NEW_LINE>configBuilder.setLatencyCheckTimeRangeMillis(buckConfig.getLong(parentSection, LATENCY_CHECK_TIME_RANGE_MILLIS).get().intValue());<NEW_LINE>}<NEW_LINE>if (buckConfig.getValue(parentSection, MAX_ERROR_PERCENTAGE).isPresent()) {<NEW_LINE>configBuilder.setMaxErrorPercentage(buckConfig.getFloat(parentSection, MAX_ERROR_PERCENTAGE).get());<NEW_LINE>}<NEW_LINE>if (buckConfig.getValue(parentSection, MIN_SAMPLES_TO_REPORT_ERROR).isPresent()) {<NEW_LINE>configBuilder.setMinSamplesToReportError(buckConfig.getInteger(parentSection, MIN_SAMPLES_TO_REPORT_ERROR).getAsInt());<NEW_LINE>}<NEW_LINE>return configBuilder.build();<NEW_LINE>} | ()).setEventBus(eventBus); |
1,262,735 | public void save(@NonNull final SecurPharmProduct product) {<NEW_LINE>I_M_Securpharm_Productdata_Result record = null;<NEW_LINE>if (product.getId() != null) {<NEW_LINE>record = load(product.getId(), I_M_Securpharm_Productdata_Result.class);<NEW_LINE>}<NEW_LINE>if (record == null) {<NEW_LINE>record = newInstance(I_M_Securpharm_Productdata_Result.class);<NEW_LINE>}<NEW_LINE>record.setIsError(product.isError());<NEW_LINE>record.setLastResultCode(product.getResultCode());<NEW_LINE>record.setLastResultMessage(product.getResultMessage());<NEW_LINE>record.setM_HU_ID(product.getHuId().getRepoId());<NEW_LINE>//<NEW_LINE>// Product data<NEW_LINE>final ProductDetails productDetails = product.getProductDetails();<NEW_LINE>record.setExpirationDate(productDetails != null ? productDetails.getExpirationDate().toTimestamp() : null);<NEW_LINE>record.setLotNumber(productDetails != null ? productDetails.getLot() : null);<NEW_LINE>record.setProductCode(productDetails != null ? productDetails.getProductCode() : null);<NEW_LINE>record.setProductCodeType(productDetails != null ? productDetails.getProductCodeType().name() : null);<NEW_LINE>record.setSerialNumber(productDetails != null ? productDetails.getSerialNumber() : null);<NEW_LINE>record.setActiveStatus(productDetails != null ? productDetails.getActiveStatus().toYesNoString() : null);<NEW_LINE>record.setInactiveReason(productDetails != null ? productDetails.getInactiveReason() : null);<NEW_LINE>record.setIsDecommissioned(productDetails != null ? productDetails.isDecommissioned() : false);<NEW_LINE>record.setDecommissionedServerTransactionId(productDetails != null ? <MASK><NEW_LINE>saveRecord(record);<NEW_LINE>final SecurPharmProductId productId = SecurPharmProductId.ofRepoId(record.getM_Securpharm_Productdata_Result_ID());<NEW_LINE>product.setId(productId);<NEW_LINE>} | productDetails.getDecommissionedServerTransactionId() : null); |
66,900 | public static // '#' '{' config_map_assoc_list? '}'<NEW_LINE>boolean config_map_tuple(PsiBuilder b, int l) {<NEW_LINE>if (!recursion_guard_(b, l, "config_map_tuple"))<NEW_LINE>return false;<NEW_LINE>if (!nextTokenIs(b, ERL_RADIX))<NEW_LINE>return false;<NEW_LINE>boolean r, p;<NEW_LINE>Marker m = enter_section_(b, l, _NONE_, ERL_MAP_TUPLE, null);<NEW_LINE>r = consumeTokens(<MASK><NEW_LINE>// pin = 1<NEW_LINE>p = r;<NEW_LINE>r = r && report_error_(b, config_map_tuple_2(b, l + 1));<NEW_LINE>r = p && consumeToken(b, ERL_CURLY_RIGHT) && r;<NEW_LINE>exit_section_(b, l, m, r, p, null);<NEW_LINE>return r || p;<NEW_LINE>} | b, 1, ERL_RADIX, ERL_CURLY_LEFT); |
453,875 | public void watch(GameEvent event, Game game) {<NEW_LINE>if (event.getType() == GameEvent.EventType.BEGINNING_PHASE_PRE) {<NEW_LINE>UUID activePlayer = game.getActivePlayerId();<NEW_LINE>if (attackedThisTurnCreatures.containsKey(activePlayer)) {<NEW_LINE>if (attackedThisTurnCreatures.get(activePlayer) != null) {<NEW_LINE>attackedLastTurnCreatures.put(activePlayer, getAttackedThisTurnCreatures(activePlayer));<NEW_LINE>}<NEW_LINE>attackedThisTurnCreatures.remove(activePlayer);<NEW_LINE>} else {<NEW_LINE>// } else if (attackedLastTurnCreatures.containsKey(activePlayer)) {<NEW_LINE>attackedLastTurnCreatures.remove(activePlayer);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (event.getType() == GameEvent.EventType.DECLARED_ATTACKERS) {<NEW_LINE>UUID attackingPlayer = game<MASK><NEW_LINE>Set<MageObjectReference> attackingCreatures = getAttackedThisTurnCreatures(attackingPlayer);<NEW_LINE>for (UUID attackerId : game.getCombat().getAttackers()) {<NEW_LINE>Permanent attacker = game.getPermanent(attackerId);<NEW_LINE>if (attacker != null) {<NEW_LINE>attackingCreatures.add(new MageObjectReference(attacker, game));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>attackedThisTurnCreatures.put(attackingPlayer, attackingCreatures);<NEW_LINE>}<NEW_LINE>} | .getCombat().getAttackingPlayerId(); |
545,347 | public CommandRunnerStatus checkCommandRunnerStatus() {<NEW_LINE>if (state.getStatus() == CommandRunnerStatus.DEGRADED) {<NEW_LINE>return CommandRunnerStatus.DEGRADED;<NEW_LINE>}<NEW_LINE>final Pair<QueuedCommand, Instant> currentCommand = currentCommandRef.get();<NEW_LINE>if (currentCommand == null) {<NEW_LINE>state = lastPollTime.get() == null || Duration.between(lastPollTime.get(), clock.instant()).toMillis() < NEW_CMDS_TIMEOUT.toMillis() * 3 ? new Status(CommandRunnerStatus.RUNNING, CommandRunnerDegradedReason.NONE) : new Status(<MASK><NEW_LINE>} else {<NEW_LINE>state = Duration.between(currentCommand.right, clock.instant()).toMillis() < commandRunnerHealthTimeout.toMillis() ? new Status(CommandRunnerStatus.RUNNING, CommandRunnerDegradedReason.NONE) : new Status(CommandRunnerStatus.ERROR, CommandRunnerDegradedReason.NONE);<NEW_LINE>}<NEW_LINE>return state.getStatus();<NEW_LINE>} | CommandRunnerStatus.ERROR, CommandRunnerDegradedReason.NONE); |
847,070 | public void onUserPressedShortcut(@Nonnull Keymap keymap, @Nonnull String[] actionIds, @Nonnull KeyboardShortcut ksc) {<NEW_LINE>if (actionIds.length == 0)<NEW_LINE>return;<NEW_LINE>KeyStroke ks = ksc.getFirstKeyStroke();<NEW_LINE>AWTKeyStroke <MASK><NEW_LINE>if (sysKs == null && ksc.getSecondKeyStroke() != null)<NEW_LINE>sysKs = myKeyStroke2SysShortcut.get(ks = ksc.getSecondKeyStroke());<NEW_LINE>if (sysKs == null)<NEW_LINE>return;<NEW_LINE>String unmutedActId = null;<NEW_LINE>for (String actId : actionIds) {<NEW_LINE>if (myNotifiedActions.contains(actId)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (!myMutedConflicts.isMutedAction(actId)) {<NEW_LINE>unmutedActId = actId;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (unmutedActId == null)<NEW_LINE>return;<NEW_LINE>@Nullable<NEW_LINE>final String macOsShortcutAction = getDescription(sysKs);<NEW_LINE>// System.out.println(actionId + " shortcut '" + sysKS + "' "<NEW_LINE>// + Arrays.toString(actionShortcuts) + " conflicts with macOS shortcut"<NEW_LINE>// + (macOsShortcutAction == null ? "." : " '" + macOsShortcutAction + "'."));<NEW_LINE>doNotify(keymap, unmutedActId, ks, macOsShortcutAction, ksc);<NEW_LINE>} | sysKs = myKeyStroke2SysShortcut.get(ks); |
176,776 | final CreateImageBuilderResult executeCreateImageBuilder(CreateImageBuilderRequest createImageBuilderRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createImageBuilderRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateImageBuilderRequest> request = null;<NEW_LINE>Response<CreateImageBuilderResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateImageBuilderRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createImageBuilderRequest));<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, "AppStream");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateImageBuilder");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateImageBuilderResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(<MASK><NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | false), new CreateImageBuilderResultJsonUnmarshaller()); |
1,565,752 | public void read(org.apache.thrift.protocol.TProtocol iprot, TColumn struct) throws org.apache.thrift.TException {<NEW_LINE>org.apache.thrift.protocol.TField schemeField;<NEW_LINE>iprot.readStructBegin();<NEW_LINE>while (true) {<NEW_LINE>schemeField = iprot.readFieldBegin();<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>switch(schemeField.id) {<NEW_LINE>case // COLUMN_FAMILY<NEW_LINE>1:<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {<NEW_LINE>struct.columnFamily = iprot.readBinary();<NEW_LINE>struct.setColumnFamilyIsSet(true);<NEW_LINE>} else {<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case // COLUMN_QUALIFIER<NEW_LINE>2:<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {<NEW_LINE>struct.columnQualifier = iprot.readBinary();<NEW_LINE>struct.setColumnQualifierIsSet(true);<NEW_LINE>} else {<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.<MASK><NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case // COLUMN_VISIBILITY<NEW_LINE>3:<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {<NEW_LINE>struct.columnVisibility = iprot.readBinary();<NEW_LINE>struct.setColumnVisibilityIsSet(true);<NEW_LINE>} else {<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);<NEW_LINE>}<NEW_LINE>iprot.readFieldEnd();<NEW_LINE>}<NEW_LINE>iprot.readStructEnd();<NEW_LINE>// check for required fields of primitive type, which can't be checked in the validate method<NEW_LINE>struct.validate();<NEW_LINE>} | skip(iprot, schemeField.type); |
410,925 | final SendAutomationSignalResult executeSendAutomationSignal(SendAutomationSignalRequest sendAutomationSignalRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(sendAutomationSignalRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<SendAutomationSignalRequest> request = null;<NEW_LINE>Response<SendAutomationSignalResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new SendAutomationSignalRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(sendAutomationSignalRequest));<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, "SSM");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "SendAutomationSignal");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<SendAutomationSignalResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new SendAutomationSignalResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | endClientExecution(awsRequestMetrics, request, response); |
180,986 | private List<KeyExtent> assignMapFiles(ClientContext context, HostAndPort location, Map<KeyExtent, List<PathSize>> assignmentsPerTablet) throws AccumuloException, AccumuloSecurityException {<NEW_LINE>try {<NEW_LINE>long timeInMillis = context.getConfiguration().getTimeInMillis(Property.TSERV_BULK_TIMEOUT);<NEW_LINE>TabletClientService.Iface client = ThriftUtil.getTServerClient(location, context, timeInMillis);<NEW_LINE>try {<NEW_LINE>HashMap<KeyExtent, Map<String, org.apache.accumulo.core.dataImpl.thrift.MapFileInfo>> files = new HashMap<>();<NEW_LINE>for (Entry<KeyExtent, List<PathSize>> entry : assignmentsPerTablet.entrySet()) {<NEW_LINE>HashMap<String, org.apache.accumulo.core.dataImpl.thrift.MapFileInfo> tabletFiles = new HashMap<>();<NEW_LINE>files.put(entry.getKey(), tabletFiles);<NEW_LINE>for (PathSize pathSize : entry.getValue()) {<NEW_LINE>org.apache.accumulo.core.dataImpl.thrift.MapFileInfo mfi = new org.apache.accumulo.core.dataImpl.thrift.MapFileInfo(pathSize.estSize);<NEW_LINE>tabletFiles.put(pathSize.path.toString(), mfi);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>log.debug("Asking {} to bulk load {}", location, files);<NEW_LINE>List<TKeyExtent> failures = client.bulkImport(TraceUtil.traceInfo(), context.rpcCreds(), tid, files.entrySet().stream().collect(Collectors.toMap(entry -> entry.getKey().toThrift(), Entry::getValue)), setTime);<NEW_LINE>return failures.stream().map(KeyExtent::fromThrift).collect(Collectors.toList());<NEW_LINE>} finally {<NEW_LINE>ThriftUtil.returnClient((TServiceClient) client, context);<NEW_LINE>}<NEW_LINE>} catch (ThriftSecurityException e) {<NEW_LINE>throw new AccumuloSecurityException(e.<MASK><NEW_LINE>} catch (Exception t) {<NEW_LINE>log.error("Encountered unknown exception in assignMapFiles.", t);<NEW_LINE>throw new AccumuloException(t);<NEW_LINE>}<NEW_LINE>} | user, e.code, e); |
1,301,391 | // see VCF spec 4.2 for BND format ALT allele field for SV, in particular the examples shown in Fig.1, Fig.2 and Fig.5 of Section 5.4<NEW_LINE>private static Allele constructAltAllele(final NovelAdjacencyAndAltHaplotype narl, final BasicReference reference, final boolean forUpstreamLoc) {<NEW_LINE>final String refBase = BreakEndVariantType.getRefBaseString(narl, forUpstreamLoc, reference);<NEW_LINE>final String insertedSequence = extractInsertedSequence(narl, forUpstreamLoc);<NEW_LINE>final SimpleInterval novelAdjRefLoc = forUpstreamLoc ? narl.getLeftJustifiedRightRefLoc() : narl.getLeftJustifiedLeftRefLoc();<NEW_LINE>// see Fig.5 of Section 5.4 of spec Version 4.2 (the green pairs)<NEW_LINE>final boolean upstreamLocIsFirstInPartner = narl.getTypeInferredFromSimpleChimera().equals(TypeInferredFromSimpleChimera.INTER_CHR_NO_SS_WITH_LEFT_MATE_FIRST_IN_PARTNER);<NEW_LINE>if (narl.getStrandSwitch().equals(StrandSwitch.NO_SWITCH)) {<NEW_LINE>if (forUpstreamLoc == upstreamLocIsFirstInPartner) {<NEW_LINE>return Allele.create(refBase + insertedSequence + "[" + novelAdjRefLoc.getContig() + ":" + <MASK><NEW_LINE>} else {<NEW_LINE>return Allele.create("]" + novelAdjRefLoc.getContig() + ":" + novelAdjRefLoc.getStart() + "]" + insertedSequence + refBase);<NEW_LINE>}<NEW_LINE>} else if (narl.getStrandSwitch().equals(StrandSwitch.FORWARD_TO_REVERSE)) {<NEW_LINE>return Allele.create(refBase + insertedSequence + "]" + novelAdjRefLoc.getContig() + ":" + novelAdjRefLoc.getEnd() + "]");<NEW_LINE>} else {<NEW_LINE>return Allele.create("[" + novelAdjRefLoc.getContig() + ":" + novelAdjRefLoc.getEnd() + "[" + insertedSequence + refBase);<NEW_LINE>}<NEW_LINE>} | novelAdjRefLoc.getEnd() + "["); |
673,428 | public Concrete.DataDefinition data(@NotNull ArendRef ref, @NotNull Collection<? extends ConcreteParameter> parameters, boolean isTruncated, @Nullable ConcreteLevel pLevel, @Nullable ConcreteLevel hLevel, @NotNull Collection<? extends ConcreteConstructorClause> clauses) {<NEW_LINE>if (!(ref instanceof ConcreteLocatedReferable)) {<NEW_LINE>throw new IllegalArgumentException("The reference must be a global reference with a parent");<NEW_LINE>}<NEW_LINE>List<Concrete.ConstructorClause> constructorClauses = new ArrayList<>(clauses.size());<NEW_LINE>for (ConcreteConstructorClause clause : clauses) {<NEW_LINE>if (!(clause instanceof Concrete.ConstructorClause)) {<NEW_LINE>throw new IllegalArgumentException();<NEW_LINE>}<NEW_LINE>constructorClauses.add<MASK><NEW_LINE>}<NEW_LINE>ConcreteLocatedReferable cRef = (ConcreteLocatedReferable) ref;<NEW_LINE>cRef.setKind(GlobalReferable.Kind.DATA);<NEW_LINE>Concrete.DataDefinition result = new Concrete.DataDefinition(cRef, null, null, typeParameters(parameters), null, isTruncated, pLevel == null && hLevel == null ? null : universe(pLevel, hLevel), constructorClauses);<NEW_LINE>cRef.setDefinition(result);<NEW_LINE>for (Concrete.ConstructorClause clause : constructorClauses) {<NEW_LINE>for (Concrete.Constructor constructor : clause.getConstructors()) {<NEW_LINE>constructor.setDataType(result);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | ((Concrete.ConstructorClause) clause); |
1,285,281 | protected void doPost(HttpServletRequest request, HttpServletResponse response) {<NEW_LINE>try {<NEW_LINE>PostParams params = PostParams.getPostParams(request);<NEW_LINE>String input = params.getParams();<NEW_LINE>boolean visible = params.isVisible();<NEW_LINE>if (visible) {<NEW_LINE>JSONObject jsonObject = JSONObject.parseObject(input);<NEW_LINE>String <MASK><NEW_LINE>jsonObject.put(VALUE, Util.getHexAddress(value));<NEW_LINE>input = jsonObject.toJSONString();<NEW_LINE>}<NEW_LINE>BytesMessage.Builder build = BytesMessage.newBuilder();<NEW_LINE>JsonFormat.merge(input, build, visible);<NEW_LINE>SmartContractDataWrapper smartContract = wallet.getContractInfo(build.build());<NEW_LINE>if (smartContract == null) {<NEW_LINE>response.getWriter().println("{}");<NEW_LINE>} else {<NEW_LINE>JSONObject jsonSmartContract = JSONObject.parseObject(JsonFormat.printToString(smartContract, visible));<NEW_LINE>response.getWriter().println(jsonSmartContract.toJSONString());<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>Util.processError(e, response);<NEW_LINE>}<NEW_LINE>} | value = jsonObject.getString(VALUE); |
1,094,871 | private boolean buildForEach(char[] condition, int start, int offset, int blockStart, int blockEnd, int fields, ParserContext pCtx) {<NEW_LINE>int end = start + offset;<NEW_LINE>int cursor = nextCondPart(condition, start, end, false);<NEW_LINE>boolean varsEscape = false;<NEW_LINE>try {<NEW_LINE>ParserContext spCtx;<NEW_LINE>if (pCtx != null) {<NEW_LINE>spCtx = pCtx.createSubcontext().createColoringSubcontext();<NEW_LINE>} else {<NEW_LINE>spCtx = new ParserContext();<NEW_LINE>}<NEW_LINE>this.initializer = (ExecutableStatement) subCompileExpression(condition, start, cursor - start - 1, spCtx);<NEW_LINE>if (pCtx != null) {<NEW_LINE>pCtx.pushVariableScope();<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>expectType(pCtx, this.condition = (ExecutableStatement) subCompileExpression(condition, start = cursor, (cursor = nextCondPart(condition, start, end, false)) - start - 1, spCtx), Boolean.class, ((<MASK><NEW_LINE>} catch (CompileException e) {<NEW_LINE>if (e.getExpr().length == 0) {<NEW_LINE>e.setExpr(expr);<NEW_LINE>while (start < expr.length && ParseTools.isWhitespace(expr[start])) {<NEW_LINE>start++;<NEW_LINE>}<NEW_LINE>e.setCursor(start);<NEW_LINE>}<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>this.after = (ExecutableStatement) subCompileExpression(condition, start = cursor, (nextCondPart(condition, start, end, true)) - start, spCtx);<NEW_LINE>if (spCtx != null && (fields & COMPILE_IMMEDIATE) != 0 && spCtx.isVariablesEscape()) {<NEW_LINE>if (pCtx != spCtx)<NEW_LINE>pCtx.addVariables(spCtx.getVariables());<NEW_LINE>varsEscape = true;<NEW_LINE>} else if (spCtx != null && pCtx != null) {<NEW_LINE>pCtx.addVariables(spCtx.getVariables());<NEW_LINE>}<NEW_LINE>this.compiledBlock = (ExecutableStatement) subCompileExpression(expr, blockStart, blockEnd, spCtx);<NEW_LINE>if (pCtx != null) {<NEW_LINE>pCtx.setInputs(spCtx.getInputs());<NEW_LINE>}<NEW_LINE>} catch (NegativeArraySizeException e) {<NEW_LINE>throw new CompileException("wrong syntax; did you mean to use 'foreach'?", expr, start);<NEW_LINE>}<NEW_LINE>return varsEscape;<NEW_LINE>} | fields & COMPILE_IMMEDIATE) != 0)); |
1,277,181 | public RExecutorBatchFuture submitAsync(Callable<?>... tasks) {<NEW_LINE>if (tasks.length == 0) {<NEW_LINE>throw new NullPointerException("Tasks are not defined");<NEW_LINE>}<NEW_LINE>TasksBatchService executorRemoteService = createBatchService();<NEW_LINE>RemoteExecutorServiceAsync asyncService = executorRemoteService.get(RemoteExecutorServiceAsync.class, RESULT_OPTIONS);<NEW_LINE>List<RExecutorFuture<?>> result = new ArrayList<>();<NEW_LINE>for (Callable<?> task : tasks) {<NEW_LINE>check(task);<NEW_LINE>RemotePromise<?> promise = (RemotePromise<?>) asyncService.executeCallable(createTaskParameters(task)).toCompletableFuture();<NEW_LINE>RedissonExecutorFuture<?> executorFuture = new RedissonExecutorFuture(promise);<NEW_LINE>result.add(executorFuture);<NEW_LINE>}<NEW_LINE>executorRemoteService.executeAddAsync().whenComplete((res, e) -> {<NEW_LINE>if (e != null) {<NEW_LINE>for (RExecutorFuture<?> executorFuture : result) {<NEW_LINE>executorFuture.toCompletableFuture().completeExceptionally(e);<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>for (Boolean bool : res) {<NEW_LINE>if (!bool) {<NEW_LINE><MASK><NEW_LINE>for (RExecutorFuture<?> executorFuture : result) {<NEW_LINE>executorFuture.toCompletableFuture().completeExceptionally(ex);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>CompletableFuture<Void> future = CompletableFuture.allOf(result.stream().map(CompletionStage::toCompletableFuture).toArray(CompletableFuture[]::new));<NEW_LINE>return new RedissonExecutorBatchFuture(future, result);<NEW_LINE>} | RejectedExecutionException ex = new RejectedExecutionException("Task rejected. ExecutorService is in shutdown state"); |
1,153,377 | public SearchPlaceIndexForTextResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>SearchPlaceIndexForTextResult searchPlaceIndexForTextResult = new SearchPlaceIndexForTextResult();<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 searchPlaceIndexForTextResult;<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("Results", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>searchPlaceIndexForTextResult.setResults(new ListUnmarshaller<SearchForTextResult>(SearchForTextResultJsonUnmarshaller.getInstance(<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("Summary", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>searchPlaceIndexForTextResult.setSummary(SearchPlaceIndexForTextSummaryJsonUnmarshaller.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 searchPlaceIndexForTextResult;<NEW_LINE>} | )).unmarshall(context)); |
621,530 | protected void doOperationRemotely() {<NEW_LINE>String appUrl = ClientProperties.TARGET_URL.replaceAll("^https?://", "");<NEW_LINE>String appDomain = appUrl.split(":")[0];<NEW_LINE>int appPort = appUrl.contains(":") ? Integer.parseInt(appUrl.split(":")[1]) : 443;<NEW_LINE>System.out.println("--- Starting remote operation ---");<NEW_LINE>System.out.println("Going to connect to:" + appDomain + ":" + appPort);<NEW_LINE>DatastoreOptions.Builder builder = DatastoreOptions.newBuilder(<MASK><NEW_LINE>if (ClientProperties.isTargetUrlDevServer()) {<NEW_LINE>builder.setHost(ClientProperties.TARGET_URL);<NEW_LINE>}<NEW_LINE>ObjectifyService.init(new ObjectifyFactory(builder.build().getService()));<NEW_LINE>OfyHelper.registerEntityClasses();<NEW_LINE>try (Closeable objectifySession = ObjectifyService.begin()) {<NEW_LINE>LogicStarter.initializeDependencies();<NEW_LINE>doOperation();<NEW_LINE>}<NEW_LINE>System.out.println("--- Remote operation completed ---");<NEW_LINE>} | ).setProjectId(Config.APP_ID); |
1,496,216 | public synchronized void updateLists(TaskLists remoteLists) {<NEW_LINE>readLists();<NEW_LINE>HashSet<Long> previousLists = new HashSet<Long>(lists.length);<NEW_LINE>for (StoreObject list : lists) previousLists.add(list.getId());<NEW_LINE>List<TaskList> items = remoteLists.getItems();<NEW_LINE>StoreObject[] newLists = new StoreObject[items.size()];<NEW_LINE>for (int i = 0; i < items.size(); i++) {<NEW_LINE>com.google.api.services.tasks.model.TaskList remote = items.get(i);<NEW_LINE>String id = remote.getId();<NEW_LINE>StoreObject local = null;<NEW_LINE>for (StoreObject list : lists) {<NEW_LINE>if (list.getValue(GtasksList.REMOTE_ID).equals(id)) {<NEW_LINE>local = list;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (local == null)<NEW_LINE>local = new StoreObject();<NEW_LINE>local.setValue(StoreObject.TYPE, GtasksList.TYPE);<NEW_LINE>local.setValue(GtasksList.REMOTE_ID, id);<NEW_LINE>local.setValue(GtasksList.<MASK><NEW_LINE>local.setValue(GtasksList.ORDER, i);<NEW_LINE>storeObjectDao.persist(local);<NEW_LINE>previousLists.remove(local.getId());<NEW_LINE>newLists[i] = local;<NEW_LINE>}<NEW_LINE>lists = newLists;<NEW_LINE>// check for lists that aren't on remote server<NEW_LINE>for (Long listId : previousLists) {<NEW_LINE>storeObjectDao.delete(listId);<NEW_LINE>}<NEW_LINE>} | NAME, remote.getTitle()); |
1,089,167 | public void run(RegressionEnvironment env) {<NEW_LINE>String epl = "module test;\n" + "@name('event') @public @buseventtype @public create map schema Fubar as (foo string, bar double);\n" + "@name('window') @protected create window Snafu#keepall as Fubar;\n" + "@name('insert') @private insert into Snafu select * from Fubar;\n";<NEW_LINE>env.compileDeploy(epl);<NEW_LINE>env.sendEventMap(CollectionUtil.buildMap("foo", "a"<MASK><NEW_LINE>env.sendEventMap(CollectionUtil.buildMap("foo", "b", "bar", 2d), "Fubar");<NEW_LINE>env.assertPropsPerRowIterator("window", "foo,bar".split(","), new Object[][] { { "a", 1d }, { "b", 2d } });<NEW_LINE>env.undeployAll();<NEW_LINE>} | , "bar", 1d), "Fubar"); |
761,373 | private boolean targetOnlyCallsNoReturn(Program cp, Address target, AddressSet noReturnSet) throws CancelledException {<NEW_LINE>SimpleBlockModel model = new SimpleBlockModel(cp);<NEW_LINE>// follow the flow of the instructions<NEW_LINE>// if hit return, then no good<NEW_LINE>// if hit call, check noReturn, if is stop following<NEW_LINE>// if hit place that is called, then stop, and return no-good<NEW_LINE>Stack<Address> todo = new Stack<>();<NEW_LINE>todo.push(target);<NEW_LINE>AddressSet visited = new AddressSet();<NEW_LINE>boolean hitNoReturn = false;<NEW_LINE>while (!todo.isEmpty()) {<NEW_LINE>Address blockAddr = todo.pop();<NEW_LINE>CodeBlock block = model.getCodeBlockAt(blockAddr, monitor);<NEW_LINE>if (block == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (visited.contains(blockAddr)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>visited.add(blockAddr);<NEW_LINE>FlowType flowType = block.getFlowType();<NEW_LINE>// terminal block and not a Call_Return that must be checked<NEW_LINE>if (flowType.isTerminal() && !flowType.isCall()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// if target has a call to it, then can't tell, but suspect...<NEW_LINE>// add all destinations to todo<NEW_LINE>CodeBlockReferenceIterator destinations = block.getDestinations(monitor);<NEW_LINE>// no destinations<NEW_LINE>if (!destinations.hasNext()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>while (destinations.hasNext()) {<NEW_LINE>CodeBlockReference destRef = destinations.next();<NEW_LINE>Address destAddr = destRef.getReference();<NEW_LINE><MASK><NEW_LINE>// check call or jump to non-returning destination<NEW_LINE>if (destFlowType.isCall() || destFlowType.isJump()) {<NEW_LINE>// check target<NEW_LINE>// if non-Return, set-hit no return, and continue;<NEW_LINE>if (noReturnSet.contains(destAddr)) {<NEW_LINE>hitNoReturn = true;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Function func = cp.getFunctionManager().getFunctionAt(destAddr);<NEW_LINE>if (func != null && func.hasNoReturn()) {<NEW_LINE>hitNoReturn = true;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// hit terminal with returning call (could be a JUMP as well)<NEW_LINE>if (flowType.isTerminal() && (destFlowType.isCall() || func != null)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (destFlowType.isCall()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// indirect flows are not part of the function<NEW_LINE>if (destFlowType.isIndirect()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>todo.push(destAddr);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return hitNoReturn;<NEW_LINE>} | FlowType destFlowType = destRef.getFlowType(); |
904,240 | private void detectLandmarksInImages() {<NEW_LINE>// Remove the previously displayed images<NEW_LINE>SwingUtilities.invokeLater(() -> imageListPanel.clearImages());<NEW_LINE>int numStereoPairs;<NEW_LINE>synchronized (lockInput) {<NEW_LINE>if (inputImages == null)<NEW_LINE>return;<NEW_LINE>numStereoPairs = inputImages.size();<NEW_LINE>}<NEW_LINE>algorithms.calibrationSuccess = false;<NEW_LINE>results.reset();<NEW_LINE>GrayF32 image = new GrayF32(1, 1);<NEW_LINE>for (int imageIdx = 0; imageIdx < numStereoPairs; imageIdx++) {<NEW_LINE>CalibrationObservation calibLeft, calibRight;<NEW_LINE>BufferedImage buffLeft, buffRight;<NEW_LINE>String imageName, imageRight;<NEW_LINE>// Load the image<NEW_LINE>synchronized (lockInput) {<NEW_LINE>inputImages.setSelected(imageIdx);<NEW_LINE>buffLeft = inputImages.loadLeft();<NEW_LINE>buffRight = inputImages.loadRight();<NEW_LINE>imageName = inputImages.getLeftName();<NEW_LINE>imageRight = inputImages.getRightName();<NEW_LINE>// we use the left image to identify the stereo pair<NEW_LINE>}<NEW_LINE>// Detect calibration landmarks<NEW_LINE>ConvertBufferedImage.convertFrom(buffLeft, image);<NEW_LINE>calibLeft = algorithms.select(() -> {<NEW_LINE>algorithms.detector.process(image);<NEW_LINE>return algorithms.detector.getDetectedPoints();<NEW_LINE>});<NEW_LINE>// Order matters for visualization later on<NEW_LINE>Collections.sort(calibLeft.points, Comparator.comparingInt(a -> a.index));<NEW_LINE>// see if at least one view was able to use this target<NEW_LINE>boolean used = results.select(() -> results.left<MASK><NEW_LINE>ConvertBufferedImage.convertFrom(buffRight, image);<NEW_LINE>calibRight = algorithms.select(() -> {<NEW_LINE>algorithms.detector.process(image);<NEW_LINE>return algorithms.detector.getDetectedPoints();<NEW_LINE>});<NEW_LINE>Collections.sort(calibRight.points, Comparator.comparingInt(a -> a.index));<NEW_LINE>used |= results.select(() -> results.right.add(imageName, calibRight));<NEW_LINE>boolean _used = used;<NEW_LINE>results.safe(() -> {<NEW_LINE>results.used.add(_used);<NEW_LINE>results.names.add(imageName);<NEW_LINE>results.namesRight.add(imageRight);<NEW_LINE>});<NEW_LINE>// Update the GUI by showing the latest images<NEW_LINE>SwingUtilities.invokeLater(() -> {<NEW_LINE>// Show images as they are being loaded<NEW_LINE>stereoPanel.panelLeft.setImage(buffLeft);<NEW_LINE>stereoPanel.panelRight.setImage(buffRight);<NEW_LINE>stereoPanel.repaint();<NEW_LINE>imageListPanel.addImage(imageName, _used);<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | .add(imageName, calibLeft)); |
558,404 | private static void testNativeJsEnum() {<NEW_LINE>NativeEnum v = NativeEnum.OK;<NEW_LINE>switch(v) {<NEW_LINE>case OK:<NEW_LINE>break;<NEW_LINE>case CANCEL:<NEW_LINE>fail();<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>fail();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>assertThrows(NullPointerException.class, () -> {<NEW_LINE>NativeEnum nullJsEnum = null;<NEW_LINE>switch(nullJsEnum) {<NEW_LINE>}<NEW_LINE>});<NEW_LINE>assertTrue(v == NativeEnum.OK);<NEW_LINE>assertTrue(v != NativeEnum.CANCEL);<NEW_LINE>// Native JsEnums are not boxed.<NEW_LINE>assertTrue(v == OK_STRING);<NEW_LINE>assertTrue(v == (Object) StringNativeEnum.OK);<NEW_LINE>// No boxing<NEW_LINE>Object o = NativeEnum.OK;<NEW_LINE>assertTrue(o == NativeEnum.OK);<NEW_LINE>// Object methods calls on a variable of JsEnum type.<NEW_LINE>assertTrue(v.hashCode() == NativeEnum.OK.hashCode());<NEW_LINE>assertTrue(v.hashCode() != NativeEnum.CANCEL.hashCode());<NEW_LINE>assertTrue(v.hashCode() == StringNativeEnum.OK.hashCode());<NEW_LINE>assertTrue(v.toString().equals(OK_STRING));<NEW_LINE>assertTrue(v<MASK><NEW_LINE>assertTrue(v.equals(OK_STRING));<NEW_LINE>assertTrue(v.equals(StringNativeEnum.OK));<NEW_LINE>// Object methods calls on a variable of Object type.<NEW_LINE>assertTrue(o.hashCode() == NativeEnum.OK.hashCode());<NEW_LINE>assertTrue(o.hashCode() != NativeEnum.CANCEL.hashCode());<NEW_LINE>assertTrue(o.hashCode() == StringNativeEnum.OK.hashCode());<NEW_LINE>assertTrue(o.toString().equals(OK_STRING));<NEW_LINE>assertTrue(o.equals(NativeEnum.OK));<NEW_LINE>assertTrue(o.equals(OK_STRING));<NEW_LINE>assertTrue(v.equals(StringNativeEnum.OK));<NEW_LINE>assertFalse(v instanceof Enum);<NEW_LINE>assertTrue((Object) v instanceof String);<NEW_LINE>assertTrue(v instanceof Comparable);<NEW_LINE>assertTrue(v instanceof Serializable);<NEW_LINE>assertFalse((Object) v instanceof PlainJsEnum);<NEW_LINE>NativeEnum ne = (NativeEnum) o;<NEW_LINE>StringNativeEnum sne = (StringNativeEnum) o;<NEW_LINE>Comparable ce = (Comparable) o;<NEW_LINE>ce = (NativeEnum & Comparable<NativeEnum>) o;<NEW_LINE>Serializable s = (Serializable) o;<NEW_LINE>assertThrowsClassCastException(() -> {<NEW_LINE>Object unused = (Enum) o;<NEW_LINE>}, Enum.class);<NEW_LINE>assertThrowsClassCastException(() -> {<NEW_LINE>Object unused = (Boolean) o;<NEW_LINE>}, Boolean.class);<NEW_LINE>assertTrue(asSeenFromJs(NativeEnum.OK) == OK_STRING);<NEW_LINE>} | .equals(NativeEnum.OK)); |
1,808,800 | final DescribeSnapshotScheduleResult executeDescribeSnapshotSchedule(DescribeSnapshotScheduleRequest describeSnapshotScheduleRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeSnapshotScheduleRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeSnapshotScheduleRequest> request = null;<NEW_LINE>Response<DescribeSnapshotScheduleResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeSnapshotScheduleRequestProtocolMarshaller(protocolFactory).marshall<MASK><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, "Storage Gateway");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeSnapshotSchedule");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeSnapshotScheduleResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeSnapshotScheduleResultJsonUnmarshaller());<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>} | (super.beforeMarshalling(describeSnapshotScheduleRequest)); |
1,689,214 | public ScheduledWindowExecution unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ScheduledWindowExecution scheduledWindowExecution = new ScheduledWindowExecution();<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("WindowId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>scheduledWindowExecution.setWindowId(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("Name", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>scheduledWindowExecution.setName(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("ExecutionTime", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>scheduledWindowExecution.setExecutionTime(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return scheduledWindowExecution;<NEW_LINE>} | class).unmarshall(context)); |
809,532 | public final TermContext term() throws RecognitionException {<NEW_LINE>TermContext _localctx = new TermContext(_ctx, getState());<NEW_LINE>enterRule(_localctx, 132, RULE_term);<NEW_LINE>int _la;<NEW_LINE>try {<NEW_LINE>enterOuterAlt(_localctx, 1);<NEW_LINE>{<NEW_LINE>setState(1218);<NEW_LINE>_localctx.factor = factor();<NEW_LINE>_localctx.result = _localctx.factor.result;<NEW_LINE>setState(1238);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>_la = _input.LA(1);<NEW_LINE>while (((((_la - 49)) & ~0x3f) == 0 && ((1L << (_la - 49)) & ((1L << (STAR - 49)) | (1L << (DIV - 49)) | (1L << (MOD - 49)) | (1L << (IDIV - 49)) | (1L << (AT - 49)))) != 0)) {<NEW_LINE>{<NEW_LINE>{<NEW_LINE>BinaryArithmetic arithmetic;<NEW_LINE>setState(1231);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>switch(_input.LA(1)) {<NEW_LINE>case STAR:<NEW_LINE>{<NEW_LINE>setState(1221);<NEW_LINE>match(STAR);<NEW_LINE>arithmetic = BinaryArithmetic.Mul;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case AT:<NEW_LINE>{<NEW_LINE>setState(1223);<NEW_LINE>match(AT);<NEW_LINE>arithmetic = BinaryArithmetic.MatMul;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case DIV:<NEW_LINE>{<NEW_LINE>setState(1225);<NEW_LINE>match(DIV);<NEW_LINE>arithmetic = BinaryArithmetic.TrueDiv;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case MOD:<NEW_LINE>{<NEW_LINE>setState(1227);<NEW_LINE>match(MOD);<NEW_LINE>arithmetic = BinaryArithmetic.Mod;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case IDIV:<NEW_LINE>{<NEW_LINE>setState(1229);<NEW_LINE>match(IDIV);<NEW_LINE>arithmetic = BinaryArithmetic.FloorDiv;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new NoViableAltException(this);<NEW_LINE>}<NEW_LINE>setState(1233);<NEW_LINE>_localctx.factor = factor();<NEW_LINE>_localctx.result = new BinaryArithmeticSSTNode(arithmetic, _localctx.result, _localctx.factor.result, getStartIndex(_localctx), getStopIndex((_localctx.factor != null ? (_localctx.factor.stop) : null)));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>setState(1240);<NEW_LINE>_errHandler.sync(this);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (RecognitionException re) {<NEW_LINE>_localctx.exception = re;<NEW_LINE>_errHandler.reportError(this, re);<NEW_LINE>_errHandler.recover(this, re);<NEW_LINE>} finally {<NEW_LINE>exitRule();<NEW_LINE>}<NEW_LINE>return _localctx;<NEW_LINE>} | _la = _input.LA(1); |
543,024 | public DescribeKeyPhrasesDetectionJobResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>DescribeKeyPhrasesDetectionJobResult describeKeyPhrasesDetectionJobResult = new DescribeKeyPhrasesDetectionJobResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return describeKeyPhrasesDetectionJobResult;<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("KeyPhrasesDetectionJobProperties", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>describeKeyPhrasesDetectionJobResult.setKeyPhrasesDetectionJobProperties(KeyPhrasesDetectionJobPropertiesJsonUnmarshaller.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 describeKeyPhrasesDetectionJobResult;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
1,561,340 | private static DiskStats queryReadWriteStats(String index) {<NEW_LINE>// Create object to hold and return results<NEW_LINE>DiskStats stats = new DiskStats();<NEW_LINE>Pair<List<String>, Map<PhysicalDiskProperty, List<Long>>> instanceValuePair = PhysicalDisk.queryDiskCounters();<NEW_LINE>List<String> instances = instanceValuePair.getA();<NEW_LINE>Map<PhysicalDiskProperty, List<Long><MASK><NEW_LINE>stats.timeStamp = System.currentTimeMillis();<NEW_LINE>List<Long> readList = valueMap.get(PhysicalDiskProperty.DISKREADSPERSEC);<NEW_LINE>List<Long> readByteList = valueMap.get(PhysicalDiskProperty.DISKREADBYTESPERSEC);<NEW_LINE>List<Long> writeList = valueMap.get(PhysicalDiskProperty.DISKWRITESPERSEC);<NEW_LINE>List<Long> writeByteList = valueMap.get(PhysicalDiskProperty.DISKWRITEBYTESPERSEC);<NEW_LINE>List<Long> queueLengthList = valueMap.get(PhysicalDiskProperty.CURRENTDISKQUEUELENGTH);<NEW_LINE>List<Long> diskTimeList = valueMap.get(PhysicalDiskProperty.PERCENTDISKTIME);<NEW_LINE>if (instances.isEmpty() || readList == null || readByteList == null || writeList == null || writeByteList == null || queueLengthList == null || diskTimeList == null) {<NEW_LINE>return stats;<NEW_LINE>}<NEW_LINE>for (int i = 0; i < instances.size(); i++) {<NEW_LINE>String name = getIndexFromName(instances.get(i));<NEW_LINE>// If index arg passed, only update passed arg<NEW_LINE>if (index != null && !index.equals(name)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>stats.readMap.put(name, readList.get(i));<NEW_LINE>stats.readByteMap.put(name, readByteList.get(i));<NEW_LINE>stats.writeMap.put(name, writeList.get(i));<NEW_LINE>stats.writeByteMap.put(name, writeByteList.get(i));<NEW_LINE>stats.queueLengthMap.put(name, queueLengthList.get(i));<NEW_LINE>stats.diskTimeMap.put(name, diskTimeList.get(i) / 10_000L);<NEW_LINE>}<NEW_LINE>return stats;<NEW_LINE>} | > valueMap = instanceValuePair.getB(); |
1,851,938 | private static void randomize(Context context) {<NEW_LINE>int first = 0;<NEW_LINE>String format = context.getString(R.string.msg_randomizing);<NEW_LINE>List<ApplicationInfo> listApp = context.getPackageManager().getInstalledApplications(0);<NEW_LINE>// Randomize global<NEW_LINE>int userId = Util.getUserId(Process.myUid());<NEW_LINE>PrivacyManager.setSettingList(getRandomizeWork(context, userId));<NEW_LINE>// Randomize applications<NEW_LINE>for (int i = 1; i <= listApp.size(); i++) {<NEW_LINE>int uid = listApp.<MASK><NEW_LINE>List<PSetting> listSetting = getRandomizeWork(context, uid);<NEW_LINE>PrivacyManager.setSettingList(listSetting);<NEW_LINE>if (first == 0)<NEW_LINE>if (listSetting.size() > 0)<NEW_LINE>first = i;<NEW_LINE>if (first > 0 && first < listApp.size())<NEW_LINE>notifyProgress(context, Util.NOTIFY_RANDOMIZE, format, 100 * (i - first) / (listApp.size() - first));<NEW_LINE>}<NEW_LINE>if (first == 0)<NEW_LINE>Util.log(null, Log.WARN, "Nothing to randomize");<NEW_LINE>} | get(i - 1).uid; |
1,659,555 | private static void runEveryDistinctWithinFollowedBy(RegressionEnvironment env, String expression, AtomicInteger milestone) {<NEW_LINE>env.compileDeploy(expression).addListener("s0");<NEW_LINE>env.milestoneInc(milestone);<NEW_LINE>env.sendEventBean(new SupportBean("A1", 1));<NEW_LINE>env.sendEventBean(<MASK><NEW_LINE>env.assertListenerNotInvoked("s0");<NEW_LINE>env.sendEventBean(new SupportBean("B2", 1));<NEW_LINE>env.assertPropsNew("s0", "a.theString,b.theString".split(","), new Object[] { "A1", "B2" });<NEW_LINE>env.milestoneInc(milestone);<NEW_LINE>env.sendEventBean(new SupportBean("A2", 2));<NEW_LINE>env.sendEventBean(new SupportBean("A3", 3));<NEW_LINE>env.sendEventBean(new SupportBean("A4", 1));<NEW_LINE>env.assertListenerNotInvoked("s0");<NEW_LINE>env.milestoneInc(milestone);<NEW_LINE>env.sendEventBean(new SupportBean("B3", 3));<NEW_LINE>env.assertPropsNew("s0", "a.theString,b.theString".split(","), new Object[] { "A3", "B3" });<NEW_LINE>env.milestoneInc(milestone);<NEW_LINE>env.sendEventBean(new SupportBean("B4", 1));<NEW_LINE>env.assertListenerNotInvoked("s0");<NEW_LINE>env.milestoneInc(milestone);<NEW_LINE>env.sendEventBean(new SupportBean("B5", 2));<NEW_LINE>env.assertPropsNew("s0", "a.theString,b.theString".split(","), new Object[] { "A2", "B5" });<NEW_LINE>env.sendEventBean(new SupportBean("A5", 2));<NEW_LINE>env.sendEventBean(new SupportBean("B6", 2));<NEW_LINE>env.assertListenerNotInvoked("s0");<NEW_LINE>env.milestoneInc(milestone);<NEW_LINE>env.sendEventBean(new SupportBean("A6", 4));<NEW_LINE>env.sendEventBean(new SupportBean("B7", 4));<NEW_LINE>env.assertPropsNew("s0", "a.theString,b.theString".split(","), new Object[] { "A6", "B7" });<NEW_LINE>env.undeployAll();<NEW_LINE>} | new SupportBean("B1", 0)); |
1,328,400 | public void handleInboundDisconnect(@NotNull final ChannelHandlerContext ctx, @NotNull final DISCONNECT disconnect) {<NEW_LINE>final Channel channel = ctx.channel();<NEW_LINE>final ClientConnection clientConnection = channel.attr(ChannelAttributes.CLIENT_CONNECTION).get();<NEW_LINE>final String clientId = clientConnection.getClientId();<NEW_LINE>if (clientId == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final ClientContextImpl clientContext = clientConnection.getExtensionClientContext();<NEW_LINE>if (clientContext == null) {<NEW_LINE>ctx.fireChannelRead(disconnect);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final List<DisconnectInboundInterceptor> interceptors = clientContext.getDisconnectInboundInterceptors();<NEW_LINE>if (interceptors.isEmpty()) {<NEW_LINE>ctx.fireChannelRead(disconnect);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>channel.config().setOption(ChannelOption.ALLOW_HALF_CLOSURE, true);<NEW_LINE>final ClientInformation clientInfo = ExtensionInformationUtil.getAndSetClientInformation(channel, clientId);<NEW_LINE>final ConnectionInformation connectionInfo = ExtensionInformationUtil.getAndSetConnectionInformation(channel);<NEW_LINE>final Long originalSessionExpiryInterval = clientConnection.getClientSessionExpiryInterval();<NEW_LINE>final DisconnectPacketImpl packet = new DisconnectPacketImpl(disconnect);<NEW_LINE>final DisconnectInboundInputImpl input = new DisconnectInboundInputImpl(clientInfo, connectionInfo, packet);<NEW_LINE>final ExtensionParameterHolder<DisconnectInboundInputImpl> inputHolder = new ExtensionParameterHolder<>(input);<NEW_LINE>final ModifiableInboundDisconnectPacketImpl modifiablePacket = new ModifiableInboundDisconnectPacketImpl(packet, configurationService, originalSessionExpiryInterval);<NEW_LINE>final DisconnectInboundOutputImpl output = new DisconnectInboundOutputImpl(asyncer, modifiablePacket);<NEW_LINE>final ExtensionParameterHolder<DisconnectInboundOutputImpl> outputHolder <MASK><NEW_LINE>final DisconnectInboundInterceptorContext context = new DisconnectInboundInterceptorContext(clientId, interceptors.size(), ctx, inputHolder, outputHolder);<NEW_LINE>for (final DisconnectInboundInterceptor interceptor : interceptors) {<NEW_LINE>final HiveMQExtension extension = hiveMQExtensions.getExtensionForClassloader(interceptor.getClass().getClassLoader());<NEW_LINE>if (extension == null) {<NEW_LINE>context.finishInterceptor();<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>final DisconnectInboundInterceptorTask task = new DisconnectInboundInterceptorTask(interceptor, extension.getId());<NEW_LINE>executorService.handlePluginInOutTaskExecution(context, inputHolder, outputHolder, task);<NEW_LINE>}<NEW_LINE>} | = new ExtensionParameterHolder<>(output); |
1,236,661 | public boolean apply(Game game, Ability source) {<NEW_LINE>Permanent sourcePermanent = source.getSourcePermanentOrLKI(game);<NEW_LINE>if (sourcePermanent == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>Permanent attachedTo = game.getPermanentOrLKIBattlefield(sourcePermanent.getAttachedTo());<NEW_LINE>if (attachedTo == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>Player player = game.getPlayer(attachedTo.getControllerId());<NEW_LINE>if (player == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>target.setNotTarget(true);<NEW_LINE>if (target.canChoose(player.getId(), source, game)) {<NEW_LINE>player.choose(outcome, target, source, game);<NEW_LINE>Permanent permanent = game.getPermanent(target.getFirstTarget());<NEW_LINE>if (permanent != null) {<NEW_LINE>permanent.sacrifice(source, game);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>player.loseLife(1, game, source, false);<NEW_LINE>return true;<NEW_LINE>} | TargetPermanent target = new TargetPermanent(filter); |
1,537,856 | private void init(Context context) {<NEW_LINE>currentCalender = Calendar.getInstance(timeZone, locale);<NEW_LINE>todayCalender = Calendar.getInstance(timeZone, locale);<NEW_LINE>calendarWithFirstDayOfMonth = Calendar.getInstance(timeZone, locale);<NEW_LINE>eventsCalendar = Calendar.getInstance(timeZone, locale);<NEW_LINE>tempPreviousMonthCalendar = <MASK><NEW_LINE>// make setMinimalDaysInFirstWeek same across android versions<NEW_LINE>eventsCalendar.setMinimalDaysInFirstWeek(1);<NEW_LINE>calendarWithFirstDayOfMonth.setMinimalDaysInFirstWeek(1);<NEW_LINE>todayCalender.setMinimalDaysInFirstWeek(1);<NEW_LINE>currentCalender.setMinimalDaysInFirstWeek(1);<NEW_LINE>tempPreviousMonthCalendar.setMinimalDaysInFirstWeek(1);<NEW_LINE>setFirstDayOfWeek(firstDayOfWeekToDraw);<NEW_LINE>setUseWeekDayAbbreviation(false);<NEW_LINE>dayPaint.setTextAlign(Paint.Align.CENTER);<NEW_LINE>dayPaint.setStyle(Paint.Style.STROKE);<NEW_LINE>dayPaint.setFlags(Paint.ANTI_ALIAS_FLAG);<NEW_LINE>dayPaint.setTypeface(Typeface.SANS_SERIF);<NEW_LINE>dayPaint.setTextSize(textSize);<NEW_LINE>dayPaint.setColor(calenderTextColor);<NEW_LINE>dayPaint.getTextBounds("31", 0, "31".length(), textSizeRect);<NEW_LINE>textHeight = textSizeRect.height() * 3;<NEW_LINE>textWidth = textSizeRect.width() * 2;<NEW_LINE>todayCalender.setTime(new Date());<NEW_LINE>setToMidnight(todayCalender);<NEW_LINE>currentCalender.setTime(currentDate);<NEW_LINE>setCalenderToFirstDayOfMonth(calendarWithFirstDayOfMonth, currentDate, -monthsScrolledSoFar, 0);<NEW_LINE>initScreenDensityRelatedValues(context);<NEW_LINE>xIndicatorOffset = 3.5f * screenDensity;<NEW_LINE>// scale small indicator by screen density<NEW_LINE>smallIndicatorRadius = 2.5f * screenDensity;<NEW_LINE>// just set a default growFactor to draw full calendar when initialised<NEW_LINE>growFactor = Integer.MAX_VALUE;<NEW_LINE>} | Calendar.getInstance(timeZone, locale); |
747,974 | private boolean detectKeepAlive(Buf buf, RapidoidHelper helper, Bytes bytes, BufRange protocol, BufRanges headers) {<NEW_LINE>IntWrap result = helper.integers[0];<NEW_LINE>// e.g. HTTP/1.1<NEW_LINE>boolean keepAliveByDefault = protocol.isEmpty() || bytes.get(<MASK><NEW_LINE>// try to detect the opposite of the default<NEW_LINE>if (keepAliveByDefault) {<NEW_LINE>// clo[se]<NEW_LINE>buf.scanLnLn(headers.reset(), result, (byte) 's', (byte) 'e');<NEW_LINE>} else {<NEW_LINE>// keep-ali[ve]<NEW_LINE>buf.scanLnLn(headers.reset(), result, (byte) 'v', (byte) 'e');<NEW_LINE>}<NEW_LINE>int possibleConnHeaderPos = result.value;<NEW_LINE>// no evidence of the opposite<NEW_LINE>if (possibleConnHeaderPos < 0)<NEW_LINE>return keepAliveByDefault;<NEW_LINE>BufRange possibleConnHdr = headers.get(possibleConnHeaderPos);<NEW_LINE>if (BytesUtil.startsWith(bytes, possibleConnHdr, CONNECTION, true)) {<NEW_LINE>// detected the opposite of the default<NEW_LINE>return !keepAliveByDefault;<NEW_LINE>}<NEW_LINE>return isKeepAlive(bytes, headers, helper, keepAliveByDefault);<NEW_LINE>} | protocol.last()) != '0'; |
877,624 | final DescribeSnapshotTierStatusResult executeDescribeSnapshotTierStatus(DescribeSnapshotTierStatusRequest describeSnapshotTierStatusRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeSnapshotTierStatusRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<DescribeSnapshotTierStatusRequest> request = null;<NEW_LINE>Response<DescribeSnapshotTierStatusResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeSnapshotTierStatusRequestMarshaller().marshall(super.beforeMarshalling(describeSnapshotTierStatusRequest));<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, "EC2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeSnapshotTierStatus");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DescribeSnapshotTierStatusResult> responseHandler = new StaxResponseHandler<DescribeSnapshotTierStatusResult>(new DescribeSnapshotTierStatusResultStaxUnmarshaller());<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.ClientExecuteTime); |
1,577,626 | public Box find(CssContext cssCtx, int absX, int absY, boolean findAnonymous) {<NEW_LINE>PaintingInfo pI = getPaintingInfo();<NEW_LINE>if (pI != null && !pI.getAggregateBounds().contains(absX, absY)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Box result = null;<NEW_LINE>for (int i = 0; i < getInlineChildCount(); i++) {<NEW_LINE>Object child = getInlineChild(i);<NEW_LINE>if (child instanceof Box) {<NEW_LINE>result = ((Box) child).find(cssCtx, absX, absY, findAnonymous);<NEW_LINE>if (result != null) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Rectangle edge = getContentAreaEdge(getAbsX(<MASK><NEW_LINE>result = edge.contains(absX, absY) && getStyle().isVisible(null, this) ? this : null;<NEW_LINE>if (!findAnonymous && result != null && getElement() == null) {<NEW_LINE>return getParent().getParent();<NEW_LINE>} else {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>} | ), getAbsY(), cssCtx); |
697,544 | private static TsMethodModel createDeserializationGenericFunctionConstructor(SymbolTable symbolTable, TsModel tsModel, TsBeanModel bean) {<NEW_LINE>final Symbol beanIdentifier = symbolTable.getSymbol(bean.getOrigin());<NEW_LINE>List<TsType.GenericVariableType> typeParameters = getTypeParameters(bean.getOrigin());<NEW_LINE>final TsType.ReferenceType dataType = new TsType.GenericReferenceType(beanIdentifier, typeParameters);<NEW_LINE>final List<TsParameterModel> constructorFnOfParameters = getConstructorFnOfParameters(typeParameters);<NEW_LINE>final List<TsExpression> arguments = new ArrayList<>();<NEW_LINE>arguments.<MASK><NEW_LINE>for (TsParameterModel constructorFnOfParameter : constructorFnOfParameters) {<NEW_LINE>arguments.add(new TsIdentifierReference(constructorFnOfParameter.name));<NEW_LINE>}<NEW_LINE>final List<TsStatement> body = new ArrayList<>();<NEW_LINE>body.add(new TsReturnStatement(new TsArrowFunction(Arrays.asList(new TsParameter("data", null)), new TsCallExpression(new TsMemberExpression(new TsTypeReferenceExpression(new TsType.ReferenceType(beanIdentifier)), "fromData"), null, arguments))));<NEW_LINE>return new TsMethodModel("fromDataFn", TsModifierFlags.None.setStatic(), typeParameters, constructorFnOfParameters, new TsType.FunctionType(Arrays.asList(new TsParameter("data", dataType)), dataType), body, null);<NEW_LINE>} | add(new TsIdentifierReference("data")); |
1,714,870 | protected boolean compareAndAdjustFulfillmentGroupOffers(PromotableOrder order, boolean fgOfferApplied) {<NEW_LINE>Money regularOrderDiscountShippingTotal = BroadleafCurrencyUtils.getMoney(BigDecimal.ZERO, order.getOrderCurrency());<NEW_LINE>regularOrderDiscountShippingTotal = regularOrderDiscountShippingTotal.add(order.calculateSubtotalWithoutAdjustments());<NEW_LINE>for (PromotableFulfillmentGroup fg : order.getFulfillmentGroups()) {<NEW_LINE>regularOrderDiscountShippingTotal = regularOrderDiscountShippingTotal.<MASK><NEW_LINE>}<NEW_LINE>Money discountOrderRegularShippingTotal = BroadleafCurrencyUtils.getMoney(BigDecimal.ZERO, order.getOrderCurrency());<NEW_LINE>discountOrderRegularShippingTotal = discountOrderRegularShippingTotal.add(order.calculateSubtotalWithAdjustments());<NEW_LINE>for (PromotableFulfillmentGroup fg : order.getFulfillmentGroups()) {<NEW_LINE>discountOrderRegularShippingTotal = discountOrderRegularShippingTotal.add(fg.calculatePriceWithoutAdjustments());<NEW_LINE>}<NEW_LINE>if (discountOrderRegularShippingTotal.lessThanOrEqual(regularOrderDiscountShippingTotal)) {<NEW_LINE>// order/item offer is better; remove totalitarian fulfillment group offer and process other fg offers<NEW_LINE>order.removeAllCandidateFulfillmentOfferAdjustments();<NEW_LINE>fgOfferApplied = false;<NEW_LINE>} else {<NEW_LINE>// totalitarian fg offer is better; remove all order/item offers<NEW_LINE>order.removeAllCandidateOrderOfferAdjustments();<NEW_LINE>order.removeAllCandidateItemOfferAdjustments();<NEW_LINE>order.getOrder().setSubTotal(order.calculateSubtotalWithAdjustments());<NEW_LINE>}<NEW_LINE>return fgOfferApplied;<NEW_LINE>} | add(fg.getFinalizedPriceWithAdjustments()); |
1,346,394 | private void evaluate(Line.Part part) {<NEW_LINE>Line line = part.getLine();<NEW_LINE>if (line == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>DataObject dataObject = DataEditorSupport.findDataObject(line);<NEW_LINE>if (!isPhpDataObject(dataObject)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>EditorCookie editorCookie = (EditorCookie) dataObject.getLookup().lookup(EditorCookie.class);<NEW_LINE>StyledDocument document = editorCookie.getDocument();<NEW_LINE>if (document == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final int offset = NbDocument.findLineOffset(document, part.getLine().getLineNumber(<MASK><NEW_LINE>JEditorPane ep = EditorContextDispatcher.getDefault().getCurrentEditor();<NEW_LINE>String selectedText = getSelectedText(ep, offset);<NEW_LINE>if (selectedText != null) {<NEW_LINE>if (isPHPIdentifier(selectedText)) {<NEW_LINE>sendPropertyGetCommand(selectedText);<NEW_LINE>} else if (PhpOptions.getInstance().isDebuggerWatchesAndEval()) {<NEW_LINE>sendEvalCommand(selectedText);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>final String identifier = ep != null ? getIdentifier(document, ep, offset) : null;<NEW_LINE>if (identifier != null) {<NEW_LINE>Runnable runnable = new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>sendPropertyGetCommand(identifier);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>RP.post(runnable);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// TODO: review, replace the code depending on lexer.model - part I<NEW_LINE>} | )) + part.getColumn(); |
1,653,210 | public static void invokeConfigMethods(ObjectDef bean, Object instance, ExecutionContext context) throws InvocationTargetException, IllegalAccessException {<NEW_LINE>List<ConfigMethodDef> methodDefs = bean.getConfigMethods();<NEW_LINE>if (methodDefs == null || methodDefs.size() == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Class clazz = instance.getClass();<NEW_LINE>for (ConfigMethodDef methodDef : methodDefs) {<NEW_LINE>List<Object> args = methodDef.getArgs();<NEW_LINE>if (args == null) {<NEW_LINE>args = new ArrayList();<NEW_LINE>}<NEW_LINE>if (methodDef.hasReferences()) {<NEW_LINE>args = resolveReferences(args, context);<NEW_LINE>}<NEW_LINE>String methodName = methodDef.getName();<NEW_LINE>Method method = findCompatibleMethod(args, clazz, methodName);<NEW_LINE>if (method != null) {<NEW_LINE>Object[] methodArgs = getArgsWithListCoercian(<MASK><NEW_LINE>method.invoke(instance, methodArgs);<NEW_LINE>} else {<NEW_LINE>String msg = String.format("Unable to find configuration method '%s' in class '%s' with arguments %s.", new Object[] { methodName, clazz.getName(), args });<NEW_LINE>throw new IllegalArgumentException(msg);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | args, method.getParameterTypes()); |
1,371,821 | protected TableColumnDescriptor<VTMatch> createTableColumnDescriptor() {<NEW_LINE>TableColumnDescriptor<VTMatch> descriptor = new TableColumnDescriptor<>();<NEW_LINE>descriptor.addHiddenColumn(new SessionNumberTableColumn());<NEW_LINE>descriptor.addVisibleColumn(new StatusTableColumn(), 1, true);<NEW_LINE>descriptor.addHiddenColumn(new MatchTypeTableColumn());<NEW_LINE>descriptor.addVisibleColumn(new ScoreTableColumn());<NEW_LINE>descriptor.addVisibleColumn(new ConfidenceScoreTableColumn());<NEW_LINE>descriptor<MASK><NEW_LINE>descriptor.addVisibleColumn(new RelatedMatchCountColumn());<NEW_LINE>descriptor.addHiddenColumn(new MultipleSourceLabelsTableColumn());<NEW_LINE>descriptor.addVisibleColumn(new SourceNamespaceTableColumn());<NEW_LINE>descriptor.addVisibleColumn(new SourceLabelTableColumn());<NEW_LINE>descriptor.addHiddenColumn(new SourceLabelSourceTypeTableColumn());<NEW_LINE>descriptor.addVisibleColumn(new SourceAddressTableColumn(), 2, true);<NEW_LINE>descriptor.addVisibleColumn(new SourceLengthTableColumn());<NEW_LINE>descriptor.addVisibleColumn(new DestinationLengthTableColumn());<NEW_LINE>descriptor.addHiddenColumn(new LengthDeltaTableColumn());<NEW_LINE>descriptor.addVisibleColumn(new AlgorithmTableColumn());<NEW_LINE>descriptor.addHiddenColumn(new TagTableColumn());<NEW_LINE>descriptor.addHiddenColumn(new AppliedMarkupStatusBatteryTableColumn());<NEW_LINE>descriptor.addHiddenColumn(new AppliedMarkupStatusTableColumn());<NEW_LINE>return descriptor;<NEW_LINE>} | .addVisibleColumn(new ImpliedMatchCountColumn()); |
731,094 | public WasmExpression apply(InvocationExpr invocation, WasmIntrinsicManager manager) {<NEW_LINE>switch(invocation.getMethod().getName()) {<NEW_LINE>case "fill":<NEW_LINE>case "fillZero":<NEW_LINE>case "moveMemoryBlock":<NEW_LINE>{<NEW_LINE>MethodReference delegateMethod = new MethodReference(WasmRuntime.class.getName(), invocation.<MASK><NEW_LINE>WasmCall call = new WasmCall(manager.getNames().forMethod(delegateMethod));<NEW_LINE>call.getArguments().addAll(invocation.getArguments().stream().map(manager::generate).collect(Collectors.toList()));<NEW_LINE>return call;<NEW_LINE>}<NEW_LINE>case "isInitialized":<NEW_LINE>{<NEW_LINE>WasmExpression pointer = manager.generate(invocation.getArguments().get(0));<NEW_LINE>if (pointer instanceof WasmInt32Constant) {<NEW_LINE>pointer = new WasmInt32Constant(((WasmInt32Constant) pointer).getValue() + flagsFieldOffset);<NEW_LINE>} else {<NEW_LINE>pointer = new WasmIntBinary(WasmIntType.INT32, WasmIntBinaryOperation.ADD, pointer, new WasmInt32Constant(flagsFieldOffset));<NEW_LINE>}<NEW_LINE>WasmExpression flags = new WasmLoadInt32(4, pointer, WasmInt32Subtype.INT32);<NEW_LINE>WasmExpression flag = new WasmIntBinary(WasmIntType.INT32, WasmIntBinaryOperation.AND, flags, new WasmInt32Constant(RuntimeClass.INITIALIZED));<NEW_LINE>return new WasmIntBinary(WasmIntType.INT32, WasmIntBinaryOperation.NE, flag, new WasmInt32Constant(0));<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>throw new IllegalArgumentException(invocation.getMethod().toString());<NEW_LINE>}<NEW_LINE>} | getMethod().getDescriptor()); |
1,595,268 | /*<NEW_LINE>* (non-Javadoc)<NEW_LINE>*<NEW_LINE>* @see org.eclipse.text.edits.TextEditVisitor#visit(org.eclipse.text.edits.<NEW_LINE>* CopyTargetEdit)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public boolean visit(CopyTargetEdit edit) {<NEW_LINE>try {<NEW_LINE>if (edit.getSourceEdit() != null) {<NEW_LINE>org.eclipse.lsp4j.TextEdit te = new org<MASK><NEW_LINE>te.setRange(JDTUtils.toRange(compilationUnit, edit.getOffset(), edit.getLength()));<NEW_LINE>Document doc = new Document(compilationUnit.getSource());<NEW_LINE>edit.apply(doc, TextEdit.UPDATE_REGIONS);<NEW_LINE>String content = doc.get(edit.getSourceEdit().getOffset(), edit.getSourceEdit().getLength());<NEW_LINE>if (edit.getSourceEdit().getSourceModifier() != null) {<NEW_LINE>content = applySourceModifier(content, edit.getSourceEdit().getSourceModifier());<NEW_LINE>}<NEW_LINE>te.setNewText(content);<NEW_LINE>converted.add(te);<NEW_LINE>}<NEW_LINE>// do not visit children<NEW_LINE>return false;<NEW_LINE>} catch (MalformedTreeException | BadLocationException | CoreException e) {<NEW_LINE>JavaLanguageServerPlugin.logException("Error converting TextEdits", e);<NEW_LINE>}<NEW_LINE>return super.visit(edit);<NEW_LINE>} | .eclipse.lsp4j.TextEdit(); |
311,614 | public void execute(LuckPermsPlugin plugin, Sender sender, PermissionHolder target, ArgumentList args, String label, CommandPermission permission) throws CommandException {<NEW_LINE>if (ArgumentPermissions.checkModifyPerms(plugin, sender, permission, target)) {<NEW_LINE>Message.COMMAND_NO_PERMISSION.send(sender);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String key = args.get(0);<NEW_LINE>String value = args.get(1);<NEW_LINE>Duration duration = args.getDuration(2);<NEW_LINE>TemporaryNodeMergeStrategy modifier = args.getTemporaryModifierAndRemove(3).orElseGet(() -> plugin.getConfiguration().get(ConfigKeys.TEMPORARY_ADD_BEHAVIOUR));<NEW_LINE>MutableContextSet context = args.getContextOrDefault(3, plugin);<NEW_LINE>if (ArgumentPermissions.checkContext(plugin, sender, permission, context) || ArgumentPermissions.checkGroup(plugin, sender, target, context) || ArgumentPermissions.checkArguments(plugin, sender, permission, key)) {<NEW_LINE>Message.COMMAND_NO_PERMISSION.send(sender);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Node node = Meta.builder(key, value).withContext(context).expiry(duration).build();<NEW_LINE>// remove temp meta nodes that have the same key and /different/ value (don't want to remove it if we are accumulating/replacing)<NEW_LINE>target.removeIf(DataType.NORMAL, context, NodeType.META.predicate(n -> n.hasExpiry() && n.getMetaKey().equalsIgnoreCase(key) && !n.getMetaValue().equals(value)), false);<NEW_LINE>DataMutateResult.WithMergedNode result = target.setNode(<MASK><NEW_LINE>if (result.getResult().wasSuccessful()) {<NEW_LINE>duration = result.getMergedNode().getExpiryDuration();<NEW_LINE>Message.SET_META_TEMP_SUCCESS.send(sender, key, value, target, duration, context);<NEW_LINE>LoggedAction.build().source(sender).target(target).description("meta", "settemp", key, value, duration, context).build().submit(plugin, sender);<NEW_LINE>StorageAssistant.save(target, sender, plugin);<NEW_LINE>} else {<NEW_LINE>Message.ALREADY_HAS_TEMP_META.send(sender, target, key, value, context);<NEW_LINE>}<NEW_LINE>} | DataType.NORMAL, node, modifier); |
954,739 | private ShardingRuleConfiguration createShardingRuleConfiguration() {<NEW_LINE>ShardingRuleConfiguration result = new ShardingRuleConfiguration();<NEW_LINE>result.getTables().add(getOrderTableRuleConfiguration());<NEW_LINE>result.getTables().add(getOrderItemTableRuleConfiguration());<NEW_LINE>result.getBindingTableGroups().add("t_order, t_order_item");<NEW_LINE>result.getBroadcastTables().add("t_address");<NEW_LINE>result.setDefaultDatabaseShardingStrategy(new StandardShardingStrategyConfiguration("user_id", "standard_test_db"));<NEW_LINE>result.setDefaultTableShardingStrategy(<MASK><NEW_LINE>result.getShardingAlgorithms().put("standard_test_db", new ShardingSphereAlgorithmConfiguration("STANDARD_TEST_DB", new Properties()));<NEW_LINE>result.getShardingAlgorithms().put("standard_test_tbl", new ShardingSphereAlgorithmConfiguration("STANDARD_TEST_TBL", new Properties()));<NEW_LINE>result.getKeyGenerators().put("snowflake", new ShardingSphereAlgorithmConfiguration("SNOWFLAKE", new Properties()));<NEW_LINE>return result;<NEW_LINE>} | new StandardShardingStrategyConfiguration("order_id", "standard_test_tbl")); |
822,603 | private int createProgram(String vertexSource, String fragmentSource) {<NEW_LINE>mVShaderHandle = loadShader(GLES20.GL_VERTEX_SHADER, vertexSource);<NEW_LINE>if (mVShaderHandle == 0) {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>mFShaderHandle = <MASK><NEW_LINE>if (mFShaderHandle == 0) {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>int program = GLES20.glCreateProgram();<NEW_LINE>if (program != 0) {<NEW_LINE>GLES20.glAttachShader(program, mVShaderHandle);<NEW_LINE>GLES20.glAttachShader(program, mFShaderHandle);<NEW_LINE>GLES20.glLinkProgram(program);<NEW_LINE>int[] linkStatus = new int[1];<NEW_LINE>GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus, 0);<NEW_LINE>if (linkStatus[0] != GLES20.GL_TRUE) {<NEW_LINE>RajLog.e("Could not link program in " + getClass().getCanonicalName() + ": ");<NEW_LINE>RajLog.e(GLES20.glGetProgramInfoLog(program));<NEW_LINE>GLES20.glDeleteProgram(program);<NEW_LINE>program = 0;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return program;<NEW_LINE>} | loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource); |
746,830 | protected void doExecute() throws Exception {<NEW_LINE>getLogger().debug("[doExecute] start build DcMeta");<NEW_LINE>SequenceCommandChain sequenceCommandChain = new SequenceCommandChain(false);<NEW_LINE>ParallelCommandChain parallelCommandChain <MASK><NEW_LINE>parallelCommandChain.add(retry3TimesUntilSuccess(new GetAllDcClusterShardDetailCommand(dcId)));<NEW_LINE>parallelCommandChain.add(retry3TimesUntilSuccess(new Cluster2DcClusterMapCommand()));<NEW_LINE>parallelCommandChain.add(retry3TimesUntilSuccess(new GetDcIdNameMapCommand()));<NEW_LINE>sequenceCommandChain.add(parallelCommandChain);<NEW_LINE>sequenceCommandChain.add(retry3TimesUntilSuccess(new BuildDcMetaCommand()));<NEW_LINE>getLogger().debug("[doExecute] commands: {}", sequenceCommandChain);<NEW_LINE>sequenceCommandChain.future().addListener(commandFuture -> {<NEW_LINE>getLogger().debug("[doExecute] end build DcMeta");<NEW_LINE>if (commandFuture.isSuccess()) {<NEW_LINE>future().setSuccess(dcMeta);<NEW_LINE>} else {<NEW_LINE>future().setFailure(commandFuture.cause());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>sequenceCommandChain.execute(executors);<NEW_LINE>} | = new ParallelCommandChain(executors, false); |
289,194 | public static GetInstanceInspectionsResponse unmarshall(GetInstanceInspectionsResponse getInstanceInspectionsResponse, UnmarshallerContext _ctx) {<NEW_LINE>getInstanceInspectionsResponse.setRequestId(_ctx.stringValue("GetInstanceInspectionsResponse.RequestId"));<NEW_LINE>getInstanceInspectionsResponse.setMessage(_ctx.stringValue("GetInstanceInspectionsResponse.Message"));<NEW_LINE>getInstanceInspectionsResponse.setCode(_ctx.stringValue("GetInstanceInspectionsResponse.Code"));<NEW_LINE>getInstanceInspectionsResponse.setSuccess(_ctx.stringValue("GetInstanceInspectionsResponse.Success"));<NEW_LINE>Data data = new Data();<NEW_LINE>data.setPageNo(_ctx.longValue("GetInstanceInspectionsResponse.Data.PageNo"));<NEW_LINE>data.setPageSize(_ctx.longValue("GetInstanceInspectionsResponse.Data.PageSize"));<NEW_LINE>data.setTotal(_ctx.longValue("GetInstanceInspectionsResponse.Data.Total"));<NEW_LINE>List<BaseInspection> list <MASK><NEW_LINE>for (int i = 0; i < _ctx.lengthValue("GetInstanceInspectionsResponse.Data.List.Length"); i++) {<NEW_LINE>BaseInspection baseInspection = new BaseInspection();<NEW_LINE>baseInspection.setEndTime(_ctx.longValue("GetInstanceInspectionsResponse.Data.List[" + i + "].EndTime"));<NEW_LINE>baseInspection.setStartTime(_ctx.longValue("GetInstanceInspectionsResponse.Data.List[" + i + "].StartTime"));<NEW_LINE>baseInspection.setData(_ctx.mapValue("GetInstanceInspectionsResponse.Data.List[" + i + "].Data"));<NEW_LINE>baseInspection.setScoreMap(_ctx.mapValue("GetInstanceInspectionsResponse.Data.List[" + i + "].ScoreMap"));<NEW_LINE>baseInspection.setGmtCreate(_ctx.longValue("GetInstanceInspectionsResponse.Data.List[" + i + "].GmtCreate"));<NEW_LINE>baseInspection.setScore(_ctx.integerValue("GetInstanceInspectionsResponse.Data.List[" + i + "].Score"));<NEW_LINE>Instance instance = new Instance();<NEW_LINE>instance.setVpcId(_ctx.stringValue("GetInstanceInspectionsResponse.Data.List[" + i + "].Instance.VpcId"));<NEW_LINE>instance.setUuid(_ctx.stringValue("GetInstanceInspectionsResponse.Data.List[" + i + "].Instance.Uuid"));<NEW_LINE>instance.setInstanceArea(_ctx.stringValue("GetInstanceInspectionsResponse.Data.List[" + i + "].Instance.InstanceArea"));<NEW_LINE>instance.setInstanceClass(_ctx.stringValue("GetInstanceInspectionsResponse.Data.List[" + i + "].Instance.InstanceClass"));<NEW_LINE>instance.setRegion(_ctx.stringValue("GetInstanceInspectionsResponse.Data.List[" + i + "].Instance.Region"));<NEW_LINE>instance.setAccountId(_ctx.stringValue("GetInstanceInspectionsResponse.Data.List[" + i + "].Instance.AccountId"));<NEW_LINE>instance.setNetworkType(_ctx.stringValue("GetInstanceInspectionsResponse.Data.List[" + i + "].Instance.NetworkType"));<NEW_LINE>instance.setEngine(_ctx.stringValue("GetInstanceInspectionsResponse.Data.List[" + i + "].Instance.Engine"));<NEW_LINE>instance.setInstanceId(_ctx.stringValue("GetInstanceInspectionsResponse.Data.List[" + i + "].Instance.InstanceId"));<NEW_LINE>instance.setNodeId(_ctx.stringValue("GetInstanceInspectionsResponse.Data.List[" + i + "].Instance.NodeId"));<NEW_LINE>instance.setEngineVersion(_ctx.stringValue("GetInstanceInspectionsResponse.Data.List[" + i + "].Instance.EngineVersion"));<NEW_LINE>baseInspection.setInstance(instance);<NEW_LINE>list.add(baseInspection);<NEW_LINE>}<NEW_LINE>data.setList(list);<NEW_LINE>getInstanceInspectionsResponse.setData(data);<NEW_LINE>return getInstanceInspectionsResponse;<NEW_LINE>} | = new ArrayList<BaseInspection>(); |
1,227,158 | public Node visit(final MethodCallExpr n, final A arg) {<NEW_LINE>if (n.getScope() != null) {<NEW_LINE>n.setScope((Expression) n.getScope().accept(this, arg));<NEW_LINE>}<NEW_LINE>final List<Type> typeArgs = n.getTypeArgs();<NEW_LINE>if (typeArgs != null) {<NEW_LINE>for (int i = 0; i < typeArgs.size(); i++) {<NEW_LINE>typeArgs.set(i, (Type) typeArgs.get(i)<MASK><NEW_LINE>}<NEW_LINE>removeNulls(typeArgs);<NEW_LINE>}<NEW_LINE>final List<Expression> args = n.getArgs();<NEW_LINE>if (args != null) {<NEW_LINE>for (int i = 0; i < args.size(); i++) {<NEW_LINE>args.set(i, (Expression) args.get(i).accept(this, arg));<NEW_LINE>}<NEW_LINE>removeNulls(args);<NEW_LINE>}<NEW_LINE>return n;<NEW_LINE>} | .accept(this, arg)); |
452,322 | public void onClick(View v) {<NEW_LINE>// Utils.platformLog("#$#$#$#$#$#$#$#$#$", "onClick( "+String.valueOf((int)x)+" , "+String.valueOf((int)y)+" )");<NEW_LINE>// found child item<NEW_LINE>for (int i = 0; i < tabHost.getTabWidget().getChildCount(); i++) {<NEW_LINE>int curIndex = i;<NEW_LINE>int left = tabHost.getTabWidget().getChildAt(curIndex).getLeft();<NEW_LINE>int top = tabHost.getTabWidget().getChildAt(curIndex).getTop();<NEW_LINE>int width = tabHost.getTabWidget().getChildAt(curIndex).getWidth();<NEW_LINE>int height = tabHost.getTabWidget().<MASK><NEW_LINE>// Utils.platformLog("#$#$#$#$#$#$#$#$#$", "current item have rect [ "+String.valueOf(left)+" , "+String.valueOf(top)+" , "+String.valueOf(width)+" , "+String.valueOf(height)+" ]");<NEW_LINE>if (((left <= x) && (x <= (left + width))) && ((top <= y) && (y <= (top + height)))) {<NEW_LINE>// Utils.platformLog("#$#$#$#$#$#$#$#$#$", "clicked item no "+String.valueOf(curIndex));<NEW_LINE>onTabChangedIndex(curIndex, true);<NEW_LINE>InputMethodManager imm = (InputMethodManager) RhodesActivity.getContext().getSystemService(Activity.INPUT_METHOD_SERVICE);<NEW_LINE>imm.hideSoftInputFromWindow(v.getWindowToken(), 0);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Utils.platformLog("#$#$#$#$#$#$#$#$#$", "not found clicked item");<NEW_LINE>} | getChildAt(curIndex).getHeight(); |
588,526 | public static NeuralNetwork assembleNeuralNetwork() {<NEW_LINE>Layer inputLayer = new Layer();<NEW_LINE>inputLayer.addNeuron(new Neuron());<NEW_LINE>inputLayer.addNeuron(new Neuron());<NEW_LINE>Layer hiddenLayerOne = new Layer();<NEW_LINE>hiddenLayerOne.addNeuron(new Neuron());<NEW_LINE>hiddenLayerOne.addNeuron(new Neuron());<NEW_LINE>hiddenLayerOne.addNeuron(new Neuron());<NEW_LINE>hiddenLayerOne.addNeuron(new Neuron());<NEW_LINE>Layer hiddenLayerTwo = new Layer();<NEW_LINE>hiddenLayerTwo.addNeuron(new Neuron());<NEW_LINE>hiddenLayerTwo.addNeuron(new Neuron());<NEW_LINE>hiddenLayerTwo.addNeuron(new Neuron());<NEW_LINE>hiddenLayerTwo.addNeuron(new Neuron());<NEW_LINE>Layer outputLayer = new Layer();<NEW_LINE>outputLayer.addNeuron(new Neuron());<NEW_LINE>NeuralNetwork ann = new NeuralNetwork();<NEW_LINE>ann.addLayer(0, inputLayer);<NEW_LINE>ann.addLayer(1, hiddenLayerOne);<NEW_LINE>ConnectionFactory.fullConnect(ann.getLayerAt(0), ann.getLayerAt(1));<NEW_LINE>ann.addLayer(2, hiddenLayerTwo);<NEW_LINE>ConnectionFactory.fullConnect(ann.getLayerAt(1), ann.getLayerAt(2));<NEW_LINE>ann.addLayer(3, outputLayer);<NEW_LINE>ConnectionFactory.fullConnect(ann.getLayerAt(2), ann.getLayerAt(3));<NEW_LINE>ConnectionFactory.fullConnect(ann.getLayerAt(0), ann.getLayerAt(ann.getLayersCount<MASK><NEW_LINE>ann.setInputNeurons(inputLayer.getNeurons());<NEW_LINE>ann.setOutputNeurons(outputLayer.getNeurons());<NEW_LINE>ann.setNetworkType(NeuralNetworkType.MULTI_LAYER_PERCEPTRON);<NEW_LINE>return ann;<NEW_LINE>} | () - 1), false); |
1,472,728 | public void testCompletionStageRxInvoker_get4WithExecutorService(Map<String, String> param, StringBuilder ret) {<NEW_LINE>String serverIP = param.get("serverIP");<NEW_LINE>String serverPort = param.get("serverPort");<NEW_LINE>final String threadName = "jaxrs21Thread";<NEW_LINE>ThreadFactory jaxrs21ThreadFactory = Executors.defaultThreadFactory();<NEW_LINE>Thread jaxrs21Thread = jaxrs21ThreadFactory.newThread(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>String runThreadName = Thread.currentThread().getName();<NEW_LINE>if (!(runThreadName.equals(threadName))) {<NEW_LINE>throw new RuntimeException("testCompletionStageRxInvoker_get4WithExecutorService: incorrect thread name");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>jaxrs21Thread.setName(threadName);<NEW_LINE>ExecutorService executorService = Executors.newSingleThreadExecutor(jaxrs21ThreadFactory);<NEW_LINE>ClientBuilder cb = ClientBuilder.newBuilder().executorService(executorService);<NEW_LINE>Client c = cb.build();<NEW_LINE>WebTarget t = c.target("http://" + serverIP + ":" + serverPort + "/jaxrs21bookstore/JAXRS21bookstore2/rxget1");<NEW_LINE>Builder builder = t.request();<NEW_LINE>builder.accept("application/xml");<NEW_LINE><MASK><NEW_LINE>CompletionStage<Response> completionStage = completionStageRxInvoker.get();<NEW_LINE>CompletableFuture<Response> completableFuture = completionStage.toCompletableFuture();<NEW_LINE>try {<NEW_LINE>Response response = completableFuture.get();<NEW_LINE>ret.append(response.readEntity(String.class));<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>} catch (ExecutionException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>c.close();<NEW_LINE>} | CompletionStageRxInvoker completionStageRxInvoker = builder.rx(); |
172,402 | private Setup[] computeSetups(final File[] files, final int displayStatus, final int setupType) {<NEW_LINE>final List<Setup> newSetups = new ArrayList<Setup>(files.length);<NEW_LINE>final int <MASK><NEW_LINE>final boolean[] canceled = new boolean[1];<NEW_LINE>SvnUtils.runWithInfoCache(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>for (File file : files) {<NEW_LINE>if (!file.isDirectory() && (cache.getStatus(file).getStatus() & statusWithoutProperties) != 0) {<NEW_LINE>Setup setup = new Setup(file, null, setupType);<NEW_LINE>setup.setNode(new DiffNode(setup, new SvnFileNode(file), displayStatus));<NEW_LINE>newSetups.add(setup);<NEW_LINE>}<NEW_LINE>if (propertiesVisible) {<NEW_LINE>addPropertiesSetups(file, newSetups, displayStatus);<NEW_LINE>}<NEW_LINE>if (isCanceled()) {<NEW_LINE>canceled[0] = true;<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return canceled[0] ? null : newSetups.toArray(new Setup[newSetups.size()]);<NEW_LINE>} | statusWithoutProperties = displayStatus & ~FileInformation.STATUS_VERSIONED_MODIFIEDLOCALLY_PROPERTY; |
689,416 | public static <T extends @Nullable Object> Stream<T> concat(Stream<? extends T>... streams) {<NEW_LINE>// TODO(lowasser): consider an implementation that can support SUBSIZED<NEW_LINE>boolean isParallel = false;<NEW_LINE>int characteristics = Spliterator.ORDERED | Spliterator.SIZED | Spliterator.NONNULL;<NEW_LINE>long estimatedSize = 0L;<NEW_LINE>ImmutableList.Builder<Spliterator<? extends T>> splitrsBuilder = new ImmutableList.Builder<>(streams.length);<NEW_LINE>for (Stream<? extends T> stream : streams) {<NEW_LINE>isParallel |= stream.isParallel();<NEW_LINE>Spliterator<? extends T<MASK><NEW_LINE>splitrsBuilder.add(splitr);<NEW_LINE>characteristics &= splitr.characteristics();<NEW_LINE>estimatedSize = LongMath.saturatedAdd(estimatedSize, splitr.estimateSize());<NEW_LINE>}<NEW_LINE>return StreamSupport.stream(CollectSpliterators.flatMap(splitrsBuilder.build().spliterator(), splitr -> (Spliterator<T>) splitr, characteristics, estimatedSize), isParallel).onClose(() -> closeAll(streams));<NEW_LINE>} | > splitr = stream.spliterator(); |
625,798 | public static Bitmap updateWithBackground_customBG(Bitmap bitmap, int alpha, Bitmap bgBitmap) {<NEW_LINE>Paint p = new Paint();<NEW_LINE>p.setAlpha(255 - alpha);<NEW_LINE>float k1 = (float) bitmap.getHeight() / bitmap.getWidth();<NEW_LINE>float k2 = (float) Dips.screenHeight() / Dips.screenWidth();<NEW_LINE>float k = Math.max(k1, k2);<NEW_LINE>Bitmap result = Bitmap.createBitmap(bitmap.getWidth(), (int) (bitmap.getWidth() * k), bitmap.getConfig());<NEW_LINE>Canvas canvas = new Canvas(result);<NEW_LINE>canvas.drawColor(Color.WHITE);<NEW_LINE>// for PDF only<NEW_LINE>Matrix m = new Matrix();<NEW_LINE>float sx = (float) result.getWidth() / bgBitmap.getWidth();<NEW_LINE>float sy = (float) result.getHeight() / bgBitmap.getHeight();<NEW_LINE>m.setScale(sx, sy);<NEW_LINE>int h = (result.getHeight() - <MASK><NEW_LINE>canvas.drawBitmap(bitmap, 0, h, new Paint());<NEW_LINE>canvas.drawBitmap(bgBitmap, m, p);<NEW_LINE>Paint p1 = new Paint();<NEW_LINE>p1.setColor(Color.WHITE);<NEW_LINE>p1.setAlpha(alpha);<NEW_LINE>// canvas.drawRect(0, 0, result.getWidth(), h, p1);<NEW_LINE>// canvas.drawRect(0, result.getHeight() - h, result.getWidth(),<NEW_LINE>// result.getHeight(), p1);<NEW_LINE>bitmap.recycle();<NEW_LINE>bitmap = null;<NEW_LINE>return result;<NEW_LINE>} | bitmap.getHeight()) / 2; |
478,533 | private List<String> toFilterList(Resource list) {<NEW_LINE>List<String> result = new ArrayList<>();<NEW_LINE>Resource current = list;<NEW_LINE>while (current != null && !current.equals(RDF.nil)) {<NEW_LINE>Statement stmt = current.getProperty(RDF.first);<NEW_LINE>if (stmt == null) {<NEW_LINE>throw new TextIndexException("filter list not well formed");<NEW_LINE>}<NEW_LINE>RDFNode node = stmt.getObject();<NEW_LINE>if (!node.isResource()) {<NEW_LINE>throw new TextIndexException("filter is not a resource : " + node);<NEW_LINE>}<NEW_LINE>result.add(node.<MASK><NEW_LINE>stmt = current.getProperty(RDF.rest);<NEW_LINE>if (stmt == null) {<NEW_LINE>throw new TextIndexException("filter list not terminated by rdf:nil");<NEW_LINE>}<NEW_LINE>node = stmt.getObject();<NEW_LINE>if (!node.isResource()) {<NEW_LINE>throw new TextIndexException("filter list node is not a resource : " + node);<NEW_LINE>}<NEW_LINE>current = node.asResource();<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | asResource().getURI()); |
775,323 | // canceling request and sending mail to applicant<NEW_LINE>public void cancel(ActionRequest request, ActionResponse response) throws AxelorException {<NEW_LINE>try {<NEW_LINE>ExtraHours extraHours = request.getContext().asType(ExtraHours.class);<NEW_LINE>extraHours = Beans.get(ExtraHoursRepository.class).find(extraHours.getId());<NEW_LINE>Beans.get(ExtraHoursService<MASK><NEW_LINE>Message message = Beans.get(ExtraHoursService.class).sendCancellationEmail(extraHours);<NEW_LINE>if (message != null && message.getStatusSelect() == MessageRepository.STATUS_SENT) {<NEW_LINE>response.setFlash(String.format(I18n.get("Email sent to %s"), Beans.get(MessageServiceBaseImpl.class).getToRecipients(message)));<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>TraceBackService.trace(response, e);<NEW_LINE>} finally {<NEW_LINE>response.setReload(true);<NEW_LINE>}<NEW_LINE>} | .class).cancel(extraHours); |
1,180,026 | public void read(org.apache.thrift.protocol.TProtocol iprot, getManagerStats_args struct) throws org.apache.thrift.TException {<NEW_LINE>org.apache.thrift.protocol.TField schemeField;<NEW_LINE>iprot.readStructBegin();<NEW_LINE>while (true) {<NEW_LINE>schemeField = iprot.readFieldBegin();<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>switch(schemeField.id) {<NEW_LINE>case // TINFO<NEW_LINE>1:<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {<NEW_LINE>struct.tinfo = new org.apache.accumulo.core.trace.thrift.TInfo();<NEW_LINE><MASK><NEW_LINE>struct.setTinfoIsSet(true);<NEW_LINE>} else {<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case // CREDENTIALS<NEW_LINE>2:<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {<NEW_LINE>struct.credentials = new org.apache.accumulo.core.securityImpl.thrift.TCredentials();<NEW_LINE>struct.credentials.read(iprot);<NEW_LINE>struct.setCredentialsIsSet(true);<NEW_LINE>} else {<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);<NEW_LINE>}<NEW_LINE>iprot.readFieldEnd();<NEW_LINE>}<NEW_LINE>iprot.readStructEnd();<NEW_LINE>// check for required fields of primitive type, which can't be checked in the validate method<NEW_LINE>struct.validate();<NEW_LINE>} | struct.tinfo.read(iprot); |
1,212,552 | public EventBean[] snapshotUpdate(QueryGraph filterQueryGraph, ExprEvaluator optionalWhereClause, EventBeanUpdateHelperWCopy updateHelper, Annotation[] annotations) {<NEW_LINE>agentInstanceContext.getEpStatementAgentInstanceHandle()<MASK><NEW_LINE>try {<NEW_LINE>Collection<EventBean> events = snapshotNoLockWithFilter(filterQueryGraph, annotations, optionalWhereClause, agentInstanceContext);<NEW_LINE>if (events.isEmpty()) {<NEW_LINE>return CollectionUtil.EVENTBEANARRAY_EMPTY;<NEW_LINE>}<NEW_LINE>EventBean[] eventsPerStream = new EventBean[3];<NEW_LINE>EventBean[] updated = new EventBean[events.size()];<NEW_LINE>int count = 0;<NEW_LINE>for (EventBean event : events) {<NEW_LINE>updated[count++] = updateHelper.updateWCopy(event, eventsPerStream, agentInstanceContext);<NEW_LINE>}<NEW_LINE>EventBean[] deleted = events.toArray(new EventBean[events.size()]);<NEW_LINE>rootViewInstance.update(updated, deleted);<NEW_LINE>return updated;<NEW_LINE>} finally {<NEW_LINE>releaseTableLocks(agentInstanceContext);<NEW_LINE>agentInstanceContext.getEpStatementAgentInstanceHandle().getStatementAgentInstanceLock().releaseReadLock();<NEW_LINE>}<NEW_LINE>} | .getStatementAgentInstanceLock().acquireReadLock(); |
1,140,209 | public void updateRule(String domain, String key, String configsStr, String type) {<NEW_LINE>try {<NEW_LINE>Rule rule = new Rule(generateRuleId(key, type));<NEW_LINE>List<Config> configs = DefaultJsonParser.parseArray(Config.class, configsStr);<NEW_LINE>for (Config config : configs) {<NEW_LINE>rule.addConfig(config);<NEW_LINE>}<NEW_LINE>rule.setDynamicAttribute(TYPE, type);<NEW_LINE>boolean isExist = true;<NEW_LINE>MonitorRules domainRule = m_rules.get(domain);<NEW_LINE>if (domainRule == null) {<NEW_LINE>domainRule = new MonitorRules();<NEW_LINE>m_rules.put(domain, domainRule);<NEW_LINE>isExist = false;<NEW_LINE>}<NEW_LINE>domainRule.getRules().put(rule.getId(), rule);<NEW_LINE>BusinessConfig proto = m_configDao.createLocal();<NEW_LINE>proto.setDomain(domain);<NEW_LINE>proto.<MASK><NEW_LINE>proto.setName(ALERT_CONFIG);<NEW_LINE>proto.setUpdatetime(new Date());<NEW_LINE>if (isExist) {<NEW_LINE>m_configDao.updateBaseConfigByDomain(proto, BusinessConfigEntity.UPDATESET_FULL);<NEW_LINE>} else {<NEW_LINE>m_configDao.insert(proto);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>Cat.logError(e);<NEW_LINE>}<NEW_LINE>} | setContent(domainRule.toString()); |
749,191 | protected List<Element> expandDateMDY(Document doc, String s) {<NEW_LINE>ArrayList<Element> exp = new ArrayList<Element>();<NEW_LINE>Matcher reMatcher = reMonthDayYear.matcher(s);<NEW_LINE>boolean found = reMatcher.find();<NEW_LINE>// month == (0)1, (0)2, ... , 12<NEW_LINE>int monthType = 1;<NEW_LINE>if (!found) {<NEW_LINE>reMatcher = reMonthwordDayYear.matcher(s);<NEW_LINE>found = reMatcher.find();<NEW_LINE>// month == Januar, Februar, ...<NEW_LINE>monthType = 2;<NEW_LINE>}<NEW_LINE>if (!found) {<NEW_LINE>reMatcher = reMonthabbrDayYear.matcher(s);<NEW_LINE>found = reMatcher.find();<NEW_LINE>// month == Jan, Feb, ...<NEW_LINE>monthType = 3;<NEW_LINE>}<NEW_LINE>if (!found) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>String day;<NEW_LINE>String year;<NEW_LINE>if (monthType == 3) {<NEW_LINE>day = reMatcher.group(3);<NEW_LINE>year = reMatcher.group(4);<NEW_LINE>} else {<NEW_LINE>day = reMatcher.group(2);<NEW_LINE>year = reMatcher.group(3);<NEW_LINE>}<NEW_LINE>exp.addAll(number.expandOrdinal(doc, day + ".", false));<NEW_LINE>String month = reMatcher.group(1);<NEW_LINE>if (monthType == 1) {<NEW_LINE>if (month.charAt(0) == '0')<NEW_LINE>month = month.substring(1);<NEW_LINE>String expandedMonth = (String) monthabbr.get(month);<NEW_LINE>exp.addAll(makeNewTokens(doc, expandedMonth));<NEW_LINE>// alternatively: keep the number:<NEW_LINE>// exp.addAll(number.expandInteger(doc, month, false));<NEW_LINE>} else if (monthType == 2) {<NEW_LINE>exp.addAll(makeNewTokens(doc, month));<NEW_LINE>} else {<NEW_LINE>// monthType == 3<NEW_LINE>String expandedMonth = (String) monthabbr.get(month);<NEW_LINE>exp.addAll<MASK><NEW_LINE>}<NEW_LINE>exp.addAll(expandDateYear(doc, year));<NEW_LINE>return exp;<NEW_LINE>} | (makeNewTokens(doc, expandedMonth)); |
1,478,740 | private void updateDescription() {<NEW_LINE>String description = null;<NEW_LINE>if (selectedType.isDefault()) {<NEW_LINE>String pattern = app.getString(R.string.route_line_use_map_style_color);<NEW_LINE>description = String.format(pattern, app.getRendererRegistry().getSelectedRendererName());<NEW_LINE>} else if (selectedType.isCustomColor()) {<NEW_LINE>String pattern = app.getString(R.string.specify_color_for_map_mode);<NEW_LINE>String mapModeTitle = app.getString(isNightMap() ? NIGHT_TITLE_ID : DAY_TITLE_ID);<NEW_LINE>description = String.format(pattern, mapModeTitle.toLowerCase());<NEW_LINE>} else if (selectedType.isRouteInfoAttribute()) {<NEW_LINE>String key = selectedRouteInfoAttribute.replaceAll(ROUTE_INFO_PREFIX, "");<NEW_LINE>description = <MASK><NEW_LINE>} else {<NEW_LINE>description = app.getString(R.string.route_line_use_gradient_coloring);<NEW_LINE>}<NEW_LINE>AndroidUiHelper.updateVisibility(tvDescription, description != null);<NEW_LINE>tvDescription.setText(description != null ? description : "");<NEW_LINE>} | AndroidUtils.getStringRouteInfoPropertyDescription(app, key); |
1,478,437 | public void cancelTransference(OCFile file) {<NEW_LINE>User currentUser = fileActivity.getUser().orElseThrow(IllegalStateException::new);<NEW_LINE>if (file.isFolder()) {<NEW_LINE>OperationsService.OperationsServiceBinder opsBinder = fileActivity.getOperationsServiceBinder();<NEW_LINE>if (opsBinder != null) {<NEW_LINE>opsBinder.cancel(currentUser.toPlatformAccount(), file);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// for both files and folders<NEW_LINE>FileDownloaderBinder downloaderBinder = fileActivity.getFileDownloaderBinder();<NEW_LINE>if (downloaderBinder != null && downloaderBinder.isDownloading(currentUser, file)) {<NEW_LINE>downloaderBinder.cancel(currentUser.toPlatformAccount(), file);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>if (uploaderBinder != null && uploaderBinder.isUploading(currentUser, file)) {<NEW_LINE>uploaderBinder.cancel(currentUser.toPlatformAccount(), file);<NEW_LINE>}<NEW_LINE>} | FileUploaderBinder uploaderBinder = fileActivity.getFileUploaderBinder(); |
46,609 | public static ListRecordingOfDualTrackResponse unmarshall(ListRecordingOfDualTrackResponse listRecordingOfDualTrackResponse, UnmarshallerContext context) {<NEW_LINE>listRecordingOfDualTrackResponse.setRequestId(context.stringValue("ListRecordingOfDualTrackResponse.RequestId"));<NEW_LINE>listRecordingOfDualTrackResponse.setSuccess(context.booleanValue("ListRecordingOfDualTrackResponse.Success"));<NEW_LINE>listRecordingOfDualTrackResponse.setCode(context.stringValue("ListRecordingOfDualTrackResponse.Code"));<NEW_LINE>listRecordingOfDualTrackResponse.setMessage<MASK><NEW_LINE>listRecordingOfDualTrackResponse.setHttpStatusCode(context.integerValue("ListRecordingOfDualTrackResponse.HttpStatusCode"));<NEW_LINE>Recordings recordings = new Recordings();<NEW_LINE>recordings.setTotalCount(context.integerValue("ListRecordingOfDualTrackResponse.Recordings.TotalCount"));<NEW_LINE>recordings.setPageNumber(context.integerValue("ListRecordingOfDualTrackResponse.Recordings.PageNumber"));<NEW_LINE>recordings.setPageSize(context.integerValue("ListRecordingOfDualTrackResponse.Recordings.PageSize"));<NEW_LINE>List<Recording> list = new ArrayList<Recording>();<NEW_LINE>for (int i = 0; i < context.lengthValue("ListRecordingOfDualTrackResponse.Recordings.List.Length"); i++) {<NEW_LINE>Recording recording = new Recording();<NEW_LINE>recording.setContactId(context.stringValue("ListRecordingOfDualTrackResponse.Recordings.List[" + i + "].ContactId"));<NEW_LINE>recording.setContactType(context.stringValue("ListRecordingOfDualTrackResponse.Recordings.List[" + i + "].ContactType"));<NEW_LINE>recording.setAgentId(context.stringValue("ListRecordingOfDualTrackResponse.Recordings.List[" + i + "].AgentId"));<NEW_LINE>recording.setAgentName(context.stringValue("ListRecordingOfDualTrackResponse.Recordings.List[" + i + "].AgentName"));<NEW_LINE>recording.setCallingNumber(context.stringValue("ListRecordingOfDualTrackResponse.Recordings.List[" + i + "].CallingNumber"));<NEW_LINE>recording.setCalledNumber(context.stringValue("ListRecordingOfDualTrackResponse.Recordings.List[" + i + "].CalledNumber"));<NEW_LINE>recording.setStartTime(context.longValue("ListRecordingOfDualTrackResponse.Recordings.List[" + i + "].StartTime"));<NEW_LINE>recording.setDuration(context.integerValue("ListRecordingOfDualTrackResponse.Recordings.List[" + i + "].Duration"));<NEW_LINE>recording.setFileName(context.stringValue("ListRecordingOfDualTrackResponse.Recordings.List[" + i + "].FileName"));<NEW_LINE>recording.setFilePath(context.stringValue("ListRecordingOfDualTrackResponse.Recordings.List[" + i + "].FilePath"));<NEW_LINE>recording.setFileDescription(context.stringValue("ListRecordingOfDualTrackResponse.Recordings.List[" + i + "].FileDescription"));<NEW_LINE>recording.setChannel(context.stringValue("ListRecordingOfDualTrackResponse.Recordings.List[" + i + "].Channel"));<NEW_LINE>recording.setInstanceId(context.stringValue("ListRecordingOfDualTrackResponse.Recordings.List[" + i + "].InstanceId"));<NEW_LINE>list.add(recording);<NEW_LINE>}<NEW_LINE>recordings.setList(list);<NEW_LINE>listRecordingOfDualTrackResponse.setRecordings(recordings);<NEW_LINE>return listRecordingOfDualTrackResponse;<NEW_LINE>} | (context.stringValue("ListRecordingOfDualTrackResponse.Message")); |
1,361,556 | public Sequence<T> applySubsampling(@NonNull Sequence<T> sequence, @NonNull AtomicLong nextRandom) {<NEW_LINE>Sequence<T> result = new Sequence<>();<NEW_LINE>// subsampling implementation, if subsampling threshold met, just continue to next element<NEW_LINE>if (sampling > 0) {<NEW_LINE>result.setSequenceId(sequence.getSequenceId());<NEW_LINE>if (sequence.getSequenceLabels() != null)<NEW_LINE>result.setSequenceLabels(sequence.getSequenceLabels());<NEW_LINE>if (sequence.getSequenceLabel() != null)<NEW_LINE>result.setSequenceLabel(sequence.getSequenceLabel());<NEW_LINE>for (T element : sequence.getElements()) {<NEW_LINE><MASK><NEW_LINE>double ran = (Math.sqrt(element.getElementFrequency() / (sampling * numWords)) + 1) * (sampling * numWords) / element.getElementFrequency();<NEW_LINE>nextRandom.set(Math.abs(nextRandom.get() * 25214903917L + 11));<NEW_LINE>if (ran < (nextRandom.get() & 0xFFFF) / (double) 65536) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>result.addElement(element);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} else<NEW_LINE>return sequence;<NEW_LINE>} | double numWords = vocabCache.totalWordOccurrences(); |
869,078 | private void doProcess(ReadableArchive archive, ApplicationClientDescriptor desc, ClassLoader classLoader) throws IOException {<NEW_LINE>if (AnnotationUtils.getLogger().isLoggable(Level.FINE)) {<NEW_LINE>AnnotationUtils.getLogger().fine("archiveFile is " + archive.getURI().toASCIIString());<NEW_LINE>AnnotationUtils.getLogger().fine("classLoader is " + classLoader);<NEW_LINE>}<NEW_LINE>// always add main class<NEW_LINE><MASK><NEW_LINE>addScanClassName(mainClassName);<NEW_LINE>// add callback handle if it exist in appclient-client.xml<NEW_LINE>String callbackHandler = desc.getCallbackHandler();<NEW_LINE>if (callbackHandler != null && !callbackHandler.trim().equals("")) {<NEW_LINE>addScanClassName(desc.getCallbackHandler());<NEW_LINE>}<NEW_LINE>GenericAnnotationDetector detector = new GenericAnnotationDetector(managedBeanAnnotations);<NEW_LINE>if (detector.hasAnnotationInArchive(archive)) {<NEW_LINE>if (archive instanceof FileArchive) {<NEW_LINE>addScanDirectory(new File(archive.getURI()));<NEW_LINE>} else if (archive instanceof InputJarArchive) {<NEW_LINE>URI uriToAdd = archive.getURI();<NEW_LINE>addScanJar(scanJar(uriToAdd));<NEW_LINE>} else if (archive instanceof MultiReadableArchive) {<NEW_LINE>addScanURI(scanURI(((MultiReadableArchive) archive).getURI(1)));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>this.classLoader = classLoader;<NEW_LINE>// = archive;<NEW_LINE>this.archiveFile = null;<NEW_LINE>} | String mainClassName = desc.getMainClassName(); |
101,238 | private static Object[] createParameters(ConstructorOrMethod m, MethodParameters params, IAnnotationFinder finder, XmlSuite xmlSuite, String atName) {<NEW_LINE>List<Object> result = Lists.newArrayList();<NEW_LINE>String[] <MASK><NEW_LINE>Object[] extraParameters;<NEW_LINE>//<NEW_LINE>// Try to find an @Parameters annotation<NEW_LINE>//<NEW_LINE>IParametersAnnotation annotation = finder.findAnnotation(m, IParametersAnnotation.class);<NEW_LINE>Class<?>[] types = m.getParameterTypes();<NEW_LINE>if (null != annotation) {<NEW_LINE>String[] parameterNames = annotation.getValue();<NEW_LINE>extraParameters = createParametersForMethod(m, types, extraOptionalValues, atName, parameterNames, params, xmlSuite);<NEW_LINE>} else //<NEW_LINE>// Else, use the deprecated syntax<NEW_LINE>//<NEW_LINE>{<NEW_LINE>extraParameters = createParametersForMethod(m, types, extraOptionalValues, atName, new String[0], params, xmlSuite);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Add the extra parameters we found<NEW_LINE>//<NEW_LINE>Collections.addAll(result, extraParameters);<NEW_LINE>// If the method declared an Object[] parameter and we have parameter values, inject them<NEW_LINE>for (int i = 0; i < types.length; i++) {<NEW_LINE>if (Object[].class.equals(types[i])) {<NEW_LINE>result.add(i, params.parameterValues);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result.toArray(new Object[0]);<NEW_LINE>} | extraOptionalValues = extractOptionalValues(finder, m); |
606,205 | public SampleResult sample(Entry e) {<NEW_LINE>SampleResult res = new SampleResult();<NEW_LINE>boolean isSuccessful = false;<NEW_LINE>res.setSampleLabel(getName());<NEW_LINE>// TODO improve this<NEW_LINE>res.setSamplerData(getPropertyAsString(TEST));<NEW_LINE>LdapClient ldap = new LdapClient();<NEW_LINE>try {<NEW_LINE>ldap.connect(getServername(), getPort(), getRootdn(), getUsername(), getPassword());<NEW_LINE>if (getPropertyAsString(TEST).equals(ADD)) {<NEW_LINE>addTest(ldap, res);<NEW_LINE>} else if (getPropertyAsString(TEST).equals(DELETE)) {<NEW_LINE>deleteTest(ldap, res);<NEW_LINE>} else if (getPropertyAsString(TEST).equals(MODIFY)) {<NEW_LINE>modifyTest(ldap, res);<NEW_LINE>} else if (getPropertyAsString(TEST).equals(SEARCHBASE)) {<NEW_LINE>searchTest(ldap, res);<NEW_LINE>}<NEW_LINE>// TODO - needs more work ...<NEW_LINE>if (getPropertyAsString(TEST).equals(SEARCHBASE) && !searchFoundEntries) {<NEW_LINE>// TODO is this a sensible number? //$NON-NLS-1$<NEW_LINE>res.setResponseCode("201");<NEW_LINE>res.setResponseMessage("OK - no results");<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>res.setResponseCodeOK();<NEW_LINE>// $NON-NLS-1$<NEW_LINE>res.setResponseMessage("OK");<NEW_LINE>res.setResponseData("successful", null);<NEW_LINE>}<NEW_LINE>res.setDataType(SampleResult.TEXT);<NEW_LINE>isSuccessful = true;<NEW_LINE>} catch (Exception ex) {<NEW_LINE>log.error("Ldap client - ", ex);<NEW_LINE>// TODO distinguish errors better //$NON-NLS-1$<NEW_LINE>res.setResponseCode("500");<NEW_LINE>res.setResponseMessage(ex.toString());<NEW_LINE>isSuccessful = false;<NEW_LINE>} finally {<NEW_LINE>ldap.disconnect();<NEW_LINE>}<NEW_LINE>// Set if we were successful or not<NEW_LINE>res.setSuccessful(isSuccessful);<NEW_LINE>return res;<NEW_LINE>} | res.setResponseData("successful - no results", null); |
1,789,118 | public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o, boolean unknownLocation) {<NEW_LINE>if (tileBox.getZoom() >= START_ZOOM) {<NEW_LINE>int ex = (int) point.x;<NEW_LINE>int ey = (int) point.y;<NEW_LINE>int compare = getScaledTouchRadius(getApplication(), getRadiusPoi(tileBox));<NEW_LINE>int radius = compare * 3 / 2;<NEW_LINE>for (Map.Entry<LatLon, AvoidRoadInfo> entry : avoidSpecificRoads.getImpassableRoads().entrySet()) {<NEW_LINE>LatLon location = entry.getKey();<NEW_LINE>AvoidRoadInfo road = entry.getValue();<NEW_LINE>if (location != null && road != null) {<NEW_LINE>int x = (int) tileBox.getPixXFromLatLon(location.getLatitude(<MASK><NEW_LINE>int y = (int) tileBox.getPixYFromLatLon(location.getLatitude(), location.getLongitude());<NEW_LINE>if (calculateBelongs(ex, ey, x, y, compare)) {<NEW_LINE>compare = radius;<NEW_LINE>o.add(road);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ), location.getLongitude()); |
1,280,322 | protected Object doQuery(Object[] objs) {<NEW_LINE>List<String> result = null;<NEW_LINE>try {<NEW_LINE>if (objs == null || objs.length != 1) {<NEW_LINE>throw new Exception("chardet paramSize error!");<NEW_LINE>}<NEW_LINE>// check encoding for string<NEW_LINE>if (option != null && option.contains("v")) {<NEW_LINE>CharEncodingDetect detector = new CharEncodingDetect();<NEW_LINE>if (objs[0] instanceof String) {<NEW_LINE>String str = objs[0].toString();<NEW_LINE>result = detector.autoDetectEncoding(str.getBytes());<NEW_LINE>} else if (objs[0] instanceof byte[]) {<NEW_LINE>result = detector.autoDetectEncoding((byte[]) objs[0]);<NEW_LINE>}<NEW_LINE>if (result == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (result.size() == 1) {<NEW_LINE>return result.get(0);<NEW_LINE>} else {<NEW_LINE>Sequence seq = new Sequence(result.toArray(new String[result.size()]));<NEW_LINE>return seq;<NEW_LINE>}<NEW_LINE>} else if (objs[0] instanceof String) {<NEW_LINE>String sTmp = objs[0].toString();<NEW_LINE>String reg = "^(https?)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]";<NEW_LINE>if (isMatch(sTmp, reg)) {<NEW_LINE>// for url<NEW_LINE>String encoding = detectEncoding(new URL(sTmp));<NEW_LINE>return encoding;<NEW_LINE>} else {<NEW_LINE>// for file<NEW_LINE><MASK><NEW_LINE>if (file.exists()) {<NEW_LINE>String encoding = UniversalDetector.detectCharset(file);<NEW_LINE>return encoding;<NEW_LINE>} else {<NEW_LINE>Logger.info("File: " + objs[0].toString() + " not existed.");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (objs[0] instanceof FileObject) {<NEW_LINE>FileObject fo = (FileObject) objs[0];<NEW_LINE>// String charset = fo.getCharset();<NEW_LINE>IFile iff = fo.getFile();<NEW_LINE>if (iff.exists()) {<NEW_LINE>String encoding = UniversalDetector.detectCharset(iff.getInputStream());<NEW_LINE>return encoding;<NEW_LINE>} else {<NEW_LINE>Logger.info("File: " + objs[0].toString() + " not existed.");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>Logger.error(e.getMessage());<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | File file = new File(sTmp); |
644,120 | public void init() {<NEW_LINE>if (isInEditMode())<NEW_LINE>return;<NEW_LINE>LayoutInflater layoutInflater = LayoutInflater.from(getContext());<NEW_LINE>_drawerMode = Setup<MASK><NEW_LINE>setVisibility(GONE);<NEW_LINE>setBackgroundColor(Setup.appSettings().getDrawerBackgroundColor());<NEW_LINE>switch(_drawerMode) {<NEW_LINE>case Mode.GRID:<NEW_LINE>_drawerViewGrid = new AppDrawerGrid(getContext());<NEW_LINE>addView(_drawerViewGrid);<NEW_LINE>break;<NEW_LINE>case Mode.PAGE:<NEW_LINE>default:<NEW_LINE>_drawerViewPage = (AppDrawerPage) layoutInflater.inflate(R.layout.view_app_drawer_page, this, false);<NEW_LINE>addView(_drawerViewPage);<NEW_LINE>PagerIndicator indicator = (PagerIndicator) layoutInflater.inflate(R.layout.view_drawer_indicator, this, false);<NEW_LINE>addView(indicator);<NEW_LINE>_drawerViewPage.withHome(indicator);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} | .appSettings().getDrawerStyle(); |
85,625 | final GetTranscriptionJobResult executeGetTranscriptionJob(GetTranscriptionJobRequest getTranscriptionJobRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getTranscriptionJobRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetTranscriptionJobRequest> request = null;<NEW_LINE>Response<GetTranscriptionJobResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetTranscriptionJobRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getTranscriptionJobRequest));<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, "Transcribe");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetTranscriptionJob");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetTranscriptionJobResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetTranscriptionJobResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | endClientExecution(awsRequestMetrics, request, response); |
569,761 | private IntegrationContextImpl buildFromExecution(DelegateExecution execution) {<NEW_LINE>IntegrationContextImpl integrationContext = new IntegrationContextImpl();<NEW_LINE>integrationContext.setRootProcessInstanceId(execution.getRootProcessInstanceId());<NEW_LINE>integrationContext.setProcessInstanceId(execution.getProcessInstanceId());<NEW_LINE>integrationContext.setProcessDefinitionId(execution.getProcessDefinitionId());<NEW_LINE>integrationContext.setBusinessKey(execution.getProcessInstanceBusinessKey());<NEW_LINE>integrationContext.setClientId(execution.getCurrentActivityId());<NEW_LINE>integrationContext.<MASK><NEW_LINE>if (ExecutionEntity.class.isInstance(execution)) {<NEW_LINE>ExecutionContext executionContext = new ExecutionContext(ExecutionEntity.class.cast(execution));<NEW_LINE>ExecutionEntity processInstance = executionContext.getProcessInstance();<NEW_LINE>if (processInstance != null) {<NEW_LINE>integrationContext.setParentProcessInstanceId(processInstance.getParentProcessInstanceId());<NEW_LINE>integrationContext.setAppVersion(Objects.toString(processInstance.getAppVersion(), "1"));<NEW_LINE>}<NEW_LINE>// Let's try to resolve process definition attributes<NEW_LINE>ProcessDefinition processDefinition = executionContext.getProcessDefinition();<NEW_LINE>if (processDefinition != null) {<NEW_LINE>integrationContext.setProcessDefinitionKey(processDefinition.getKey());<NEW_LINE>integrationContext.setProcessDefinitionVersion(processDefinition.getVersion());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ServiceTask serviceTask = (ServiceTask) execution.getCurrentFlowElement();<NEW_LINE>if (serviceTask != null) {<NEW_LINE>integrationContext.setConnectorType(serviceTask.getImplementation());<NEW_LINE>integrationContext.setClientName(serviceTask.getName());<NEW_LINE>integrationContext.setClientType(ServiceTask.class.getSimpleName());<NEW_LINE>}<NEW_LINE>integrationContext.addInBoundVariables(inboundVariablesProvider.calculateInputVariables(execution));<NEW_LINE>return integrationContext;<NEW_LINE>} | setExecutionId(execution.getId()); |
1,427,509 | public void spawnTracks() {<NEW_LINE>// If there are no tracks then associate is not called. Reset() could have been called at associate is<NEW_LINE>// in an undefined state<NEW_LINE>if (tracksAll.size == 0) {<NEW_LINE>for (int i = 0; i < dstDesc.size; i++) {<NEW_LINE>Point2D_F64 loc = dstPixels.get(i);<NEW_LINE>addNewTrack(dstSet.get(i), loc.x, loc.y, dstDesc.get(i));<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// create new tracks from latest unassociated detected features<NEW_LINE>DogArray_I32 unassociated = associate.getUnassociatedDestination();<NEW_LINE>for (int i = 0; i < unassociated.size; i++) {<NEW_LINE>int indexDst = unassociated.get(i);<NEW_LINE>Point2D_F64 loc = dstPixels.get(indexDst);<NEW_LINE>addNewTrack(dstSet.get(i), loc.x, loc.y<MASK><NEW_LINE>}<NEW_LINE>} | , dstDesc.get(indexDst)); |
266,854 | protected Dimension calculateDimensions(final int originWidth, final int originHeight, final Dimension max) {<NEW_LINE>int resultWidth;<NEW_LINE>int resultHeight;<NEW_LINE>if (max.width < originWidth || max.height < originHeight) {<NEW_LINE>// scale image<NEW_LINE>final double hs = (originWidth <= max.width) ? 1.0 : ((double) max.width) / ((double) originWidth);<NEW_LINE>final double vs = (originHeight <= max.height) ? 1.0 : ((double) max.height) / ((double) originHeight);<NEW_LINE>final double scale = Math.min(hs, vs);<NEW_LINE>// if (!auth) scale = Math.min(scale, 0.6); // this is for copyright<NEW_LINE>// purpose<NEW_LINE>if (scale < 1.0) {<NEW_LINE>resultWidth = Math.max(1, (int) (originWidth * scale));<NEW_LINE>resultHeight = Math.max(1, (int) (originHeight * scale));<NEW_LINE>} else {<NEW_LINE>resultWidth = Math.max(1, originWidth);<NEW_LINE>resultHeight = Math.max(1, originHeight);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// do not scale<NEW_LINE>resultWidth = originWidth;<NEW_LINE>resultHeight = originHeight;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>} | return new Dimension(resultWidth, resultHeight); |
1,580,288 | public static String[] createHashTable(String[] values) {<NEW_LINE><MASK><NEW_LINE>int maxTableSize = Math.min(values.length * 5 / 2, tableSize + 10);<NEW_LINE>String[] bestTable = null;<NEW_LINE>int bestCollisionRatio = 0;<NEW_LINE>while (tableSize <= maxTableSize) {<NEW_LINE>String[] table = new String[tableSize];<NEW_LINE>int maxCollisionRatio = 0;<NEW_LINE>for (String key : values) {<NEW_LINE>int hashCode = key.hashCode();<NEW_LINE>int collisionRatio = 0;<NEW_LINE>while (true) {<NEW_LINE>int index = Integer.remainderUnsigned(hashCode++, table.length);<NEW_LINE>if (table[index] == null) {<NEW_LINE>table[index] = key;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>collisionRatio++;<NEW_LINE>}<NEW_LINE>maxCollisionRatio = Math.max(maxCollisionRatio, collisionRatio);<NEW_LINE>}<NEW_LINE>if (bestTable == null || bestCollisionRatio > maxCollisionRatio) {<NEW_LINE>bestCollisionRatio = maxCollisionRatio;<NEW_LINE>bestTable = table;<NEW_LINE>}<NEW_LINE>tableSize++;<NEW_LINE>}<NEW_LINE>return bestTable;<NEW_LINE>} | int tableSize = values.length * 2; |
1,394,473 | public void onCreate(Bundle savedInstanceState) {<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>setContentView(R.layout.lt_change_location_activity);<NEW_LINE>_mbwManager = MbwManager.getInstance(this);<NEW_LINE>LocalTraderManager ltManager = _mbwManager.getLocalTraderManager();<NEW_LINE>_btUse = findViewById(R.id.btUse);<NEW_LINE>_tvLocation = findViewById(R.id.tvLocation);<NEW_LINE>// Load intent parameters<NEW_LINE>_persist = getIntent().getBooleanExtra("persist", false);<NEW_LINE>_chosenAddress = GpsLocationEx.fromGpsLocation((GpsLocation) getIntent().getSerializableExtra("location"));<NEW_LINE>// Load saved state<NEW_LINE>if (savedInstanceState != null) {<NEW_LINE>_chosenAddress = (<MASK><NEW_LINE>}<NEW_LINE>if (_chosenAddress == null) {<NEW_LINE>_chosenAddress = ltManager.getUserLocation();<NEW_LINE>}<NEW_LINE>_btUse.setOnClickListener(useClickListener);<NEW_LINE>findViewById(R.id.btEnter).setOnClickListener(enterClickListener);<NEW_LINE>findViewById(R.id.btCrosshair).setOnClickListener(crossHairClickListener);<NEW_LINE>_gpsLocationCallback = new GpsLocationFetcher.Callback(this) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>protected void onGpsLocationObtained(GpsLocationEx location) {<NEW_LINE>TextView tvError = findViewById(R.id.tvError);<NEW_LINE>tvError.setVisibility(View.VISIBLE);<NEW_LINE>if (location != null) {<NEW_LINE>_chosenAddress = location;<NEW_LINE>updateUi();<NEW_LINE>} else {<NEW_LINE>new Toaster(ChangeLocationActivity.this).toast(R.string.lt_localization_not_available, false);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | GpsLocationEx) savedInstanceState.getSerializable("location"); |
1,648,299 | static ServerSocketChannel createServerSocketChannel(ILogger logger, EndpointConfig endpointConfig, InetAddress bindAddress, int port, int portCount, boolean isPortAutoIncrement, boolean isReuseAddress, boolean bindAny) {<NEW_LINE><MASK><NEW_LINE>if (port == 0) {<NEW_LINE>logger.info("No explicit port is given, system will pick up an ephemeral port.");<NEW_LINE>}<NEW_LINE>int portTrialCount = port > 0 && isPortAutoIncrement ? portCount : 1;<NEW_LINE>try {<NEW_LINE>return tryOpenServerSocketChannel(endpointConfig, bindAddress, port, isReuseAddress, portTrialCount, bindAny, logger);<NEW_LINE>} catch (IOException e) {<NEW_LINE>String message = "Cannot bind to a given address: " + bindAddress + ". Hazelcast cannot start. ";<NEW_LINE>if (isPortAutoIncrement) {<NEW_LINE>message += "Config-port: " + port + ", latest-port: " + (port + portTrialCount - 1);<NEW_LINE>} else {<NEW_LINE>message += "Port [" + port + "] is already in use and auto-increment is disabled.";<NEW_LINE>}<NEW_LINE>throw new HazelcastException(message, e);<NEW_LINE>}<NEW_LINE>} | logger.finest("inet reuseAddress:" + isReuseAddress); |
994,445 | public Object list(DataCommandsParam dataCommandsParam) {<NEW_LINE>String command = dataCommandsParam.getCommand();<NEW_LINE>String[] <MASK><NEW_LINE>String cmd = command.toUpperCase();<NEW_LINE>String key = list[1];<NEW_LINE>String[] items = removeCommandAndKey(list);<NEW_LINE>Object result = null;<NEW_LINE>if (cmd.startsWith(LPUSH)) {<NEW_LINE>result = jedisCluster.lpush(key, items);<NEW_LINE>} else if (cmd.startsWith(RPUSH)) {<NEW_LINE>result = jedisCluster.rpush(key, items);<NEW_LINE>} else if (cmd.startsWith(LINDEX)) {<NEW_LINE>result = jedisCluster.lindex(key, Integer.parseInt(list[2]));<NEW_LINE>} else if (cmd.startsWith(LLEN)) {<NEW_LINE>result = jedisCluster.llen(key);<NEW_LINE>} else if (cmd.startsWith(LRANGE)) {<NEW_LINE>int start = Integer.parseInt(list[2]);<NEW_LINE>int stop = Integer.parseInt(list[3]);<NEW_LINE>result = jedisCluster.lrange(key, start, stop);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | list = SignUtil.splitBySpace(command); |
1,152,379 | public void decode(byte[] a) {<NEW_LINE>ByteBuffer byteBuffer = ByteBuffer.wrap(a);<NEW_LINE>this.transactionId = byteBuffer.getLong();<NEW_LINE>this.branchId = byteBuffer.getLong();<NEW_LINE>int resourceLen = byteBuffer.getInt();<NEW_LINE>if (resourceLen > 0) {<NEW_LINE>byte[] byResource = new byte[resourceLen];<NEW_LINE>byteBuffer.get(byResource);<NEW_LINE>this.resourceId = new String(byResource);<NEW_LINE>}<NEW_LINE>int lockKeyLen = byteBuffer.getInt();<NEW_LINE>if (lockKeyLen > 0) {<NEW_LINE>byte[] byLockKey = new byte[lockKeyLen];<NEW_LINE>byteBuffer.get(byLockKey);<NEW_LINE>if (CompressUtil.isCompressData(byLockKey)) {<NEW_LINE>try {<NEW_LINE>this.lockKey = new String(CompressUtil.uncompress(byLockKey));<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new RuntimeException("decompress lockKey error", e);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>this.lockKey = new String(byLockKey);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>short clientIdLen = byteBuffer.getShort();<NEW_LINE>if (clientIdLen > 0) {<NEW_LINE>byte[] byClientId = new byte[clientIdLen];<NEW_LINE>byteBuffer.get(byClientId);<NEW_LINE>this.clientId = new String(byClientId);<NEW_LINE>}<NEW_LINE>int applicationDataLen = byteBuffer.getInt();<NEW_LINE>if (applicationDataLen > 0) {<NEW_LINE>byte[] byApplicationData = new byte[applicationDataLen];<NEW_LINE>byteBuffer.get(byApplicationData);<NEW_LINE>this.applicationData = new String(byApplicationData);<NEW_LINE>}<NEW_LINE>int xidLen = byteBuffer.getInt();<NEW_LINE>if (xidLen > 0) {<NEW_LINE>byte[] xidBytes = new byte[xidLen];<NEW_LINE>byteBuffer.get(xidBytes);<NEW_LINE>this.xid = new String(xidBytes);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>if (branchTypeId >= 0) {<NEW_LINE>this.branchType = BranchType.values()[branchTypeId];<NEW_LINE>}<NEW_LINE>this.status = BranchStatus.get(byteBuffer.get());<NEW_LINE>} | int branchTypeId = byteBuffer.get(); |
203,829 | private void showSubject(SslCertificate.DName subject, View dialogView) {<NEW_LINE>TextView cnView = dialogView.findViewById(R.id.value_subject_CN);<NEW_LINE>cnView.setText(subject.getCName());<NEW_LINE>cnView.setVisibility(View.VISIBLE);<NEW_LINE>TextView oView = dialogView.findViewById(R.id.value_subject_O);<NEW_LINE>oView.setText(subject.getOName());<NEW_LINE>oView.setVisibility(View.VISIBLE);<NEW_LINE>TextView ouView = dialogView.findViewById(R.id.value_subject_OU);<NEW_LINE>ouView.<MASK><NEW_LINE>ouView.setVisibility(View.VISIBLE);<NEW_LINE>// SslCertificates don't offer this information<NEW_LINE>dialogView.findViewById(R.id.value_subject_C).setVisibility(View.GONE);<NEW_LINE>dialogView.findViewById(R.id.value_subject_ST).setVisibility(View.GONE);<NEW_LINE>dialogView.findViewById(R.id.value_subject_L).setVisibility(View.GONE);<NEW_LINE>dialogView.findViewById(R.id.label_subject_C).setVisibility(View.GONE);<NEW_LINE>dialogView.findViewById(R.id.label_subject_ST).setVisibility(View.GONE);<NEW_LINE>dialogView.findViewById(R.id.label_subject_L).setVisibility(View.GONE);<NEW_LINE>} | setText(subject.getUName()); |
248,411 | public static File downloadURLUsingProxyAndSave(URL downloadURL, Proxy proxy, File saveFile) throws IOException {<NEW_LINE>IOException expn = null;<NEW_LINE>URLConnection ucn = null;<NEW_LINE>if (Thread.currentThread().isInterrupted())<NEW_LINE>return null;<NEW_LINE>if (proxy != null)<NEW_LINE>ucn = downloadURL.openConnection(proxy);<NEW_LINE>else<NEW_LINE>ucn = downloadURL.openConnection();<NEW_LINE>if (Thread.currentThread().isInterrupted())<NEW_LINE>return null;<NEW_LINE>ucn.connect();<NEW_LINE>byte[] buffer = new byte[1024];<NEW_LINE>BufferedInputStream bis = new BufferedInputStream(ucn.getInputStream());<NEW_LINE>saveFile.getParentFile().mkdirs();<NEW_LINE>BufferedOutputStream bos = null;<NEW_LINE>try {<NEW_LINE>bos = new BufferedOutputStream(new FileOutputStream(saveFile));<NEW_LINE>} catch (FileNotFoundException ex) {<NEW_LINE>bis.close();<NEW_LINE>throw ex;<NEW_LINE>}<NEW_LINE>int len = 1024;<NEW_LINE>while ((len = bis.read(buffer, 0, 1024)) > 0) {<NEW_LINE>try {<NEW_LINE>if (Thread.currentThread().isInterrupted())<NEW_LINE>break;<NEW_LINE>Thread.sleep(10);<NEW_LINE>} catch (InterruptedException ex) {<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>bos.<MASK><NEW_LINE>} catch (IOException e) {<NEW_LINE>expn = e;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>bis.close();<NEW_LINE>} catch (IOException ex) {<NEW_LINE>// cant do much: ignore<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>bos.close();<NEW_LINE>} catch (IOException ex) {<NEW_LINE>// cant do much: ignore<NEW_LINE>}<NEW_LINE>if (expn != null)<NEW_LINE>throw expn;<NEW_LINE>return saveFile;<NEW_LINE>} | write(buffer, 0, len); |
1,234,297 | void draw(Graphics g) {<NEW_LINE>int segments = 16;<NEW_LINE>int i;<NEW_LINE>int ox = 0;<NEW_LINE>// int hs = sim.euroResistorCheckItem.getState() ? 6 : 8;<NEW_LINE>int hs = 6;<NEW_LINE>double v1 = volts[0];<NEW_LINE>double v2 = volts[1];<NEW_LINE>setBbox(point1, point2, hs);<NEW_LINE>draw2Leads(g);<NEW_LINE>// double segf = 1./segments;<NEW_LINE>double <MASK><NEW_LINE>g.context.save();<NEW_LINE>g.context.setLineWidth(3.0);<NEW_LINE>g.context.transform(((double) (lead2.x - lead1.x)) / len, ((double) (lead2.y - lead1.y)) / len, -((double) (lead2.y - lead1.y)) / len, ((double) (lead2.x - lead1.x)) / len, lead1.x, lead1.y);<NEW_LINE>if (sim.voltsCheckItem.getState()) {<NEW_LINE>CanvasGradient grad = g.context.createLinearGradient(0, 0, len, 0);<NEW_LINE>grad.addColorStop(0, getVoltageColor(g, v1).getHexValue());<NEW_LINE>grad.addColorStop(1.0, getVoltageColor(g, v2).getHexValue());<NEW_LINE>g.context.setStrokeStyle(grad);<NEW_LINE>} else<NEW_LINE>setPowerColor(g, true);<NEW_LINE>if (!sim.euroResistorCheckItem.getState()) {<NEW_LINE>g.context.beginPath();<NEW_LINE>g.context.moveTo(0, 0);<NEW_LINE>for (i = 0; i < 4; i++) {<NEW_LINE>g.context.lineTo((1 + 4 * i) * len / 16, hs);<NEW_LINE>g.context.lineTo((3 + 4 * i) * len / 16, -hs);<NEW_LINE>}<NEW_LINE>g.context.lineTo(len, 0);<NEW_LINE>g.context.stroke();<NEW_LINE>} else {<NEW_LINE>g.context.strokeRect(0, -hs, len, 2.0 * hs);<NEW_LINE>}<NEW_LINE>g.context.restore();<NEW_LINE>if (sim.showValuesCheckItem.getState()) {<NEW_LINE>String s = getShortUnitText(resistance, "");<NEW_LINE>drawValues(g, s, hs + 2);<NEW_LINE>}<NEW_LINE>doDots(g);<NEW_LINE>drawPosts(g);<NEW_LINE>} | len = distance(lead1, lead2); |
1,279,705 | protected void encodeQ(CameraState camera, double infx, double infy, double infz, DMatrixRMaj Q) {<NEW_LINE>// plane at infinity<NEW_LINE>p.data[0] = infx;<NEW_LINE><MASK><NEW_LINE>p.data[2] = infz;<NEW_LINE>encodeKK(camera, w);<NEW_LINE>CommonOps_DDRM.insert(w, Q, 0, 0);<NEW_LINE>CommonOps_DDRM.multTransA(p, w, pw);<NEW_LINE>double dot = CommonOps_DDRM.dot(pw, p);<NEW_LINE>for (int i = 0; i < 3; i++) {<NEW_LINE>Q.unsafe_set(i, 3, -pw.get(i));<NEW_LINE>Q.unsafe_set(3, i, -pw.get(i));<NEW_LINE>}<NEW_LINE>Q.unsafe_set(3, 3, dot);<NEW_LINE>} | p.data[1] = infy; |
1,712,322 | protected void entryPoint(String[] args) throws Exception {<NEW_LINE>JCommanderUtils.parseArgs(this, args);<NEW_LINE>SparkConf conf = new SparkConf();<NEW_LINE>conf.setAppName("DL4JTinyImageNetSparkPreproc");<NEW_LINE>JavaSparkContext sc = new JavaSparkContext(conf);<NEW_LINE>// Create training set<NEW_LINE>JavaRDD<String> filePathsTrain = SparkUtils.listPaths(sc, sourceDir + "/train", true, NativeImageLoader.ALLOWED_FORMATS);<NEW_LINE>SparkDataUtils.createFileBatchesSpark(<MASK><NEW_LINE>// Create test set<NEW_LINE>JavaRDD<String> filePathsTest = SparkUtils.listPaths(sc, sourceDir + "/test", true, NativeImageLoader.ALLOWED_FORMATS);<NEW_LINE>SparkDataUtils.createFileBatchesSpark(filePathsTest, saveDir, batchSize, sc);<NEW_LINE>System.out.println("----- Data Preprocessing Complete -----");<NEW_LINE>} | filePathsTrain, saveDir, batchSize, sc); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.