idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
612,541 | public boolean onActivate(Level level, Player player, Block block, Block target, BlockFace face, double fx, double fy, double fz) {<NEW_LINE>if (Rail.isRailBlock(target)) {<NEW_LINE>Rail.Orientation type = ((BlockRail) target).getOrientation();<NEW_LINE>double adjacent = 0.0D;<NEW_LINE>if (type.isAscending()) {<NEW_LINE>adjacent = 0.5D;<NEW_LINE>}<NEW_LINE>EntityMinecartTNT minecart = (EntityMinecartTNT) Entity.createEntity("MinecartTnt", level.getChunk(target.getFloorX() >> 4, target.getFloorZ() >> 4), new CompoundTag("").putList(new ListTag<>("Pos").add(new DoubleTag("", target.getX() + 0.5)).add(new DoubleTag("", target.getY() + 0.0625D + adjacent)).add(new DoubleTag("", target.getZ() + 0.5))).putList(new ListTag<>("Motion").add(new DoubleTag("", 0)).add(new DoubleTag("", 0)).add(new DoubleTag("", 0))).putList(new ListTag<>("Rotation").add(new FloatTag("", 0)).add(new FloatTag("", 0))));<NEW_LINE>if (minecart == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (player.isAdventure() || player.isSurvival()) {<NEW_LINE>Item item = player.getInventory().getItemInHand();<NEW_LINE>item.setCount(<MASK><NEW_LINE>player.getInventory().setItemInHand(item);<NEW_LINE>}<NEW_LINE>minecart.spawnToAll();<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | item.getCount() - 1); |
1,144,477 | protected void doApply(ApiRequest request, IPolicyContext context, IPListConfig config, IPolicyChain<ApiRequest> chain) {<NEW_LINE>String remoteAddr = getRemoteAddr(request, config);<NEW_LINE>if (isMatch(config, remoteAddr)) {<NEW_LINE>super.doApply(request, context, config, chain);<NEW_LINE>} else {<NEW_LINE>IPolicyFailureFactoryComponent ffactory = <MASK><NEW_LINE>// $NON-NLS-1$<NEW_LINE>String msg = Messages.i18n.format("IPWhitelistPolicy.NotWhitelisted", remoteAddr);<NEW_LINE>PolicyFailure failure = ffactory.createFailure(PolicyFailureType.Other, PolicyFailureCodes.IP_NOT_WHITELISTED, msg);<NEW_LINE>failure.setResponseCode(config.getResponseCode());<NEW_LINE>if (config.getResponseCode() == 404) {<NEW_LINE>failure.setType(PolicyFailureType.NotFound);<NEW_LINE>} else if (config.getResponseCode() == 403) {<NEW_LINE>failure.setType(PolicyFailureType.Authorization);<NEW_LINE>} else if (config.getResponseCode() == 0) {<NEW_LINE>failure.setResponseCode(500);<NEW_LINE>}<NEW_LINE>chain.doFailure(failure);<NEW_LINE>}<NEW_LINE>} | context.getComponent(IPolicyFailureFactoryComponent.class); |
1,833,810 | private static void addBulkdataOptions(Options opts) {<NEW_LINE>OptionGroup group = new OptionGroup();<NEW_LINE>group.addOption(Option.builder("B").longOpt("no-bulkdata").desc(rb.getString("no-bulkdata")).build());<NEW_LINE>group.addOption(Option.builder("b").longOpt("with-bulkdata").desc(rb.getString("with-bulkdata")).build());<NEW_LINE>opts.addOptionGroup(group);<NEW_LINE>opts.addOption(Option.builder("d").longOpt("blk-file-dir").hasArg().argName("directory").desc(rb.getString("blk-file-dir")).build());<NEW_LINE>opts.addOption(Option.builder().longOpt("blk-file-prefix").hasArg().argName("prefix").desc(rb.getString("blk-file-prefix")).build());<NEW_LINE>opts.addOption(Option.builder().longOpt("blk-file-suffix").hasArg().argName("suffix").desc(rb.getString("blk-file-dir")).build());<NEW_LINE>opts.addOption("c", "cat-blk-files", false, rb.getString("cat-blk-files"));<NEW_LINE>opts.addOption(null, "blk-nodefs", false, rb.getString("blk-nodefs"));<NEW_LINE>opts.addOption(Option.builder(null).longOpt("blk").hasArgs().argName("[seq.]attr").desc(rb.getString(<MASK><NEW_LINE>opts.addOption(Option.builder(null).longOpt("blk-vr").hasArgs().argName("vr[,...]=length").desc(rb.getString("blk-vr")).build());<NEW_LINE>} | "blk")).build()); |
649,976 | ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, String job) throws Exception {<NEW_LINE>ActionResult<List<Wo>> result = new ActionResult<>();<NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>Business business = new Business(emc);<NEW_LINE>if (!business.readableWithJob(effectivePerson, job)) {<NEW_LINE>throw new ExceptionAccessDenied(effectivePerson);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>CompletableFuture<List<WoTask>> future_tasks = CompletableFuture.supplyAsync(() -> {<NEW_LINE>return this.tasks(job);<NEW_LINE>});<NEW_LINE>CompletableFuture<List<WoTaskCompleted>> future_taskCompleteds = CompletableFuture.supplyAsync(() -> {<NEW_LINE>return this.taskCompleteds(job);<NEW_LINE>});<NEW_LINE>CompletableFuture<List<WoRead>> future_reads = CompletableFuture.supplyAsync(() -> {<NEW_LINE>return this.reads(job);<NEW_LINE>});<NEW_LINE>CompletableFuture<List<WoReadCompleted>> future_readCompleteds = CompletableFuture.supplyAsync(() -> {<NEW_LINE>return this.readCompleteds(job);<NEW_LINE>});<NEW_LINE>CompletableFuture<List<Wo>> future_workLogs = CompletableFuture.supplyAsync(() -> {<NEW_LINE>return this.workLogs(job);<NEW_LINE>});<NEW_LINE>List<WoTask> tasks = future_tasks.get();<NEW_LINE>List<WoTaskCompleted> taskCompleteds = future_taskCompleteds.get();<NEW_LINE>List<WoRead> reads = future_reads.get();<NEW_LINE>List<WoReadCompleted<MASK><NEW_LINE>List<Wo> wos = future_workLogs.get();<NEW_LINE>ListTools.groupStick(wos, tasks, WorkLog.fromActivityToken_FIELDNAME, Task.activityToken_FIELDNAME, taskList_FIELDNAME);<NEW_LINE>ListTools.groupStick(wos, taskCompleteds, WorkLog.fromActivityToken_FIELDNAME, TaskCompleted.activityToken_FIELDNAME, taskCompletedList_FIELDNAME);<NEW_LINE>ListTools.groupStick(wos, reads, WorkLog.fromActivityToken_FIELDNAME, Read.activityToken_FIELDNAME, readList_FIELDNAME);<NEW_LINE>ListTools.groupStick(wos, readCompleteds, WorkLog.fromActivityToken_FIELDNAME, ReadCompleted.activityToken_FIELDNAME, readCompletedList_FIELDNAME);<NEW_LINE>result.setData(wos);<NEW_LINE>return result;<NEW_LINE>} | > readCompleteds = future_readCompleteds.get(); |
259,250 | public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {<NEW_LINE>// ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_RENDERING,<NEW_LINE>// RenderingHints.VALUE_RENDER_QUALITY);<NEW_LINE>// TODO: change magic numbers to final fields<NEW_LINE>// match line color to default titledborder line color<NEW_LINE>g.setColor(new Color(165, 163, 151));<NEW_LINE>if (image == null && label == null) {<NEW_LINE>g.drawRoundRect(2, 2, c.getWidth() - 3, c.getHeight() - 3, 6, 6);<NEW_LINE>} else {<NEW_LINE>g.drawRoundRect(2, 12, c.getWidth() - 5, c.getHeight() - 13, 6, 6);<NEW_LINE>// clear the left and right handside of the image to show space between border line and<NEW_LINE>// image<NEW_LINE>g.<MASK><NEW_LINE>g.fillRect(8, 0, 24, 20);<NEW_LINE>g.drawImage(image, 10, 2, null);<NEW_LINE>int strx = image != null ? 30 : 5;<NEW_LINE>// clear the left and right of the label<NEW_LINE>FontMetrics metrics = g.getFontMetrics();<NEW_LINE>int stringHeight = metrics.getHeight();<NEW_LINE>int stringWidth = metrics.stringWidth(label);<NEW_LINE>g.fillRect(strx, 0, stringWidth + 5, stringHeight);<NEW_LINE>// set the area for mouse listener<NEW_LINE>if (image != null) {<NEW_LINE>imageBounds = new Rectangle(10, 2, image.getWidth(null) + stringWidth, image.getHeight(null));<NEW_LINE>// display impersonated image if impersonated<NEW_LINE>if (getToken() != null && getToken().isBeingImpersonated()) {<NEW_LINE>g.drawImage(AppStyle.impersonatePanelImage, (int) imageBounds.getMaxX() + 5, 4, null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>g.setColor(Color.BLACK);<NEW_LINE>g.drawString(label, strx + 3, (20 - stringHeight) / 2 + stringHeight - 2);<NEW_LINE>}<NEW_LINE>} | setColor(c.getBackground()); |
643,858 | public void validateDefinition() throws QuickFixException {<NEW_LINE>super.validateDefinition();<NEW_LINE>for (TokenDef def : tokens.values()) {<NEW_LINE>def.validateDefinition();<NEW_LINE>}<NEW_LINE>// tokens with providers are basically only expected to be used in isolation from other features<NEW_LINE>if (descriptorProvider != null || mapProvider != null) {<NEW_LINE>if (!tokens.isEmpty()) {<NEW_LINE>String msg = String.format("TokensDef %s must not specify tokens if using a provider", descriptor);<NEW_LINE>throw new InvalidDefinitionException(msg, getLocation());<NEW_LINE>}<NEW_LINE>if (!imports.isEmpty()) {<NEW_LINE>String msg = String.format("TokensDef %s must not specify imports if using a provider", descriptor);<NEW_LINE>throw new InvalidDefinitionException(msg, getLocation());<NEW_LINE>}<NEW_LINE>if (extendsDescriptor != null) {<NEW_LINE>String msg = String.format("TokensDef %s must not use 'extends' and 'provider' attributes together", descriptor);<NEW_LINE>throw new InvalidDefinitionException(msg, getLocation());<NEW_LINE>}<NEW_LINE>// namespace default tokens should not utilize a provider<NEW_LINE>DefDescriptor<TokensDef> nsTokens = Tokens.namespaceDefaultDescriptor(descriptor);<NEW_LINE>if (nsTokens.equals(descriptor)) {<NEW_LINE>String msg = String.format("Namespace-default token defs %s must not specify a provider", descriptor);<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | InvalidDefinitionException(msg, getLocation()); |
1,499,479 | protected void onCreate(Bundle savedInstanceState) {<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>setContentView(R.layout.activity_account_push_notifications);<NEW_LINE>final Intent intent = getIntent();<NEW_LINE>AccountJid account = getAccount(intent);<NEW_LINE>if (account == null) {<NEW_LINE>finish();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>accountItem = AccountManager.getInstance().getAccount(account);<NEW_LINE>if (accountItem == null) {<NEW_LINE>Application.getInstance().onError(R.string.NO_SUCH_ACCOUNT);<NEW_LINE>finish();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>toolbar = (Toolbar) findViewById(R.id.toolbar_default);<NEW_LINE>toolbar.<MASK><NEW_LINE>toolbar.setNavigationOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>finish();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>toolbar.setTitle(R.string.account_push);<NEW_LINE>barPainter = new BarPainter(this, toolbar);<NEW_LINE>barPainter.updateWithAccountName(account);<NEW_LINE>switchPush = findViewById(R.id.switchPush);<NEW_LINE>rlPushSwitch = findViewById(R.id.rlPushSwitch);<NEW_LINE>tvPushState = findViewById(R.id.tvPushState);<NEW_LINE>rlPushSwitch.setOnClickListener(new View.OnClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(View v) {<NEW_LINE>AccountManager.getInstance().setPushEnabled(accountItem, !switchPush.isChecked());<NEW_LINE>updateSwitchButton();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | setNavigationIcon(R.drawable.ic_arrow_left_white_24dp); |
1,111,547 | public void processOpts() {<NEW_LINE>super.processOpts();<NEW_LINE>if (additionalProperties.containsKey(CURL_OPTIONS)) {<NEW_LINE>setCurlOptions(additionalProperties.get(CURL_OPTIONS).toString());<NEW_LINE>additionalProperties.<MASK><NEW_LINE>}<NEW_LINE>if (additionalProperties.containsKey(PROCESS_MARKDOWN)) {<NEW_LINE>setProcessMarkdown(convertPropertyToBooleanAndWriteBack(PROCESS_MARKDOWN));<NEW_LINE>}<NEW_LINE>if (additionalProperties.containsKey(GENERATE_BASH_COMPLETION)) {<NEW_LINE>setGenerateBashCompletion(convertPropertyToBooleanAndWriteBack(GENERATE_BASH_COMPLETION));<NEW_LINE>}<NEW_LINE>if (additionalProperties.containsKey(GENERATE_ZSH_COMPLETION)) {<NEW_LINE>setGenerateZshCompletion(convertPropertyToBooleanAndWriteBack(GENERATE_ZSH_COMPLETION));<NEW_LINE>}<NEW_LINE>if (additionalProperties.containsKey(SCRIPT_NAME)) {<NEW_LINE>setScriptName(additionalProperties.get(SCRIPT_NAME).toString());<NEW_LINE>}<NEW_LINE>additionalProperties.put("x-codegen-script-name", scriptName);<NEW_LINE>if (additionalProperties.containsKey(HOST_ENVIRONMENT_VARIABLE_NAME)) {<NEW_LINE>setHostEnvironmentVariable(additionalProperties.get(HOST_ENVIRONMENT_VARIABLE_NAME).toString());<NEW_LINE>additionalProperties.put("x-codegen-host-env", hostEnvironmentVariable);<NEW_LINE>}<NEW_LINE>if (additionalProperties.containsKey(BASIC_AUTH_ENVIRONMENT_VARIABLE_NAME)) {<NEW_LINE>setBasicAuthEnvironmentVariable(additionalProperties.get(BASIC_AUTH_ENVIRONMENT_VARIABLE_NAME).toString());<NEW_LINE>additionalProperties.put("x-codegen-basicauth-env", basicAuthEnvironmentVariable);<NEW_LINE>}<NEW_LINE>if (additionalProperties.containsKey(APIKEY_AUTH_ENVIRONMENT_VARIABLE_NAME)) {<NEW_LINE>setApiKeyAuthEnvironmentVariable(additionalProperties.get(APIKEY_AUTH_ENVIRONMENT_VARIABLE_NAME).toString());<NEW_LINE>additionalProperties.put("x-codegen-apikey-env", apiKeyAuthEnvironmentVariable);<NEW_LINE>}<NEW_LINE>supportingFiles.add(new SupportingFile("client.mustache", "", scriptName));<NEW_LINE>supportingFiles.add(new SupportingFile("bash-completion.mustache", "", scriptName + ".bash-completion"));<NEW_LINE>supportingFiles.add(new SupportingFile("zsh-completion.mustache", "", "_" + scriptName));<NEW_LINE>supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));<NEW_LINE>supportingFiles.add(new SupportingFile("Dockerfile.mustache", "", "Dockerfile"));<NEW_LINE>} | put("x-codegen-curl-options", this.curlOptions); |
1,507,040 | public Chart apply(@Nonnull final EntityResponse entityResponse) {<NEW_LINE>final Chart result = new Chart();<NEW_LINE>result.setUrn(entityResponse.getUrn().toString());<NEW_LINE>result.setType(EntityType.CHART);<NEW_LINE>EnvelopedAspectMap aspectMap = entityResponse.getAspects();<NEW_LINE>MappingHelper<Chart> mappingHelper = new MappingHelper<>(aspectMap, result);<NEW_LINE>mappingHelper.mapToResult(CHART_KEY_ASPECT_NAME, this::mapChartKey);<NEW_LINE>mappingHelper.mapToResult(CHART_INFO_ASPECT_NAME, this::mapChartInfo);<NEW_LINE>mappingHelper.mapToResult(CHART_QUERY_ASPECT_NAME, this::mapChartQuery);<NEW_LINE>mappingHelper.<MASK><NEW_LINE>mappingHelper.mapToResult(OWNERSHIP_ASPECT_NAME, (chart, dataMap) -> chart.setOwnership(OwnershipMapper.map(new Ownership(dataMap))));<NEW_LINE>mappingHelper.mapToResult(STATUS_ASPECT_NAME, (chart, dataMap) -> chart.setStatus(StatusMapper.map(new Status(dataMap))));<NEW_LINE>mappingHelper.mapToResult(GLOBAL_TAGS_ASPECT_NAME, this::mapGlobalTags);<NEW_LINE>mappingHelper.mapToResult(INSTITUTIONAL_MEMORY_ASPECT_NAME, (chart, dataMap) -> chart.setInstitutionalMemory(InstitutionalMemoryMapper.map(new InstitutionalMemory(dataMap))));<NEW_LINE>mappingHelper.mapToResult(GLOSSARY_TERMS_ASPECT_NAME, (chart, dataMap) -> chart.setGlossaryTerms(GlossaryTermsMapper.map(new GlossaryTerms(dataMap))));<NEW_LINE>mappingHelper.mapToResult(CONTAINER_ASPECT_NAME, this::mapContainers);<NEW_LINE>mappingHelper.mapToResult(DOMAINS_ASPECT_NAME, this::mapDomains);<NEW_LINE>mappingHelper.mapToResult(DEPRECATION_ASPECT_NAME, (chart, dataMap) -> chart.setDeprecation(DeprecationMapper.map(new Deprecation(dataMap))));<NEW_LINE>return mappingHelper.getResult();<NEW_LINE>} | mapToResult(EDITABLE_CHART_PROPERTIES_ASPECT_NAME, this::mapEditableChartProperties); |
1,798,758 | private void executeTask(@NotNull final PluginTaskExecution task) {<NEW_LINE>final PluginTaskOutput output = runTask(task);<NEW_LINE>// noinspection unchecked: generics extends a PluginTaskOutput<NEW_LINE>task.setOutputObject(output);<NEW_LINE>if (output.isAsync()) {<NEW_LINE>// handle async result<NEW_LINE>task.markAsAsync();<NEW_LINE>final ListenableFuture<Boolean<MASK><NEW_LINE>Preconditions.checkNotNull(asyncFuture, "Async future cannot be null for an async task");<NEW_LINE>Futures.addCallback(asyncFuture, new FutureCallback<Boolean>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onSuccess(@Nullable final Boolean result) {<NEW_LINE>// mark the task as done and increment the semaphore to make sure the thread runs<NEW_LINE>task.markAsDone();<NEW_LINE>semaphore.release();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onFailure(@NotNull final Throwable t) {<NEW_LINE>Exceptions.rethrowError("Exception at PluginTaskExecutor", t);<NEW_LINE>task.markAsDone();<NEW_LINE>semaphore.release();<NEW_LINE>}<NEW_LINE>}, MoreExecutors.directExecutor());<NEW_LINE>} else {<NEW_LINE>// directly execute result function<NEW_LINE>task.markAsDone();<NEW_LINE>executeDoneTask(task);<NEW_LINE>}<NEW_LINE>} | > asyncFuture = output.getAsyncFuture(); |
443,393 | private void downloadAndReadItemFiles(@NonNull Map<RemoteFile, SettingsItemReader<? extends SettingsItem>> remoteFilesForRead, @NonNull Map<File, RemoteFile> remoteFilesForDownload) throws IOException {<NEW_LINE>OsmandApplication app = backupHelper.getApp();<NEW_LINE>List<FileDownloadTask> fileDownloadTasks = new ArrayList<>();<NEW_LINE>for (Entry<File, RemoteFile> fileEntry : remoteFilesForDownload.entrySet()) {<NEW_LINE>fileDownloadTasks.add(new FileDownloadTask(fileEntry.getKey(), fileEntry.getValue()));<NEW_LINE>}<NEW_LINE>ThreadPoolTaskExecutor<FileDownloadTask> filesDownloadExecutor = createExecutor();<NEW_LINE>filesDownloadExecutor.run(fileDownloadTasks);<NEW_LINE>boolean hasDownloadErrors = hasDownloadErrors(fileDownloadTasks);<NEW_LINE>if (!hasDownloadErrors) {<NEW_LINE>List<ItemFileDownloadTask> itemFileDownloadTasks = new ArrayList<>();<NEW_LINE>for (Entry<File, RemoteFile> entry : remoteFilesForDownload.entrySet()) {<NEW_LINE>File tempFile = entry.getKey();<NEW_LINE>RemoteFile remoteFile = entry.getValue();<NEW_LINE>if (tempFile.exists()) {<NEW_LINE>SettingsItemReader<? extends SettingsItem> reader = remoteFilesForRead.get(remoteFile);<NEW_LINE>if (reader != null) {<NEW_LINE>itemFileDownloadTasks.add(new ItemFileDownloadTask(app, tempFile, reader));<NEW_LINE>} else {<NEW_LINE>throw new IOException("No reader for: " + tempFile.getName());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new IOException(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>ThreadPoolTaskExecutor<ItemFileDownloadTask> itemFilesDownloadExecutor = createExecutor();<NEW_LINE>itemFilesDownloadExecutor.run(itemFileDownloadTasks);<NEW_LINE>} else {<NEW_LINE>throw new IOException("Error downloading temp item files");<NEW_LINE>}<NEW_LINE>} | "No temp item file: " + tempFile.getName()); |
373,753 | public String executeCustomFormLogin(HttpClient httpclient, String url, String username, String password, String viewState, String[] cookies) throws Exception {<NEW_LINE>String methodName = "executeCustomFormLogin";<NEW_LINE>Log.info(logClass, methodName, "Submitting custom login form (POST) = " + url + ", username = " + username + ", password = " + password + ", viewState = " + viewState);<NEW_LINE>HttpPost postMethod = new HttpPost(url);<NEW_LINE>// postMethod.setEntity(new StringEntity(loginData));<NEW_LINE>List<NameValuePair> nvps = new ArrayList<NameValuePair>();<NEW_LINE>nvps.add(new BasicNameValuePair("form:username", username));<NEW_LINE>nvps.add(new BasicNameValuePair("form:password", password));<NEW_LINE>nvps.add(<MASK><NEW_LINE>nvps.add(new BasicNameValuePair("form_SUBMIT", "1"));<NEW_LINE>if (viewState != null) {<NEW_LINE>if (JakartaEE9Action.isActive()) {<NEW_LINE>nvps.add(new BasicNameValuePair("jakarta.faces.ViewState", viewState));<NEW_LINE>} else {<NEW_LINE>nvps.add(new BasicNameValuePair("javax.faces.ViewState", viewState));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>postMethod.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));<NEW_LINE>HttpResponse response = httpclient.execute(postMethod);<NEW_LINE>Log.info(logClass, methodName, "postMethod.getStatusCode(): " + response.getStatusLine().getStatusCode());<NEW_LINE>String content = EntityUtils.toString(response.getEntity());<NEW_LINE>EntityUtils.consume(response.getEntity());<NEW_LINE>Log.info(logClass, methodName, "contents : " + content);<NEW_LINE>// Verify redirect to servlet<NEW_LINE>int status = response.getStatusLine().getStatusCode();<NEW_LINE>assertTrue("Form login did not result in redirect: " + status, status == HttpServletResponse.SC_MOVED_TEMPORARILY);<NEW_LINE>Header header = response.getFirstHeader("Location");<NEW_LINE>String location = header.getValue();<NEW_LINE>Log.info(logClass, methodName, "Redirect location: " + location);<NEW_LINE>if (cookies != null) {<NEW_LINE>for (String cookie : cookies) {<NEW_LINE>Header cookieHeader = getCookieHeader(response, cookie);<NEW_LINE>assertCookie(cookieHeader.toString(), false, true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return location;<NEW_LINE>} | new BasicNameValuePair("form:j_id_e", "Login")); |
1,336,413 | public static SceneGraphImageObject fromJSONObject(SceneGraphImage img, JSONObject obj) {<NEW_LINE>List<String> names = (List<String<MASK><NEW_LINE>List<JSONArray> labelArrays = (List<JSONArray>) obj.get("labels");<NEW_LINE>List<List<CoreLabel>> labelsList = null;<NEW_LINE>if (labelArrays != null) {<NEW_LINE>labelsList = Generics.newArrayList(labelArrays.size());<NEW_LINE>for (JSONArray arr : labelArrays) {<NEW_LINE>List<CoreLabel> tokens = Generics.newArrayList(arr.size());<NEW_LINE>for (String str : (List<String>) arr) {<NEW_LINE>tokens.add(SceneGraphImageUtils.labelFromString(str));<NEW_LINE>}<NEW_LINE>labelsList.add(tokens);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>JSONObject boundingBoxObj = (JSONObject) obj.get("bbox");<NEW_LINE>int h = ((Number) boundingBoxObj.get("h")).intValue();<NEW_LINE>int w = ((Number) boundingBoxObj.get("w")).intValue();<NEW_LINE>int x = ((Number) boundingBoxObj.get("x")).intValue();<NEW_LINE>int y = ((Number) boundingBoxObj.get("y")).intValue();<NEW_LINE>SceneGraphImageBoundingBox boundingBox = new SceneGraphImageBoundingBox(h, w, x, y);<NEW_LINE>return new SceneGraphImageObject(boundingBox, names, labelsList);<NEW_LINE>} | >) obj.get("names"); |
416,361 | private void executeOther(RouteResultset rrs) {<NEW_LINE>TraceManager.TraceObject traceObject = TraceManager.serviceTrace(shardingService, "execute-for-dml");<NEW_LINE>ExecutableHandler executableHandler = null;<NEW_LINE>try {<NEW_LINE>if (rrs.getNodes().length == 1 && !rrs.isEnableLoadDataFlag()) {<NEW_LINE>executableHandler = new SingleNodeHandler(rrs, this);<NEW_LINE><MASK><NEW_LINE>} else if (ServerParse.SELECT == rrs.getSqlType() && rrs.getGroupByCols() != null) {<NEW_LINE>executableHandler = new MultiNodeSelectHandler(rrs, this);<NEW_LINE>setPreExecuteEnd(TraceResult.SqlTraceType.MULTI_NODE_GROUP);<NEW_LINE>} else if (ServerParse.LOAD_DATA_INFILE_SQL == rrs.getSqlType() && LoadDataBatch.getInstance().isEnableBatchLoadData()) {<NEW_LINE>executableHandler = new MultiNodeLoadDataHandler(rrs, this);<NEW_LINE>setPreExecuteEnd(TraceResult.SqlTraceType.MULTI_NODE_GROUP);<NEW_LINE>} else {<NEW_LINE>executableHandler = new MultiNodeQueryHandler(rrs, this);<NEW_LINE>setPreExecuteEnd(TraceResult.SqlTraceType.MULTI_NODE_QUERY);<NEW_LINE>}<NEW_LINE>setTraceSimpleHandler((ResponseHandler) executableHandler);<NEW_LINE>readyToDeliver();<NEW_LINE>try {<NEW_LINE>executableHandler.execute();<NEW_LINE>discard = true;<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.info(String.valueOf(shardingService) + rrs, e);<NEW_LINE>executableHandler.writeRemainBuffer();<NEW_LINE>executableHandler.clearAfterFailExecute();<NEW_LINE>setResponseTime(false);<NEW_LINE>shardingService.writeErrMessage(ErrorCode.ERR_HANDLE_DATA, e.toString());<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>if (executableHandler != null) {<NEW_LINE>TraceManager.log(ImmutableMap.of("executableHandler", executableHandler), traceObject);<NEW_LINE>}<NEW_LINE>TraceManager.finishSpan(traceObject);<NEW_LINE>}<NEW_LINE>} | setPreExecuteEnd(TraceResult.SqlTraceType.SINGLE_NODE_QUERY); |
1,259,658 | public static <T extends Set<OffsetRange>> NodeVisitor<T> createMarkOccurrencesNodeVisitor(EditorFeatureContext context, T result, NodeType... nodeTypesToMatch) {<NEW_LINE>final Snapshot snapshot = context.getSnapshot();<NEW_LINE>int astCaretOffset = snapshot.getEmbeddedOffset(context.getCaretOffset());<NEW_LINE>if (astCaretOffset == -1) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final Node current = NodeUtil.findNonTokenNodeAtOffset(context.getParseTreeRoot(), astCaretOffset);<NEW_LINE>if (current == null) {<NEW_LINE>// this may happen if the offset falls to the area outside the selectors rule node.<NEW_LINE>// (for example when the stylesheet starts or ends with whitespaces or comment and<NEW_LINE>// and the offset falls there).<NEW_LINE>// In such case root node (with null parent) is returned from NodeUtil.findNodeAtOffset()<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Set types = EnumSet.copyOf<MASK><NEW_LINE>if (!types.contains(current.type())) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final CharSequence selectedNamespacePrefixImage = current.image();<NEW_LINE>return new NodeVisitor<T>(result) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean visit(Node node) {<NEW_LINE>if (node.type() == current.type() && CharSequenceUtilities.textEquals(selectedNamespacePrefixImage, node.image())) {<NEW_LINE>OffsetRange documentNodeRange = Css3Utils.getDocumentOffsetRange(node, snapshot);<NEW_LINE>getResult().add(Css3Utils.getValidOrNONEOffsetRange(documentNodeRange));<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | (Arrays.asList(nodeTypesToMatch)); |
845,241 | public Object execute(ExecutionEvent event) throws ExecutionException {<NEW_LINE>IWorkbenchWindow <MASK><NEW_LINE>IWorkbenchPage page = window.getActivePage();<NEW_LINE>if (page != null) {<NEW_LINE>IEditorPart part = HandlerUtil.getActiveEditor(event);<NEW_LINE>if (part != null) {<NEW_LINE>page.activate(part);<NEW_LINE>// Now focus editor component inside if we can find a Vrapper instance for it<NEW_LINE>try {<NEW_LINE>InputInterceptor interceptor = VrapperPlugin.getDefault().findActiveInterceptor(part);<NEW_LINE>ISourceViewer viewer = interceptor.getPlatform().getUnderlyingSourceViewer();<NEW_LINE>StyledText textWidget = viewer.getTextWidget();<NEW_LINE>textWidget.setFocus();<NEW_LINE>// Find the key event used to trigger this handler (if any), send to editor<NEW_LINE>Object trigger = event.getTrigger();<NEW_LINE>if (trigger != null && trigger instanceof Event && ((Event) trigger).type == SWT.KeyDown) {<NEW_LINE>Event clone = cloneEvent((Event) trigger);<NEW_LINE>clone.widget = textWidget;<NEW_LINE>clone.doit = true;<NEW_LINE>invokeKeyEventNonReentrant(clone, textWidget);<NEW_LINE>}<NEW_LINE>} catch (IllegalThreadStateException e) {<NEW_LINE>VrapperLog.info("Handler was being executed reentrant, stopping");<NEW_LINE>} catch (VrapperPlatformException e) {<NEW_LINE>VrapperLog.error("No editor to focus, encountered platformexception", e);<NEW_LINE>} catch (UnknownEditorException e) {<NEW_LINE>VrapperLog.debug("No editor to focus on active page");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | window = HandlerUtil.getActiveWorkbenchWindowChecked(event); |
539,828 | private static void tryAssertion2StreamRangeCoercion(RegressionEnvironment env, AtomicInteger milestone, String epl, boolean isHasRangeReversal) {<NEW_LINE>env.compileDeployAddListenerMile(epl, "s0", milestone.getAndIncrement());<NEW_LINE>env.sendEventBean(new SupportBean_ST0("ST01", 10L));<NEW_LINE>env.sendEventBean(<MASK><NEW_LINE>env.sendEventBean(new SupportBean("E1", 9));<NEW_LINE>env.sendEventBean(new SupportBean("E1", 21));<NEW_LINE>env.assertEqualsNew("s0", "sumi", null);<NEW_LINE>env.sendEventBean(new SupportBean("E1", 13));<NEW_LINE>env.milestoneInc(milestone);<NEW_LINE>// range 10 to 20<NEW_LINE>env.sendEventBean(new SupportBean_ST0("ST0_1", 10L));<NEW_LINE>env.assertEqualsNew("s0", "sumi", 13);<NEW_LINE>// range 10 to 13<NEW_LINE>env.sendEventBean(new SupportBean_ST1("ST1_1", 13L));<NEW_LINE>env.assertEqualsNew("s0", "sumi", 13);<NEW_LINE>// range 13 to 13<NEW_LINE>env.sendEventBean(new SupportBean_ST0("ST0_2", 13L));<NEW_LINE>env.assertEqualsNew("s0", "sumi", 13);<NEW_LINE>env.milestoneInc(milestone);<NEW_LINE>env.sendEventBean(new SupportBean("E2", 14));<NEW_LINE>env.sendEventBean(new SupportBean("E3", 12));<NEW_LINE>// range 13 to 13<NEW_LINE>env.sendEventBean(new SupportBean_ST1("ST1_3", 13L));<NEW_LINE>env.assertEqualsNew("s0", "sumi", 13);<NEW_LINE>// range 13 to 20<NEW_LINE>env.sendEventBean(new SupportBean_ST1("ST1_4", 20L));<NEW_LINE>env.assertEqualsNew("s0", "sumi", 27);<NEW_LINE>env.milestoneInc(milestone);<NEW_LINE>// range 11 to 20<NEW_LINE>env.sendEventBean(new SupportBean_ST0("ST0_3", 11L));<NEW_LINE>env.assertEqualsNew("s0", "sumi", 39);<NEW_LINE>// range null to 16<NEW_LINE>env.sendEventBean(new SupportBean_ST0("ST0_4", null));<NEW_LINE>env.assertEqualsNew("s0", "sumi", null);<NEW_LINE>env.milestoneInc(milestone);<NEW_LINE>// range null to null<NEW_LINE>env.sendEventBean(new SupportBean_ST1("ST1_5", null));<NEW_LINE>env.assertEqualsNew("s0", "sumi", null);<NEW_LINE>// range 20 to null<NEW_LINE>env.sendEventBean(new SupportBean_ST0("ST0_5", 20L));<NEW_LINE>env.assertEqualsNew("s0", "sumi", null);<NEW_LINE>// range 20 to 13<NEW_LINE>env.sendEventBean(new SupportBean_ST1("ST1_6", 13L));<NEW_LINE>if (isHasRangeReversal) {<NEW_LINE>env.assertEqualsNew("s0", "sumi", 27);<NEW_LINE>} else {<NEW_LINE>env.assertEqualsNew("s0", "sumi", null);<NEW_LINE>}<NEW_LINE>env.undeployAll();<NEW_LINE>} | new SupportBean_ST1("ST11", 20L)); |
382,185 | public void evaluateCondition(Metadata metadata, Index index, Listener listener, TimeValue masterTimeout) {<NEW_LINE>IndicesStatsRequest request = new IndicesStatsRequest();<NEW_LINE>request.clear();<NEW_LINE>String indexName = index.getName();<NEW_LINE>request.indices(indexName);<NEW_LINE>getClient().admin().indices().stats(request, ActionListener.wrap((response) -> {<NEW_LINE>IndexStats indexStats = response.getIndex(indexName);<NEW_LINE>if (indexStats == null) {<NEW_LINE>// Index was probably deleted<NEW_LINE>logger.debug("got null shard stats for index {}, proceeding on the assumption it has been deleted", indexName);<NEW_LINE>listener.onResponse(true, null);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>boolean isCurrentlyLeaderIndex = Arrays.stream(indexStats.getShards()).map(ShardStats::getRetentionLeaseStats).map(Optional::ofNullable).map(o -> o.flatMap(stats -> Optional.ofNullable(stats.retentionLeases()))).map(o -> o.flatMap(leases -> Optional.ofNullable(leases.leases()))).map(o -> o.map(Collection::stream)).anyMatch(lease -> lease.isPresent() && lease.get().anyMatch(l -> CCR_LEASE_KEY.equals(<MASK><NEW_LINE>if (isCurrentlyLeaderIndex) {<NEW_LINE>listener.onResponse(false, new Info());<NEW_LINE>} else {<NEW_LINE>listener.onResponse(true, null);<NEW_LINE>}<NEW_LINE>}, listener::onFailure));<NEW_LINE>} | l.source()))); |
715,734 | public okhttp3.Call readNamespacedDeploymentStatusCall(String name, String namespace, String pretty, final ApiCallback _callback) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/apis/apps/v1/namespaces/{namespace}/deployments/{name}/status".replaceAll("\\{" + "name" + "\\}", localVarApiClient.escapeString(name.toString())).replaceAll("\\{" + "namespace" + "\\}", localVarApiClient.escapeString(namespace.toString()));<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();<NEW_LINE>if (pretty != null) {<NEW_LINE>localVarQueryParams.addAll(localVarApiClient.parameterToPair("pretty", pretty));<NEW_LINE>}<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, String> localVarCookieParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>final String[] localVarAccepts = { "application/json", "application/yaml", "application/vnd.kubernetes.protobuf" };<NEW_LINE>final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>if (localVarAccept != null) {<NEW_LINE>localVarHeaderParams.put("Accept", localVarAccept);<NEW_LINE>}<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>localVarHeaderParams.put("Content-Type", localVarContentType);<NEW_LINE>String[] localVarAuthNames <MASK><NEW_LINE>return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);<NEW_LINE>} | = new String[] { "BearerToken" }; |
1,462,367 | public List<Number> GetOutputState(@Options(NxtMotorPort.class) String motorPortLetter) {<NEW_LINE>String functionName = "GetOutputState";<NEW_LINE>if (!checkBluetooth(functionName)) {<NEW_LINE>return new ArrayList<Number>();<NEW_LINE>}<NEW_LINE>// Make sure motorPortLetter is a valid NxtMotorPort.<NEW_LINE>NxtMotorPort port = NxtMotorPort.fromUnderlyingValue(motorPortLetter);<NEW_LINE>if (port == null) {<NEW_LINE>form.dispatchErrorOccurredEvent(this, functionName, ErrorMessages.ERROR_NXT_INVALID_MOTOR_PORT, motorPortLetter);<NEW_LINE>return new ArrayList<Number>();<NEW_LINE>}<NEW_LINE>byte[] returnPackage = getOutputState(functionName, port);<NEW_LINE>if (returnPackage != null) {<NEW_LINE>List<Number> outputState = new ArrayList<Number>();<NEW_LINE>// Power (SBYTE -100 to 100)<NEW_LINE>outputState.add<MASK><NEW_LINE>// Mode (UBYTE)<NEW_LINE>outputState.add(getUBYTEValueFromBytes(returnPackage, 5));<NEW_LINE>// Regulation mode (UBYTE)<NEW_LINE>outputState.add(getUBYTEValueFromBytes(returnPackage, 6));<NEW_LINE>// TurnRatio (SBYTE -100 to 100)<NEW_LINE>outputState.add(getSBYTEValueFromBytes(returnPackage, 7));<NEW_LINE>// RunState (UBYTE)<NEW_LINE>outputState.add(getUBYTEValueFromBytes(returnPackage, 8));<NEW_LINE>// TachoLimit (ULONG)<NEW_LINE>outputState.add(getULONGValueFromBytes(returnPackage, 9));<NEW_LINE>// TachoCount (SLONG)<NEW_LINE>outputState.add(getSLONGValueFromBytes(returnPackage, 13));<NEW_LINE>// BlockTachoCount (SLONG)<NEW_LINE>outputState.add(getSLONGValueFromBytes(returnPackage, 17));<NEW_LINE>// RotationCount (SLONG)<NEW_LINE>outputState.add(getSLONGValueFromBytes(returnPackage, 21));<NEW_LINE>return outputState;<NEW_LINE>}<NEW_LINE>// invalid response<NEW_LINE>return new ArrayList<Number>();<NEW_LINE>} | (getSBYTEValueFromBytes(returnPackage, 4)); |
1,630,508 | public boolean triggerEvent(int id, int param) {<NEW_LINE>switch(id) {<NEW_LINE>case SET_KEEP_TICKS_EVENT:<NEW_LINE>recipeKeepTicks = param;<NEW_LINE>return true;<NEW_LINE>case SET_COOLDOWN_EVENT:<NEW_LINE>cooldown = param;<NEW_LINE>return true;<NEW_LINE>case CRAFT_EFFECT_EVENT:<NEW_LINE>{<NEW_LINE>if (level.isClientSide) {<NEW_LINE>for (int i = 0; i < 25; i++) {<NEW_LINE>float red = (float) Math.random();<NEW_LINE>float green = (float) Math.random();<NEW_LINE>float blue = (float) Math.random();<NEW_LINE>SparkleParticleData data = SparkleParticleData.sparkle((float) Math.random(), red, green, blue, 10);<NEW_LINE>level.addParticle(data, worldPosition.getX() + 0.5 + Math.random() * 0.4 - 0.2, worldPosition.getY() + 1, worldPosition.getZ() + 0.5 + Math.random() * 0.4 - 0.2, 0, 0, 0);<NEW_LINE>}<NEW_LINE>level.playLocalSound(worldPosition.getX(), worldPosition.getY(), worldPosition.getZ(), ModSounds.runeAltarCraft, SoundSource.<MASK><NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>return super.triggerEvent(id, param);<NEW_LINE>}<NEW_LINE>} | BLOCKS, 1F, 1F, false); |
1,821,380 | public ListRulesResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ListRulesResult listRulesResult = new ListRulesResult();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return listRulesResult;<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("Rules", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listRulesResult.setRules(new ListUnmarshaller<Rule>(RuleJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("NextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listRulesResult.setNextToken(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return listRulesResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,777,163 | protected void addPackageList(Content contentTree) throws IOException {<NEW_LINE>Content table = HtmlTree.TABLE(HtmlStyle.useSummary, 0, 3, 0, useTableSummary, getTableCaption(configuration.getResource("doclet.ClassUse_Packages.that.use.0", getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc)))));<NEW_LINE>table.addContent(getSummaryTableHeader(packageTableHeader, "col"));<NEW_LINE>Content tbody = new HtmlTree(HtmlTag.TBODY);<NEW_LINE>Iterator<PackageDoc> it = pkgSet.iterator();<NEW_LINE>for (int i = 0; it.hasNext(); i++) {<NEW_LINE>PackageDoc pkg = it.next();<NEW_LINE>HtmlTree tr = new HtmlTree(HtmlTag.TR);<NEW_LINE>if (i % 2 == 0) {<NEW_LINE>tr.addStyle(HtmlStyle.altColor);<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>addPackageUse(pkg, tr);<NEW_LINE>tbody.addContent(tr);<NEW_LINE>}<NEW_LINE>table.addContent(tbody);<NEW_LINE>Content li = HtmlTree.LI(HtmlStyle.blockList, table);<NEW_LINE>contentTree.addContent(li);<NEW_LINE>} | tr.addStyle(HtmlStyle.rowColor); |
1,394,957 | public Key decode(BsonReader reader, DecoderContext decoderContext) {<NEW_LINE>reader.readStartDocument();<NEW_LINE>final String ref = reader.readString("$ref");<NEW_LINE>reader.readName();<NEW_LINE>final BsonReaderMark mark = reader.getMark();<NEW_LINE>Object idValue = null;<NEW_LINE>EntityModel model = null;<NEW_LINE>final Iterator<EntityModel> iterator = datastore.getMapper().getClassesMappedToCollection(ref).iterator();<NEW_LINE>while (idValue == null && iterator.hasNext()) {<NEW_LINE>model = iterator.next();<NEW_LINE>try {<NEW_LINE>final PropertyModel idField = model.getIdProperty();<NEW_LINE>if (idField != null) {<NEW_LINE>final Class<?> idType = idField.getType();<NEW_LINE>idValue = datastore.getCodecRegistry().get(idType<MASK><NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>mark.reset();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (idValue == null) {<NEW_LINE>throw new MappingException("Could not map the Key to a type.");<NEW_LINE>}<NEW_LINE>reader.readEndDocument();<NEW_LINE>return new Key<>(model.getType(), ref, idValue);<NEW_LINE>} | ).decode(reader, decoderContext); |
1,653,046 | private void applyComponentChanges(Module context, EntityData.Prefab prefabData, PrefabData result) {<NEW_LINE>for (String removedComponent : prefabData.getRemovedComponentList()) {<NEW_LINE>ComponentMetadata<?> metadata = componentLibrary.resolve(removedComponent, context);<NEW_LINE>if (metadata != null) {<NEW_LINE>result.removeComponent(metadata.getType());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (EntityData.Component componentData : prefabData.getComponentList()) {<NEW_LINE>ComponentMetadata<?> metadata = componentLibrary.resolve(componentData.getType(), context);<NEW_LINE>if (metadata != null) {<NEW_LINE>Component existing = result.getComponent(metadata.getType());<NEW_LINE>if (existing != null) {<NEW_LINE>componentSerializer.deserializeOnto(existing, componentData, context);<NEW_LINE>} else {<NEW_LINE>Component newComponent = <MASK><NEW_LINE>if (newComponent != null) {<NEW_LINE>result.addComponent(newComponent);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (componentData.hasType()) {<NEW_LINE>logger.warn("Prefab '{}' contains unknown component '{}'", prefabData.getName(), componentData.getType());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | componentSerializer.deserialize(componentData, context); |
1,745,136 | final ListSamplesResult executeListSamples(ListSamplesRequest listSamplesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listSamplesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListSamplesRequest> request = null;<NEW_LINE>Response<ListSamplesResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new ListSamplesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listSamplesRequest));<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, "Device Farm");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListSamples");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListSamplesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListSamplesResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.RequestMarshallTime); |
1,241,714 | public PhpType complete(String s, Project project) {<NEW_LINE>int <MASK><NEW_LINE>if (endIndex == -1) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>String originalSignature = s.substring(0, endIndex);<NEW_LINE>String parameter = s.substring(endIndex + 1);<NEW_LINE>parameter = PhpTypeProviderUtil.getResolvedParameter(PhpIndex.getInstance(project), parameter);<NEW_LINE>if (parameter == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>PhpClass phpClass = EntityHelper.resolveShortcutName(project, parameter);<NEW_LINE>if (phpClass == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>PhpIndex phpIndex = PhpIndex.getInstance(project);<NEW_LINE>Collection<? extends PhpNamedElement> typeSignature = getTypeSignatureMagic(phpIndex, originalSignature);<NEW_LINE>// ->getRepository(SecondaryMarket::class)->findAll() => "findAll", but only if its a instance of this method;<NEW_LINE>// so non Doctrine method are already filtered<NEW_LINE>Set<String> resolveMethods = getObjectRepositoryCall(typeSignature).stream().map(PhpNamedElement::getName).collect(Collectors.toSet());<NEW_LINE>if (resolveMethods.isEmpty()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>PhpType phpType = new PhpType();<NEW_LINE>resolveMethods.stream().map(name -> name.equals("findAll") || name.startsWith("findBy") ? phpClass.getFQN() + "[]" : phpClass.getFQN()).collect(Collectors.toSet()).forEach(phpType::add);<NEW_LINE>return phpType;<NEW_LINE>} | endIndex = s.lastIndexOf(TRIM_KEY); |
372,562 | private void updatePosition(Drawing drawing) {<NEW_LINE>double size = SIZE / drawing.getScale();<NEW_LINE>double halfSize = size / 2d;<NEW_LINE>double arcSize = ARC_SIZE / drawing.getScale();<NEW_LINE>double margin = MARGIN / drawing.getScale();<NEW_LINE>this.shape.setRoundRect(0, 0, size, size, arcSize, arcSize);<NEW_LINE>// Create transformation for where to position the controller in relative space<NEW_LINE>AffineTransform t = getSelectionManager().getTransform();<NEW_LINE>Rectangle2D bounds = getSelectionManager().getRelativeShape().getBounds2D();<NEW_LINE>t.translate(bounds.getX(), bounds.getY());<NEW_LINE>if (location == Location.BOTTOM_RIGHT) {<NEW_LINE>t.translate(bounds.getWidth() + margin, -margin);<NEW_LINE>} else if (location == Location.TOP_LEFT) {<NEW_LINE>t.translate(-margin, bounds.getHeight() + margin);<NEW_LINE>} else if (location == Location.TOP_RIGHT) {<NEW_LINE>t.translate(bounds.getWidth() + margin, bounds.getHeight() + margin);<NEW_LINE>} else if (location == Location.BOTTOM_LEFT) {<NEW_LINE>t.translate(-margin, -margin);<NEW_LINE>} else if (location == Location.TOP) {<NEW_LINE>t.translate(bounds.getWidth() / 2d, bounds.getHeight() + margin);<NEW_LINE>} else if (location == Location.BOTTOM) {<NEW_LINE>t.translate(bounds.getWidth<MASK><NEW_LINE>} else if (location == Location.LEFT) {<NEW_LINE>t.translate(-margin, bounds.getHeight() / 2d);<NEW_LINE>} else if (location == Location.RIGHT) {<NEW_LINE>t.translate(bounds.getWidth() + margin, bounds.getHeight() / 2d);<NEW_LINE>}<NEW_LINE>// Transform the position from relative space to real space<NEW_LINE>Point2D center = new Point2D.Double();<NEW_LINE>t.transform(new Point2D.Double(0, 0), center);<NEW_LINE>this.transform = new AffineTransform();<NEW_LINE>this.transform.translate(center.getX() - halfSize, center.getY() - halfSize);<NEW_LINE>} | () / 2d, -margin); |
1,430,556 | public boolean next() {<NEW_LINE>if (lastParsedPos == tail) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (mapIter != null) {<NEW_LINE>if (mapIter.hasNext()) {<NEW_LINE>Map.Entry<String, Any> entry = mapIter.next();<NEW_LINE>key = entry.getKey();<NEW_LINE>value = entry.getValue();<NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>mapIter = null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>JsonIterator iter = JsonIteratorPool.borrowJsonIterator();<NEW_LINE>try {<NEW_LINE>iter.reset(data, lastParsedPos, tail);<NEW_LINE>key = CodegenAccess.readObjectFieldAsString(iter);<NEW_LINE>value = iter.readAny();<NEW_LINE>cache.put(key, value);<NEW_LINE>if (CodegenAccess.nextToken(iter) == ',') {<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>lastParsedPos = tail;<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new JsonException(e);<NEW_LINE>} finally {<NEW_LINE>JsonIteratorPool.returnJsonIterator(iter);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | lastParsedPos = CodegenAccess.head(iter); |
1,564,584 | // Calibration for one option. Distribute the calculation according to the type of volatility (Black/Normal)<NEW_LINE>private Pair<Double, Double> calibrationAtm(double forward, double shift, double beta, double rho, double nu, BusinessDayAdjustment bda, ZonedDateTime calibrationDateTime, DayCount dayCount, Period expiry, double volatility, ValueType volatilityType) {<NEW_LINE>double alphaStart = volatility / Math.<MASK><NEW_LINE>DoubleArray startParameters = DoubleArray.of(alphaStart, beta, rho, nu);<NEW_LINE>Pair<Double, Double> r;<NEW_LINE>if (volatilityType.equals(ValueType.NORMAL_VOLATILITY)) {<NEW_LINE>r = calibrateAtmShiftedFromNormalVolatilities(bda, calibrationDateTime, dayCount, expiry, forward, volatility, startParameters, shift);<NEW_LINE>} else {<NEW_LINE>if (volatilityType.equals(ValueType.BLACK_VOLATILITY)) {<NEW_LINE>r = calibrateAtmShiftedFromBlackVolatilities(bda, calibrationDateTime, dayCount, expiry, forward, volatility, 0.0, startParameters, shift);<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("Data type not supported");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return r;<NEW_LINE>} | pow(forward + shift, beta); |
1,296,551 | public List<Pair<ExecutionReference, ExecutableFlow>> handle(final ResultSet rs) throws SQLException {<NEW_LINE>if (!rs.next()) {<NEW_LINE>return Collections.emptyList();<NEW_LINE>}<NEW_LINE>final List<Pair<ExecutionReference, ExecutableFlow>> execFlows = new ArrayList<>();<NEW_LINE>do {<NEW_LINE>final int id = rs.getInt(1);<NEW_LINE>final int encodingType = rs.getInt(2);<NEW_LINE>final byte[] data = rs.getBytes(3);<NEW_LINE>if (data == null) {<NEW_LINE>ExecutionFlowDao.logger.error("Found a flow with empty data blob exec_id: " + id);<NEW_LINE>} else {<NEW_LINE>final EncodingType encType = EncodingType.fromInteger(encodingType);<NEW_LINE>final Status status = Status.fromInteger(rs.getInt(4));<NEW_LINE>try {<NEW_LINE>final ExecutableFlow exFlow = ExecutableFlow.createExecutableFlow(GZIPUtils.transformBytesToObject(data, encType), status);<NEW_LINE>final ExecutionReference ref = new ExecutionReference(id, exFlow.getDispatchMethod());<NEW_LINE>execFlows.add(new Pair<>(ref, exFlow));<NEW_LINE>} catch (final IOException e) {<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} while (rs.next());<NEW_LINE>return execFlows;<NEW_LINE>} | SQLException("Error retrieving flow data " + id, e); |
138,007 | public void testSSLRedirectGet(String url, String user, String password, String secureUrl, LibertyServer server) throws Exception {<NEW_LINE>String methodName = "testSSLRedirectGet";<NEW_LINE>Log.info(thisClass, methodName, "url = " + url + ", user = " + user + ", password = " + password);<NEW_LINE>DefaultHttpClient httpClient = new DefaultHttpClient();<NEW_LINE>httpClient.getCredentialsProvider().setCredentials(new AuthScope(AuthScope.ANY), new UsernamePasswordCredentials(user, password));<NEW_LINE>// Setup for SSL for HTTP port (not HTTPS port)<NEW_LINE>SSLHelper.establishSSLContext(httpClient, server.getHttpDefaultPort(), null);<NEW_LINE>try {<NEW_LINE>// access via http to validate redirect to https<NEW_LINE>Log.info(thisClass, methodName, "url = " + url);<NEW_LINE>sendRequestAndValidate(httpClient, url);<NEW_LINE>// access via https directly using SSL url<NEW_LINE>Log.info(<MASK><NEW_LINE>sendRequestAndValidate(httpClient, secureUrl);<NEW_LINE>} catch (Exception e) {<NEW_LINE>Log.info(thisClass, methodName, "Exception: " + e.getMessage());<NEW_LINE>}<NEW_LINE>Log.info(thisClass, methodName, "Exiting test " + methodName);<NEW_LINE>} | thisClass, methodName, "Access https port directly, secureUrl: " + secureUrl); |
1,166,425 | private static synchronized void startLogging(final AgentBuilder.RedefinitionStrategy redefinitionStrategy, final Instrumentation instrumentation, final EnumMap<ConfigOption, String> configOptions) {<NEW_LINE>if (null != logTransformer) {<NEW_LINE>throw new IllegalStateException("agent already instrumented");<NEW_LINE>}<NEW_LINE>EventConfiguration.init(configOptions.get(ENABLED_DRIVER_EVENT_CODES), configOptions.get(DISABLED_DRIVER_EVENT_CODES), configOptions.get(ENABLED_ARCHIVE_EVENT_CODES), configOptions.get(DISABLED_ARCHIVE_EVENT_CODES), configOptions.get(ENABLED_CLUSTER_EVENT_CODES)<MASK><NEW_LINE>if (DRIVER_EVENT_CODES.isEmpty() && ARCHIVE_EVENT_CODES.isEmpty() && CLUSTER_EVENT_CODES.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>EventLogAgent.instrumentation = instrumentation;<NEW_LINE>readerAgentRunner = new AgentRunner(new SleepingMillisIdleStrategy(SLEEP_PERIOD_MS), Throwable::printStackTrace, null, newReaderAgent(configOptions));<NEW_LINE>AgentBuilder agentBuilder = new AgentBuilder.Default(new ByteBuddy().with(TypeValidation.DISABLED)).disableClassFormatChanges().with(new AgentBuilderListener()).with(redefinitionStrategy);<NEW_LINE>agentBuilder = addDriverInstrumentation(agentBuilder);<NEW_LINE>agentBuilder = addArchiveInstrumentation(agentBuilder);<NEW_LINE>agentBuilder = addClusterInstrumentation(agentBuilder);<NEW_LINE>logTransformer = agentBuilder.installOn(instrumentation);<NEW_LINE>thread = new Thread(readerAgentRunner);<NEW_LINE>thread.setName("event-log-reader");<NEW_LINE>thread.setDaemon(true);<NEW_LINE>thread.start();<NEW_LINE>} | , configOptions.get(DISABLED_CLUSTER_EVENT_CODES)); |
1,523,867 | public void paint(GGlassPane glassPane, Graphics g) {<NEW_LINE>Rectangle defaultBounds = component.getBounds();<NEW_LINE>int width = (int) (defaultBounds.width * emphasis);<NEW_LINE>int height = (int) (defaultBounds.height * emphasis);<NEW_LINE>Rectangle emphasizedBounds = new Rectangle(defaultBounds.x, defaultBounds.y, width, height);<NEW_LINE>emphasizedBounds = SwingUtilities.convertRectangle(component.getParent(), emphasizedBounds, glassPane);<NEW_LINE>Graphics2D g2d = (Graphics2D) g;<NEW_LINE>int offsetX = emphasizedBounds.x - ((width - defaultBounds.width) >> 1);<NEW_LINE>int offsetY = emphasizedBounds.y - ((height - defaultBounds.height) >> 1);<NEW_LINE>g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);<NEW_LINE>//<NEW_LINE>// Shake code<NEW_LINE>//<NEW_LINE>if (lastDirection > 0) {<NEW_LINE>lastDirection = -.01;<NEW_LINE>lastDirection = -.01 * emphasis;<NEW_LINE>} else {<NEW_LINE>lastDirection = .01;<NEW_LINE>lastDirection = .01 * emphasis;<NEW_LINE>}<NEW_LINE>g2d.rotate(lastDirection, emphasizedBounds.getCenterX(), emphasizedBounds.getCenterY());<NEW_LINE>g.drawImage(image, offsetX, <MASK><NEW_LINE>} | offsetY, width, height, null); |
1,460,690 | // --------------------------------------------<NEW_LINE>@Metadata(description = "Constructs an n-point circle from a 2-point line giving the radius")<NEW_LINE>public static Geometry circleByRadiusLine(Geometry radiusLine, @Metadata(title = "Number of vertices") int nPts) {<NEW_LINE>Coordinate[] radiusPts = radiusLine.getCoordinates();<NEW_LINE>Coordinate center = radiusPts[0];<NEW_LINE>Coordinate radiusPt = radiusPts[1];<NEW_LINE>double dist = radiusPt.distance(center);<NEW_LINE>double angInc = 2 * Math.PI / (nPts - 1);<NEW_LINE>Coordinate[] circlePts = new Coordinate[nPts + 1];<NEW_LINE>circlePts[0] = radiusPt.copy();<NEW_LINE>circlePts[nPts] = radiusPt.copy();<NEW_LINE>double angStart = Angle.angle(center, radiusPt);<NEW_LINE>for (int i = 1; i < nPts; i++) {<NEW_LINE>double x = center.getX() + dist * Math.cos(angStart + i * angInc);<NEW_LINE>double y = center.getY() + dist * Math.<MASK><NEW_LINE>circlePts[i] = new Coordinate(x, y);<NEW_LINE>}<NEW_LINE>return radiusLine.getFactory().createPolygon(circlePts);<NEW_LINE>} | sin(angStart + i * angInc); |
752,556 | public static void convert(GrayS8 input, GrayI16 output) {<NEW_LINE>if (input.isSubimage() || output.isSubimage()) {<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, input.height, y -> {<NEW_LINE>for (int y = 0; y < input.height; y++) {<NEW_LINE>int indexSrc = input.getIndex(0, y);<NEW_LINE>int indexDst = output.getIndex(0, y);<NEW_LINE>for (int x = 0; x < input.width; x++) {<NEW_LINE>output.data[indexDst++] = (short) (<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} else {<NEW_LINE>final int N = input.width * input.height;<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopBlocks(0,N,(i0,i1)->{<NEW_LINE>int i0 = 0, i1 = N;<NEW_LINE>for (int i = i0; i < i1; i++) {<NEW_LINE>output.data[i] = (short) (input.data[i]);<NEW_LINE>}<NEW_LINE>// CONCURRENT_INLINE });<NEW_LINE>}<NEW_LINE>} | input.data[indexSrc++]); |
961,545 | protected <I extends RemoteExternalSystemService<S>, C extends I> I createService(@Nonnull Class<I> interfaceClass, @Nonnull final C impl) throws ClassNotFoundException, IllegalAccessException, InstantiationException, RemoteException {<NEW_LINE>if (!myStdOutputConfigured) {<NEW_LINE>myStdOutputConfigured = true;<NEW_LINE>System.setOut(new LineAwarePrintStream(System.out));<NEW_LINE>System.setErr(<MASK><NEW_LINE>}<NEW_LINE>I proxy = (I) Proxy.newProxyInstance(getClass().getClassLoader(), new Class<?>[] { interfaceClass }, new InvocationHandler() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {<NEW_LINE>myCallsInProgressNumber.incrementAndGet();<NEW_LINE>try {<NEW_LINE>return method.invoke(impl, args);<NEW_LINE>} finally {<NEW_LINE>myCallsInProgressNumber.decrementAndGet();<NEW_LINE>updateAutoShutdownTime();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return (I) UnicastRemoteObject.exportObject(proxy, 0);<NEW_LINE>} | new LineAwarePrintStream(System.err)); |
514,397 | private DoubleMatrix[] solveSensitivity(double[] xValues, double[] yValues) {<NEW_LINE>int nDataPts = xValues.length;<NEW_LINE>DoubleMatrix[] res = new DoubleMatrix[nDataPts];<NEW_LINE>double[][] coef = new double[nDataPts - 1][2];<NEW_LINE>for (int i = 0; i < nDataPts - 1; ++i) {<NEW_LINE>double[][] coefSensi = new double[2][nDataPts];<NEW_LINE>double intervalInv = 1d / (xValues[i + 1] - xValues[i]);<NEW_LINE>coef[i][1] = yValues[i];<NEW_LINE>coef[i][0] = (yValues[i + 1] - yValues[i]) * intervalInv;<NEW_LINE>coefSensi<MASK><NEW_LINE>coefSensi[0][i] = -intervalInv;<NEW_LINE>coefSensi[0][i + 1] = intervalInv;<NEW_LINE>res[i] = DoubleMatrix.ofUnsafe(coefSensi);<NEW_LINE>}<NEW_LINE>res[nDataPts - 1] = DoubleMatrix.ofUnsafe(coef);<NEW_LINE>return res;<NEW_LINE>} | [1][i] = 1d; |
1,705,490 | public void uploadPagesFromUrlWithResponseCodeSnippet() {<NEW_LINE>// BEGIN: com.azure.storage.blob.specialized.PageBlobAsyncClient.uploadPagesFromUrlWithResponse#PageRange-String-Long-byte-PageBlobRequestConditions-BlobRequestConditions<NEW_LINE>PageRange pageRange = new PageRange().setStart<MASK><NEW_LINE>InputStream dataStream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));<NEW_LINE>byte[] sourceContentMD5 = new byte[512];<NEW_LINE>PageBlobRequestConditions pageBlobRequestConditions = new PageBlobRequestConditions().setLeaseId(leaseId);<NEW_LINE>BlobRequestConditions sourceRequestConditions = new BlobRequestConditions().setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3));<NEW_LINE>client.uploadPagesFromUrlWithResponse(pageRange, url, sourceOffset, sourceContentMD5, pageBlobRequestConditions, sourceRequestConditions).subscribe(response -> System.out.printf("Uploaded page blob from URL with sequence number %s%n", response.getValue().getBlobSequenceNumber()));<NEW_LINE>// END: com.azure.storage.blob.specialized.PageBlobAsyncClient.uploadPagesFromUrlWithResponse#PageRange-String-Long-byte-PageBlobRequestConditions-BlobRequestConditions<NEW_LINE>} | (0).setEnd(511); |
718,783 | public void propertyChange(PropertyChangeEvent evt) {<NEW_LINE>if (evt.getPropertyName().equals(IssueImpl.EVENT_ISSUE_DATA_CHANGED)) {<NEW_LINE>setVisible(repoPanel, false);<NEW_LINE>setNameAndTooltip();<NEW_LINE>} else if (evt.getPropertyName().equals(RepositoryRegistry.EVENT_REPOSITORIES_CHANGED)) {<NEW_LINE>if (!repositoryComboBox.isEnabled()) {<NEW_LINE>// well, looks like there shuold be only one repository available<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>SwingUtilities.invokeLater(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>if (rs != null) {<NEW_LINE>rs.refreshRepositoryModel();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} else if (evt.getPropertyName().equals(IssueController.PROP_CHANGED)) {<NEW_LINE><MASK><NEW_LINE>boolean changed;<NEW_LINE>if (o instanceof Boolean) {<NEW_LINE>changed = (Boolean) o;<NEW_LINE>} else {<NEW_LINE>changed = getController().isChanged();<NEW_LINE>}<NEW_LINE>if (changed) {<NEW_LINE>if (getLookup().lookup(IssueSavable.class) == null) {<NEW_LINE>instanceContent.add(new IssueSavable(IssueTopComponent.this));<NEW_LINE>setNameAndTooltip();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>IssueSavable savable = getSavable();<NEW_LINE>if (savable != null) {<NEW_LINE>savable.destroy();<NEW_LINE>setNameAndTooltip();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Object o = evt.getNewValue(); |
1,467,478 | public void run() {<NEW_LINE>super.run();<NEW_LINE>if (parent.isDirty()) {<NEW_LINE>try {<NEW_LINE>Object value = parent.extractEditorValue();<NEW_LINE>if (value instanceof Date) {<NEW_LINE>editor.setValue((Date) value);<NEW_LINE>}<NEW_LINE>} catch (DBException e) {<NEW_LINE>DBWorkbench.getPlatformUI().showError(ResultSetMessages.dialog_value_view_dialog_error_updating_title, ResultSetMessages.dialog_value_view_dialog_error_updating_message, e);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Object value = parent.extractEditorValue();<NEW_LINE>if (!(value instanceof Date)) {<NEW_LINE>DBWorkbench.getPlatformUI().showWarningMessageBox(ResultSetMessages.dialog_value_view_error_parsing_date_title, NLS.bind(ResultSetMessages.dialog_value_view_error_parsing_date_message, value));<NEW_LINE>ModelPreferences.getPreferences().setValue(ModelPreferences.RESULT_SET_USE_DATETIME_EDITOR, false);<NEW_LINE>this.setChecked(false);<NEW_LINE><MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>editor.setToDateComposite();<NEW_LINE>} catch (DBException e) {<NEW_LINE>DBWorkbench.getPlatformUI().showError(ResultSetMessages.dialog_value_view_dialog_error_updating_title, ResultSetMessages.dialog_value_view_dialog_error_updating_message, e);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ModelPreferences.getPreferences().setValue(ModelPreferences.RESULT_SET_USE_DATETIME_EDITOR, true);<NEW_LINE>} | parent.textMode.setChecked(true); |
989,249 | public static final String doubleToString(double d) {<NEW_LINE>// Check for special cases<NEW_LINE>if (MathUtil.equals(d, 0))<NEW_LINE>return "0";<NEW_LINE>if (Double.isNaN(d))<NEW_LINE>return "NaN";<NEW_LINE>if (Double.isInfinite(d)) {<NEW_LINE>if (d < 0)<NEW_LINE>return "-Inf";<NEW_LINE>else<NEW_LINE>return "Inf";<NEW_LINE>}<NEW_LINE>final String sign = (d < 0) ? "-" : "";<NEW_LINE>double <MASK><NEW_LINE>// Small and large values always in exponential notation<NEW_LINE>if (abs < 0.001 || abs >= 100000000) {<NEW_LINE>return sign + exponentialFormat(abs);<NEW_LINE>}<NEW_LINE>// Check whether decimal or exponential notation is shorter<NEW_LINE>String exp = exponentialFormat(abs);<NEW_LINE>String dec = decimalFormat(abs);<NEW_LINE>if (dec.length() <= exp.length())<NEW_LINE>return sign + dec;<NEW_LINE>else<NEW_LINE>return sign + exp;<NEW_LINE>} | abs = Math.abs(d); |
646,303 | public void traceLocalVariableScope(LValueScopeDiscoverer scopeDiscoverer) {<NEW_LINE>// While it's not strictly speaking 2 blocks, we can model it as the statement / definition<NEW_LINE>// section of the for as being an enclosing block. (otherwise we add the variable in the wrong scope).<NEW_LINE>scopeDiscoverer.enterBlock(this);<NEW_LINE>for (Expression assignment : assignments) {<NEW_LINE>assignment.collectUsedLValues(scopeDiscoverer);<NEW_LINE>}<NEW_LINE>condition.collectUsedLValues(scopeDiscoverer);<NEW_LINE>if (initial != null) {<NEW_LINE>LValue lValue = initial.getCreatedLValue();<NEW_LINE>Expression expression = initial.getRValue();<NEW_LINE>Expression rhs = expression;<NEW_LINE>LValue lv2 = lValue;<NEW_LINE>do {<NEW_LINE>scopeDiscoverer.collect(lv2, ReadWrite.READ);<NEW_LINE>if (rhs instanceof AssignmentExpression) {<NEW_LINE>AssignmentExpression assignmentExpression = (AssignmentExpression) rhs;<NEW_LINE>lv2 = assignmentExpression.getlValue();<NEW_LINE>rhs = assignmentExpression.getrValue();<NEW_LINE>} else {<NEW_LINE>lv2 = null;<NEW_LINE>rhs = null;<NEW_LINE>}<NEW_LINE>} while (lv2 != null);<NEW_LINE>lValue.collectLValueAssignments(expression, this.getContainer(), scopeDiscoverer);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>scopeDiscoverer.leaveBlock(this);<NEW_LINE>} | scopeDiscoverer.processOp04Statement(getBody()); |
1,660,279 | private HeaderInfo addHeader(String id, String title, AERunnable runnable) {<NEW_LINE>Composite composite = new Composite(topArea, SWT.NONE);<NEW_LINE>HeaderInfo headerInfo = new HeaderInfo(id, runnable, composite);<NEW_LINE>FillLayout fillLayout = new FillLayout();<NEW_LINE>fillLayout.marginWidth = 6;<NEW_LINE>fillLayout.marginHeight = 2;<NEW_LINE>composite.setLayout(fillLayout);<NEW_LINE>Display d = composite.getDisplay();<NEW_LINE>composite.setBackground(Colors.getSystemColor(d, SWT.COLOR_LIST_BACKGROUND));<NEW_LINE>composite.setForeground(Colors.getSystemColor(d, SWT.COLOR_LIST_FOREGROUND));<NEW_LINE>Label control = new Label(composite, SWT.NONE);<NEW_LINE><MASK><NEW_LINE>control.setData("ID", headerInfo);<NEW_LINE>control.addListener(SWT.MouseEnter, headerListener);<NEW_LINE>control.addListener(SWT.Touch, headerListener);<NEW_LINE>control.addListener(SWT.MouseExit, headerListener);<NEW_LINE>control.addListener(SWT.Paint, headerListener);<NEW_LINE>listHeaders.add(headerInfo);<NEW_LINE>return headerInfo;<NEW_LINE>} | Messages.setLanguageText(control, title); |
312,866 | /*<NEW_LINE>* API to insert row in table<NEW_LINE>* */<NEW_LINE>public static void tableInsertRows(GCPResourceClient gcpResourceClient, Map<String, Object> rowContent) {<NEW_LINE>try {<NEW_LINE>// Initialize client that will be used to send requests. This client only needs to be created<NEW_LINE>// once, and can be reused for multiple requests.<NEW_LINE>BigQuery bigquery = gcpResourceClient.getBigQuery();<NEW_LINE>// Get table<NEW_LINE>TableId tableId = gcpResourceClient.getTableId();<NEW_LINE>// Inserts rowContent into datasetName:tableId.<NEW_LINE>InsertAllResponse response = bigquery.insertAll(InsertAllRequest.newBuilder(tableId).addRow(rowContent).build());<NEW_LINE>if (response.hasErrors()) {<NEW_LINE>// If any of the insertions failed, this lets you inspect the errors<NEW_LINE>for (Map.Entry<Long, List<BigQueryError>> entry : response.getInsertErrors().entrySet()) {<NEW_LINE>logger.log(Level.SEVERE, <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (BigQueryException e) {<NEW_LINE>logger.log(Level.SEVERE, "Insert operation not performed: " + e.toString());<NEW_LINE>}<NEW_LINE>} | "Bigquery row insert response error: " + entry.getValue()); |
782,534 | public Prel prepareForLateralUnnestPipeline(List<RelNode> children) {<NEW_LINE>List<Integer> groupingCols = Lists.newArrayList();<NEW_LINE>groupingCols.add(0);<NEW_LINE>for (int groupingCol : groupSet.asList()) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>ImmutableBitSet groupingSet = ImmutableBitSet.of(groupingCols);<NEW_LINE>List<ImmutableBitSet> groupingSets = Lists.newArrayList();<NEW_LINE>groupingSets.add(groupingSet);<NEW_LINE>List<AggregateCall> aggregateCalls = Lists.newArrayList();<NEW_LINE>for (AggregateCall aggCall : aggCalls) {<NEW_LINE>List<Integer> arglist = Lists.newArrayList();<NEW_LINE>for (int arg : aggCall.getArgList()) {<NEW_LINE>arglist.add(arg + 1);<NEW_LINE>}<NEW_LINE>aggregateCalls.add(AggregateCall.create(aggCall.getAggregation(), aggCall.isDistinct(), aggCall.isApproximate(), arglist, aggCall.filterArg, aggCall.type, aggCall.name));<NEW_LINE>}<NEW_LINE>return (Prel) copy(traitSet, children.get(0), indicator, groupingSet, groupingSets, aggregateCalls);<NEW_LINE>} | groupingCols.add(groupingCol + 1); |
887,122 | public void windowClosed(WindowEvent e) {<NEW_LINE>Preferences prefs = NbPreferences.forModule(org.netbeans.modules.project.uiapi.CustomizerDialog.class);<NEW_LINE>prefs.putInt(CUSTOMIZER_DIALOG_X, e.getWindow().getX());<NEW_LINE>prefs.putInt(CUSTOMIZER_DIALOG_Y, e.getWindow().getY());<NEW_LINE>prefs.putInt(CUSTOMIZER_DIALOG_WIDTH, e.<MASK><NEW_LINE>prefs.putInt(CUSTOMIZER_DIALOG_HEIGHT, e.getWindow().getHeight());<NEW_LINE>innerPane.clearPanelComponentCache();<NEW_LINE>List<ProjectCustomizer.Category> queue = new LinkedList<ProjectCustomizer.Category>(Arrays.asList(categories));<NEW_LINE>while (!queue.isEmpty()) {<NEW_LINE>ProjectCustomizer.Category category = queue.remove(0);<NEW_LINE>Utilities.removeCategoryChangeSupport(category);<NEW_LINE>ActionListener listener = category.getCloseListener();<NEW_LINE>if (listener != null) {<NEW_LINE>listener.actionPerformed(new ActionEvent(this, ACTION_CLOSE, e.paramString()));<NEW_LINE>}<NEW_LINE>if (category.getSubcategories() != null) {<NEW_LINE>queue.addAll(Arrays.asList(category.getSubcategories()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getWindow().getWidth()); |
430,961 | private Optional<StyleInfo> determineStyle() {<NEW_LINE>if (declaringType().isPresent()) {<NEW_LINE>DeclaringType type = declaringType().get();<NEW_LINE>Optional<DeclaringType> enclosing = type.enclosingOf();<NEW_LINE>if (enclosing.isPresent()) {<NEW_LINE>Optional<StyleInfo> enclosingStyle = enclosing<MASK><NEW_LINE>if (enclosing.get() != type) {<NEW_LINE>Optional<StyleInfo> style = type.style();<NEW_LINE>if (style.isPresent() && enclosingStyle.isPresent() && !style.equals(enclosingStyle)) {<NEW_LINE>warnAboutIncompatibleStyles();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (enclosingStyle.isPresent()) {<NEW_LINE>return enclosingStyle;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Optional<StyleInfo> style = type.style();<NEW_LINE>if (style.isPresent()) {<NEW_LINE>return style;<NEW_LINE>}<NEW_LINE>Optional<DeclaringType> topLevel = type.enclosingTopLevel();<NEW_LINE>if (topLevel.isPresent() && topLevel.get().style().isPresent()) {<NEW_LINE>return topLevel.get().style();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return packageOf().style();<NEW_LINE>} | .get().style(); |
1,351,436 | final GetCommentResult executeGetComment(GetCommentRequest getCommentRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getCommentRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetCommentRequest> request = null;<NEW_LINE>Response<GetCommentResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetCommentRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getCommentRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "CodeCommit");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetComment");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetCommentResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetCommentResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); |
704,464 | @UnitOfWork<NEW_LINE>@ApiOperation(value = "Mark feed entries", notes = "Mark feed entries as read (unread is not supported)")<NEW_LINE>@Timed<NEW_LINE>public Response markFeedEntries(@ApiParam(hidden = true) @SecurityCheck User user, @ApiParam(value = "Mark request", required = true) MarkRequest req) {<NEW_LINE>Preconditions.checkNotNull(req);<NEW_LINE>Preconditions.checkNotNull(req.getId());<NEW_LINE>Date olderThan = req.getOlderThan() == null ? null : new <MASK><NEW_LINE>String keywords = req.getKeywords();<NEW_LINE>List<FeedEntryKeyword> entryKeywords = FeedEntryKeyword.fromQueryString(keywords);<NEW_LINE>FeedSubscription subscription = feedSubscriptionDAO.findById(user, Long.valueOf(req.getId()));<NEW_LINE>if (subscription != null) {<NEW_LINE>feedEntryService.markSubscriptionEntries(user, Arrays.asList(subscription), olderThan, entryKeywords);<NEW_LINE>}<NEW_LINE>return Response.ok().build();<NEW_LINE>} | Date(req.getOlderThan()); |
124,104 | protected Pair<List<LogicalProcessor>, List<PhysicalProcessor>> initProcessorCounts() {<NEW_LINE>int logicalProcessorCount = SysctlUtil.sysctl("hw.logicalcpu", 1);<NEW_LINE>int physicalProcessorCount = <MASK><NEW_LINE>int physicalPackageCount = SysctlUtil.sysctl("hw.packages", 1);<NEW_LINE>List<LogicalProcessor> logProcs = new ArrayList<>(logicalProcessorCount);<NEW_LINE>Set<Integer> pkgCoreKeys = new HashSet<>();<NEW_LINE>for (int i = 0; i < logicalProcessorCount; i++) {<NEW_LINE>int coreId = i * physicalProcessorCount / logicalProcessorCount;<NEW_LINE>int pkgId = i * physicalPackageCount / logicalProcessorCount;<NEW_LINE>logProcs.add(new LogicalProcessor(i, coreId, pkgId));<NEW_LINE>pkgCoreKeys.add((pkgId << 16) + coreId);<NEW_LINE>}<NEW_LINE>Map<Integer, String> compatMap = queryArmCpu().getD();<NEW_LINE>List<PhysicalProcessor> physProcs = pkgCoreKeys.stream().sorted().map(k -> {<NEW_LINE>String compat = compatMap.getOrDefault(k, "");<NEW_LINE>// default, for E-core icestorm<NEW_LINE>int efficiency = 0;<NEW_LINE>if (compat.toLowerCase().contains("firestorm")) {<NEW_LINE>// P-core, more performance<NEW_LINE>efficiency = 1;<NEW_LINE>}<NEW_LINE>return new PhysicalProcessor(k >> 16, k & 0xffff, efficiency, compat);<NEW_LINE>}).collect(Collectors.toList());<NEW_LINE>return new Pair<>(logProcs, physProcs);<NEW_LINE>} | SysctlUtil.sysctl("hw.physicalcpu", 1); |
658,101 | public static int longestSubarrayWithDistinctEntries(List<Integer> A) {<NEW_LINE>// Records the most recent occurrences of each entry.<NEW_LINE>Map<Integer, Integer> mostRecentOccurrence = new HashMap<>();<NEW_LINE>int longestDupFreeSubarrayStartIdx = 0, result = 0;<NEW_LINE>for (int i = 0; i < A.size(); ++i) {<NEW_LINE>Integer dupIdx = mostRecentOccurrence.put(A.get(i), i);<NEW_LINE>// A.get(i) appeared before. Did it appear in the longest current<NEW_LINE>// subarray?<NEW_LINE>if (dupIdx != null) {<NEW_LINE>if (dupIdx >= longestDupFreeSubarrayStartIdx) {<NEW_LINE>result = Math.max(result, i - longestDupFreeSubarrayStartIdx);<NEW_LINE>longestDupFreeSubarrayStartIdx = dupIdx + 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return Math.max(result, <MASK><NEW_LINE>} | A.size() - longestDupFreeSubarrayStartIdx); |
1,825,400 | void update(int pollResponseStatusCode, HttpHeaders pollResponseHeaders, String pollResponseBody) {<NEW_LINE>if (pollResponseStatusCode == 202) {<NEW_LINE>try {<NEW_LINE>this.provisioningState = ProvisioningState.IN_PROGRESS;<NEW_LINE>final URL locationUrl = <MASK><NEW_LINE>if (locationUrl != null) {<NEW_LINE>this.pollUrl = locationUrl;<NEW_LINE>}<NEW_LINE>} catch (Util.MalformedUrlException mue) {<NEW_LINE>this.provisioningState = ProvisioningState.FAILED;<NEW_LINE>this.pollError = new Error("Long running operation contains a malformed Location header.", pollResponseStatusCode, pollResponseHeaders.toMap(), pollResponseBody);<NEW_LINE>}<NEW_LINE>} else if (pollResponseStatusCode == 200 || pollResponseStatusCode == 201 || pollResponseStatusCode == 204) {<NEW_LINE>this.provisioningState = ProvisioningState.SUCCEEDED;<NEW_LINE>if (pollResponseBody != null) {<NEW_LINE>this.finalResult = new FinalResult(null, pollResponseBody);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>this.provisioningState = ProvisioningState.FAILED;<NEW_LINE>this.pollError = new Error("Polling failed with status code:" + pollResponseStatusCode, pollResponseStatusCode, pollResponseHeaders.toMap(), pollResponseBody);<NEW_LINE>}<NEW_LINE>} | Util.getLocationUrl(pollResponseHeaders, logger); |
1,027,050 | public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {<NEW_LINE>getSerializedSize();<NEW_LINE>if (((bitField0_ & 0x00000001) == 0x00000001)) {<NEW_LINE>output.writeSInt32(2, dx_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000002) == 0x00000002)) {<NEW_LINE>output.writeSInt32(3, dy_);<NEW_LINE>}<NEW_LINE>for (int i = 0; i < categories_.size(); i++) {<NEW_LINE>output.writeUInt32(4<MASK><NEW_LINE>}<NEW_LINE>for (int i = 0; i < subcategories_.size(); i++) {<NEW_LINE>output.writeUInt32(5, subcategories_.get(i));<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000004) == 0x00000004)) {<NEW_LINE>output.writeBytes(6, getNameBytes());<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000008) == 0x00000008)) {<NEW_LINE>output.writeBytes(7, getNameEnBytes());<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000010) == 0x00000010)) {<NEW_LINE>output.writeUInt64(8, id_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000020) == 0x00000020)) {<NEW_LINE>output.writeBytes(10, getOpeningHoursBytes());<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000040) == 0x00000040)) {<NEW_LINE>output.writeBytes(11, getSiteBytes());<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000080) == 0x00000080)) {<NEW_LINE>output.writeBytes(12, getPhoneBytes());<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000100) == 0x00000100)) {<NEW_LINE>output.writeBytes(13, getNoteBytes());<NEW_LINE>}<NEW_LINE>for (int i = 0; i < textCategories_.size(); i++) {<NEW_LINE>output.writeUInt32(14, textCategories_.get(i));<NEW_LINE>}<NEW_LINE>for (int i = 0; i < textValues_.size(); i++) {<NEW_LINE>output.writeBytes(15, textValues_.getByteString(i));<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000200) == 0x00000200)) {<NEW_LINE>output.writeInt32(16, precisionXY_);<NEW_LINE>}<NEW_LINE>getUnknownFields().writeTo(output);<NEW_LINE>} | , categories_.get(i)); |
798,383 | public void read(org.apache.thrift.protocol.TProtocol iprot, shutdown_result 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 // SEC<NEW_LINE>1:<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {<NEW_LINE>struct.sec = new org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException();<NEW_LINE>struct.sec.read(iprot);<NEW_LINE>struct.setSecIsSet(true);<NEW_LINE>} else {<NEW_LINE>org.apache.thrift.protocol.TProtocolUtil.<MASK><NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case // TNASE<NEW_LINE>2:<NEW_LINE>if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {<NEW_LINE>struct.tnase = new org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException();<NEW_LINE>struct.tnase.read(iprot);<NEW_LINE>struct.setTnaseIsSet(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); |
359,413 | public com.amazonaws.services.wafv2.model.WAFNonexistentItemException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.wafv2.model.WAFNonexistentItemException wAFNonexistentItemException = new com.amazonaws.services.wafv2.model.WAFNonexistentItemException(null);<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return 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>} 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 wAFNonexistentItemException;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,668,108 | public GridBoundsChange performAction(GridManager gridManager, DesignerContext context) {<NEW_LINE>GridInfoProvider gridInfo = gridManager.getGridInfo();<NEW_LINE>boolean gapSupport = gridInfo.hasGaps();<NEW_LINE>int[] originalColumnBounds = gridInfo.getColumnBounds();<NEW_LINE>int[] originalRowBounds = gridInfo.getRowBounds();<NEW_LINE>GridUtils.removePaddingComponents(gridManager);<NEW_LINE>int column = context.getFocusedColumn();<NEW_LINE>if (insertAfter) {<NEW_LINE>column += (gapSupport ? 2 : 1);<NEW_LINE>}<NEW_LINE>gridManager.insertColumn(column);<NEW_LINE>GridUtils.addPaddingComponents(gridManager, originalColumnBounds.length - 1 + (gapSupport ? 2 : 1), originalRowBounds.length - 1);<NEW_LINE>GridUtils.revalidateGrid(gridManager);<NEW_LINE>int[] newColumnBounds = gridInfo.getColumnBounds();<NEW_LINE>int[] newRowBounds = gridInfo.getRowBounds();<NEW_LINE>int[] oldColumnBounds = new int[originalColumnBounds.length + (gapSupport ? 2 : 1)];<NEW_LINE>if (gapSupport) {<NEW_LINE>if (originalColumnBounds.length == column) {<NEW_LINE>// inserting after rightmost column<NEW_LINE>System.arraycopy(originalColumnBounds, 0, oldColumnBounds, 0, column);<NEW_LINE>oldColumnBounds[column] = oldColumnBounds[column - 1];<NEW_LINE>oldColumnBounds[column + 1] = oldColumnBounds[column - 1];<NEW_LINE>} else {<NEW_LINE>System.arraycopy(originalColumnBounds, 0, oldColumnBounds, 0, column + 1);<NEW_LINE>oldColumnBounds[column <MASK><NEW_LINE>oldColumnBounds[column + 2] = oldColumnBounds[column];<NEW_LINE>System.arraycopy(originalColumnBounds, column + 1, oldColumnBounds, column + 3, originalColumnBounds.length - column - 1);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>System.arraycopy(originalColumnBounds, 0, oldColumnBounds, 0, column + 1);<NEW_LINE>oldColumnBounds[column + 1] = oldColumnBounds[column];<NEW_LINE>System.arraycopy(originalColumnBounds, column + 1, oldColumnBounds, column + 2, originalColumnBounds.length - column - 1);<NEW_LINE>}<NEW_LINE>return new GridBoundsChange(oldColumnBounds, originalRowBounds, newColumnBounds, newRowBounds);<NEW_LINE>} | + 1] = oldColumnBounds[column]; |
761,410 | private void buildPrepParams(TDSWriter tdsWriter) throws SQLServerException {<NEW_LINE>if (getStatementLogger().isLoggable(java.util.logging.Level.FINE))<NEW_LINE>getStatementLogger().fine(toString() + ": calling sp_prepare: PreparedHandle:" + getPreparedStatementHandle() + ", SQL:" + preparedSQL);<NEW_LINE>expectPrepStmtHandle = true;<NEW_LINE>executedSqlDirectly = false;<NEW_LINE>expectCursorOutParams = false;<NEW_LINE>outParamIndexAdjustment = 4;<NEW_LINE>// procedure name length -> use ProcIDs<NEW_LINE>tdsWriter.writeShort((short) 0xFFFF);<NEW_LINE>tdsWriter.writeShort(TDS.PROCID_SP_PREPARE);<NEW_LINE>tdsWriter.writeByte((byte) 0);<NEW_LINE>tdsWriter.writeByte((byte) 0);<NEW_LINE>tdsWriter.sendEnclavePackage(preparedSQL, enclaveCEKs);<NEW_LINE>tdsWriter.writeRPCInt(null, getPreparedStatementHandle(), true);<NEW_LINE>resetPrepStmtHandle(false);<NEW_LINE>tdsWriter.writeRPCStringUnicode((preparedTypeDefinitions.length() > 0) ? preparedTypeDefinitions : null);<NEW_LINE>tdsWriter.writeRPCStringUnicode(preparedSQL);<NEW_LINE>tdsWriter.<MASK><NEW_LINE>} | writeRPCInt(null, 1, false); |
332,560 | private HollowHistoricalStateKeyOrdinalMapping createKeyOrdinalMappingFromDelta() {<NEW_LINE>HollowHistoricalStateKeyOrdinalMapping keyOrdinalMapping = new HollowHistoricalStateKeyOrdinalMapping(keyIndex);<NEW_LINE>for (String keyType : keyIndex.getTypeKeyIndexes().keySet()) {<NEW_LINE>HollowHistoricalStateTypeKeyOrdinalMapping typeMapping = keyOrdinalMapping.getTypeMapping(keyType);<NEW_LINE>HollowObjectTypeReadState typeState = (HollowObjectTypeReadState) latestHollowReadStateEngine.getTypeState(keyType);<NEW_LINE>if (typeState == null) {<NEW_LINE>// The type is present in the history's primary key index but is not present<NEW_LINE>// in the latest read state; ensure the mapping is initialized to the default state<NEW_LINE>typeMapping.prepare(0, 0);<NEW_LINE>typeMapping.finish();<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>PopulatedOrdinalListener listener = typeState.getListener(PopulatedOrdinalListener.class);<NEW_LINE>RemovedOrdinalIterator removalIterator = new RemovedOrdinalIterator(listener);<NEW_LINE>RemovedOrdinalIterator additionsIterator = new RemovedOrdinalIterator(listener.getPopulatedOrdinals(), listener.getPreviousOrdinals());<NEW_LINE>typeMapping.prepare(additionsIterator.countTotal(<MASK><NEW_LINE>int removedOrdinal = removalIterator.next();<NEW_LINE>while (removedOrdinal != -1) {<NEW_LINE>typeMapping.removed(typeState, removedOrdinal);<NEW_LINE>removedOrdinal = removalIterator.next();<NEW_LINE>}<NEW_LINE>int addedOrdinal = additionsIterator.next();<NEW_LINE>while (addedOrdinal != -1) {<NEW_LINE>typeMapping.added(typeState, addedOrdinal);<NEW_LINE>addedOrdinal = additionsIterator.next();<NEW_LINE>}<NEW_LINE>typeMapping.finish();<NEW_LINE>}<NEW_LINE>return keyOrdinalMapping;<NEW_LINE>} | ), removalIterator.countTotal()); |
1,820,402 | final UpdateMemberResult executeUpdateMember(UpdateMemberRequest updateMemberRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateMemberRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateMemberRequest> request = null;<NEW_LINE>Response<UpdateMemberResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdateMemberRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateMemberRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ManagedBlockchain");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateMember");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpdateMemberResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateMemberResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); |
1,782,940 | private void initComponents() {<NEW_LINE>setLayout(new BorderLayout());<NEW_LINE>previewPanel = new JPanel(new FlowLayout(0, 0, FlowLayout.LEADING));<NEW_LINE>previewPanel.setBorder(BorderFactory.createEmptyBorder(4<MASK><NEW_LINE>label = new JLabel();<NEW_LINE>label.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(2, 7, 7, 7), new ThinBevelBorder(BevelBorder.LOWERED)));<NEW_LINE>label.setBorder(BorderFactory.createCompoundBorder(label.getBorder(), BorderFactory.createEmptyBorder(4, 3, 4, 3)));<NEW_LINE>label.setFont(label.getFont().deriveFont(Font.BOLD));<NEW_LINE>JPanel p = new JPanel(new BorderLayout());<NEW_LINE>p.setBorder(BorderFactory.createRaisedBevelBorder());<NEW_LINE>p.add(previewPanel, BorderLayout.NORTH);<NEW_LINE>p.add(label, BorderLayout.CENTER);<NEW_LINE>add(p, BorderLayout.CENTER);<NEW_LINE>} | , 7, 2, 7)); |
689,990 | protected void initShards() {<NEW_LINE>if (getStrategyNullable() == null || !getStrategyNullable().isShardingByDb()) {<NEW_LINE>// Init with no shard support<NEW_LINE>for (DataBase db : databases.values()) {<NEW_LINE>if (db.isMaster())<NEW_LINE>masterDbs.add(db);<NEW_LINE>else<NEW_LINE>slaveDbs.add(db);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// Init map by shard<NEW_LINE>for (DataBase db : databases.values()) {<NEW_LINE>Map<String, List<DataBase>> dbByShard = db.isMaster() ? masterDbByShard : slaveDbByShard;<NEW_LINE>List<DataBase> dbList = dbByShard.get(db.getSharding());<NEW_LINE>if (dbList == null) {<NEW_LINE>dbList <MASK><NEW_LINE>dbByShard.put(db.getSharding(), dbList);<NEW_LINE>}<NEW_LINE>dbList.add(db);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | = new ArrayList<DataBase>(); |
580,471 | void validateAffectedFolds(Fold fold, DocumentEvent evt, Collection damaged) {<NEW_LINE>int startOffset = evt.getOffset();<NEW_LINE>int endOffset = startOffset + evt.getLength();<NEW_LINE>int childIndex = FoldUtilitiesImpl.findFoldStartIndex(fold, startOffset, true);<NEW_LINE>if (childIndex == -1) {<NEW_LINE>if (fold.getFoldCount() == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Fold first = fold.getFold(0);<NEW_LINE>if (first.getStartOffset() <= endOffset) {<NEW_LINE>childIndex = 0;<NEW_LINE>} else {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (childIndex >= 1) {<NEW_LINE>Fold prevChildFold = fold.getFold(childIndex - 1);<NEW_LINE>if (prevChildFold.getEndOffset() == startOffset) {<NEW_LINE>validateAffectedFolds(prevChildFold, evt, damaged);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int pStart = fold.getStartOffset();<NEW_LINE>int pEnd = fold.getEndOffset();<NEW_LINE>boolean removed;<NEW_LINE>boolean startsWithin = false;<NEW_LINE>do {<NEW_LINE>Fold <MASK><NEW_LINE>int cStart = childFold.getStartOffset();<NEW_LINE>int cEnd = childFold.getEndOffset();<NEW_LINE>startsWithin = cStart < startOffset && cEnd <= endOffset;<NEW_LINE>removed = false;<NEW_LINE>if (cStart < pStart || cEnd > pEnd || cStart == cEnd) {<NEW_LINE>damaged.add(childFold);<NEW_LINE>}<NEW_LINE>if (childFold.getFoldCount() > 0) {<NEW_LINE>// check children<NEW_LINE>// Some children could be damaged even if this one was not<NEW_LINE>validateAffectedFolds(childFold, evt, damaged);<NEW_LINE>}<NEW_LINE>childIndex++;<NEW_LINE>} while ((startsWithin || removed) && childIndex < fold.getFoldCount());<NEW_LINE>} | childFold = fold.getFold(childIndex); |
329,594 | private // and that our WSJdbcConnection properties are in sync with the underlying PostgreSQL connection's properties<NEW_LINE>void verifyClean(Connection con) throws Exception {<NEW_LINE>// Verify WSJdbcConnection values are all at the proper initial state<NEW_LINE>assertTrue("Default auto-commit value on a connection should be 'true'", con.getAutoCommit());<NEW_LINE>assertFalse("Default readOnly value on a connection should be 'false'", con.isReadOnly());<NEW_LINE>assertEquals("Default tx isolation level on a connection should be TRANSACTION_READ_COMMITTED (2)", Connection.TRANSACTION_READ_COMMITTED, con.getTransactionIsolation());<NEW_LINE>assertEquals("Default ResultSet holdability on a connection should be CLOSE_CURSORS_AT_COMMIT (2)", ResultSet.CLOSE_CURSORS_AT_COMMIT, con.getHoldability());<NEW_LINE>assertEquals("Default network timeout on a connection should be 0", 0, con.getNetworkTimeout());<NEW_LINE>assertEquals("Default schema on a connection should be 'public", "public", con.getSchema());<NEW_LINE>// Always "do some work" with the connection before we verify it's underlying state.<NEW_LINE>// The JDBC code intentionally lazily resets connection values, so our wrapper may be out of sync with the underlying<NEW_LINE>// connection between getting the initial connection and actually driving some work on it<NEW_LINE>con.createStatement().close();<NEW_LINE>// Verify the underlying PostgreSQL connection is in a consistent state with our tracking<NEW_LINE>assertEquals("Liberty JDBC connection wrapper auto-commit value did not match the underlying PostgreSQL connection value", con.getAutoCommit(), getUnderlyingPGConnection(con).getAutoCommit());<NEW_LINE>assertEquals("Liberty JDBC connection wrapper isReadOnly value did not match the underlying PostgreSQL connection value", con.isReadOnly(), getUnderlyingPGConnection(con).isReadOnly());<NEW_LINE>assertEquals("Liberty JDBC connection wrapper tx isolation level value did not match the underlying PostgreSQL connection value", con.getTransactionIsolation(), getUnderlyingPGConnection<MASK><NEW_LINE>assertEquals("Liberty JDBC connection wrapper ResultSet holdability value did not match the underlying PostgreSQL connection value", con.getHoldability(), getUnderlyingPGConnection(con).getHoldability());<NEW_LINE>assertEquals("Liberty JDBC connection wrapper network timeout value did not match the underlying PostgreSQL connection value", con.getNetworkTimeout(), getUnderlyingPGConnection(con).getNetworkTimeout());<NEW_LINE>assertEquals("Liberty JDBC connection wrapper schema value did not match the underlying PostgreSQL connection value", con.getSchema(), getUnderlyingPGConnection(con).getSchema());<NEW_LINE>} | (con).getTransactionIsolation()); |
1,606,712 | public PathSet paths(Id sourceV, Directions sourceDir, Id targetV, Directions targetDir, String label, int depth, long degree, long capacity, long limit) {<NEW_LINE>E.checkNotNull(sourceV, "source vertex id");<NEW_LINE>E.checkNotNull(targetV, "target vertex id");<NEW_LINE>this.checkVertexExist(sourceV, "source vertex");<NEW_LINE>this.checkVertexExist(targetV, "target vertex");<NEW_LINE>E.checkNotNull(sourceDir, "source direction");<NEW_LINE>E.checkNotNull(targetDir, "target direction");<NEW_LINE>E.checkArgument(sourceDir == targetDir || sourceDir == targetDir.opposite(), "Source direction must equal to target direction" + " or opposite to target direction");<NEW_LINE>E.checkArgument(depth > 0 && depth <= DEFAULT_MAX_DEPTH, "The depth must be in (0, %s], but got: %s", DEFAULT_MAX_DEPTH, depth);<NEW_LINE>checkDegree(degree);<NEW_LINE>checkCapacity(capacity);<NEW_LINE>checkLimit(limit);<NEW_LINE>if (sourceV.equals(targetV)) {<NEW_LINE>return PathSet.EMPTY;<NEW_LINE>}<NEW_LINE>Id labelId = this.getEdgeLabelId(label);<NEW_LINE>Traverser traverser = new Traverser(sourceV, targetV, <MASK><NEW_LINE>// We should stop early if walk backtrace or reach limit<NEW_LINE>while (true) {<NEW_LINE>if (--depth < 0 || traverser.reachLimit()) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>traverser.forward(targetV, sourceDir);<NEW_LINE>if (--depth < 0 || traverser.reachLimit()) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>traverser.backward(sourceV, targetDir);<NEW_LINE>}<NEW_LINE>return traverser.paths();<NEW_LINE>} | labelId, degree, capacity, limit); |
100,768 | public Result authenticate() {<NEW_LINE>// TODO: Call getAuthenticatedUser and then generate a session cookie for the UI if the user is authenticated.<NEW_LINE>final Optional<String> maybeRedirectPath = Optional.ofNullable(ctx().request().getQueryString(AUTH_REDIRECT_URI_PARAM));<NEW_LINE>final String <MASK><NEW_LINE>if (AuthUtils.hasValidSessionCookie(ctx())) {<NEW_LINE>return redirect(redirectPath);<NEW_LINE>}<NEW_LINE>// 1. If SSO is enabled, redirect to IdP if not authenticated.<NEW_LINE>if (_ssoManager.isSsoEnabled()) {<NEW_LINE>return redirectToIdentityProvider();<NEW_LINE>}<NEW_LINE>// 2. If JAAS auth is enabled, fallback to it<NEW_LINE>if (_jaasConfigs.isJAASEnabled()) {<NEW_LINE>return redirect(LOGIN_ROUTE + String.format("?%s=%s", AUTH_REDIRECT_URI_PARAM, encodeRedirectUri(redirectPath)));<NEW_LINE>}<NEW_LINE>// 3. If no auth enabled, fallback to using default user account & redirect.<NEW_LINE>// Generate GMS session token, TODO:<NEW_LINE>final String accessToken = _authClient.generateSessionTokenForUser(DEFAULT_ACTOR_URN.getId());<NEW_LINE>session().put(ACCESS_TOKEN, accessToken);<NEW_LINE>session().put(ACTOR, DEFAULT_ACTOR_URN.toString());<NEW_LINE>return redirect(redirectPath).withCookies(createActorCookie(DEFAULT_ACTOR_URN.toString(), _configs.hasPath(SESSION_TTL_CONFIG_PATH) ? _configs.getInt(SESSION_TTL_CONFIG_PATH) : DEFAULT_SESSION_TTL_HOURS));<NEW_LINE>} | redirectPath = maybeRedirectPath.orElse("/"); |
798,982 | boolean createFeatures3D(SceneWorkingGraph graph) {<NEW_LINE>int filtered = 0;<NEW_LINE>int total = 0;<NEW_LINE>// For each view, with a set inliers, create a set of triangulated 3D point features<NEW_LINE>for (int workingIdx = 0; workingIdx < graph.listViews.size(); workingIdx++) {<NEW_LINE>SceneWorkingGraph.View wview = graph.listViews.get(workingIdx);<NEW_LINE>for (int infoIdx = 0; infoIdx < wview.inliers.size; infoIdx++) {<NEW_LINE>final SceneWorkingGraph.InlierInfo inliers = wview.inliers.get(infoIdx);<NEW_LINE>// See if it should skip over these features<NEW_LINE>if (!inlierFilter.keep(wview, inliers)) {<NEW_LINE>filtered++;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (verbose != null && verboseViewInfo)<NEW_LINE>verbose.print("inlier[" + infoIdx + "] view='" + wview.pview.id + "' size=" + <MASK><NEW_LINE>createFeaturesFromInlierInfo(graph, inliers);<NEW_LINE>}<NEW_LINE>total += wview.inliers.size;<NEW_LINE>}<NEW_LINE>if (verbose != null)<NEW_LINE>verbose.println("triangulation: sets: skipped=" + filtered + " total=" + total);<NEW_LINE>return filtered < total;<NEW_LINE>} | inliers.getInlierCount() + " , "); |
1,118,625 | default void toJson(CharSink sink) {<NEW_LINE>sink.put('{');<NEW_LINE>sink.putQuoted("columnCount").put(':'<MASK><NEW_LINE>sink.put(',');<NEW_LINE>sink.putQuoted("columns").put(':');<NEW_LINE>sink.put('[');<NEW_LINE>for (int i = 0, n = getColumnCount(); i < n; i++) {<NEW_LINE>final int type = getColumnType(i);<NEW_LINE>if (i > 0) {<NEW_LINE>sink.put(',');<NEW_LINE>}<NEW_LINE>sink.put('{');<NEW_LINE>sink.putQuoted("index").put(':').put(i).put(',');<NEW_LINE>sink.putQuoted("name").put(':').putQuoted(getColumnName(i)).put(',');<NEW_LINE>sink.putQuoted("type").put(':').putQuoted(ColumnType.nameOf(type));<NEW_LINE>if (isColumnIndexed(i)) {<NEW_LINE>sink.put(',').putQuoted("indexed").put(":true");<NEW_LINE>sink.put(',').putQuoted("indexValueBlockCapacity").put(':').put(getIndexValueBlockCapacity(i));<NEW_LINE>}<NEW_LINE>sink.put('}');<NEW_LINE>}<NEW_LINE>sink.put(']');<NEW_LINE>sink.put(',').putQuoted("timestampIndex").put(':').put(getTimestampIndex());<NEW_LINE>sink.put('}');<NEW_LINE>} | ).put(getColumnCount()); |
121,141 | private void init() {<NEW_LINE>// Add Header<NEW_LINE>GoogleNowBirthHeader header = new GoogleNowBirthHeader(getContext(<MASK><NEW_LINE>header.setButtonExpandVisible(true);<NEW_LINE>header.mName = "Gabriele Mariotti";<NEW_LINE>header.mSubName = "Birthday today";<NEW_LINE>addCardHeader(header);<NEW_LINE>// Add Expand Area<NEW_LINE>CardExpand expand = new GoogleNowExpandCard(getContext());<NEW_LINE>addCardExpand(expand);<NEW_LINE>// Set clickListener<NEW_LINE>setOnClickListener(new OnCardClickListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onClick(Card card, View view) {<NEW_LINE>Toast.makeText(getContext(), "Click Listener card", Toast.LENGTH_LONG).show();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// Add Thumbnail<NEW_LINE>GoogleNowBirthThumb thumbnail = new GoogleNowBirthThumb(getContext());<NEW_LINE>float density = getContext().getResources().getDisplayMetrics().density;<NEW_LINE>int size = (int) (125 * density);<NEW_LINE>thumbnail.setUrlResource("https://lh5.googleusercontent.com/-squZd7FxR8Q/UyN5UrsfkqI/AAAAAAAAbAo/VoDHSYAhC_E/s" + size + "/new%2520profile%2520%25282%2529.jpg");<NEW_LINE>thumbnail.setErrorResource(R.drawable.ic_ic_error_loading);<NEW_LINE>addCardThumbnail(thumbnail);<NEW_LINE>} | ), R.layout.carddemo_googlenowbirth_inner_header); |
1,313,865 | Long[] findTaskIds(long partition, TaskState state, boolean inState, Long minId, Integer maxResults) throws Exception {<NEW_LINE><MASK><NEW_LINE>if (config.missedTaskThreshold != -1)<NEW_LINE>// should be unreachable<NEW_LINE>throw new UnsupportedOperationException();<NEW_LINE>Long[] results = null;<NEW_LINE>TransactionController tranController = new TransactionController();<NEW_LINE>try {<NEW_LINE>tranController.preInvoke();<NEW_LINE>List<Long> ids = taskStore.findTaskIds(null, null, state, inState, minId, maxResults, null, partition);<NEW_LINE>results = ids.toArray(new Long[ids.size()]);<NEW_LINE>} catch (Throwable x) {<NEW_LINE>tranController.setFailure(x);<NEW_LINE>} finally {<NEW_LINE>Exception x = tranController.postInvoke(Exception.class);<NEW_LINE>if (x != null)<NEW_LINE>throw x;<NEW_LINE>}<NEW_LINE>return results;<NEW_LINE>} | Config config = configRef.get(); |
570,805 | protected void rename(String oldName, String newName) throws IOException {<NEW_LINE>File of = getFile(oldName);<NEW_LINE>File nf = getFile(newName);<NEW_LINE>Random rndm = null;<NEW_LINE>for (int retry = 0; ; retry++) {<NEW_LINE>// #7086 - (nf.exists() && !nf.equals(of)) instead of nf.exists() - fix for Win32<NEW_LINE>boolean existsNF = nf.exists();<NEW_LINE>boolean equalsOF = nf.equals(of);<NEW_LINE>if (BaseUtilities.isMac()) {<NEW_LINE>// File.equal on mac is not case insensitive (which it should be),<NEW_LINE>// so try harder<NEW_LINE>equalsOF = of.getCanonicalFile().equals(nf.getCanonicalFile());<NEW_LINE>}<NEW_LINE>Boolean rename = null;<NEW_LINE>if ((existsNF && !equalsOF) || !(rename = of.renameTo(nf))) {<NEW_LINE>final String msg = NbBundle.getMessage(LocalFileSystem.class, "EXC_CannotRename", oldName, getDisplayName(), newName, existsNF, rename);<NEW_LINE>if (retry > 10) {<NEW_LINE>throw new FSException(msg);<NEW_LINE>}<NEW_LINE>LOG.log(Level.WARNING, "Rename #{0} failed: {1}", new Object<MASK><NEW_LINE>if (rndm == null) {<NEW_LINE>rndm = new Random();<NEW_LINE>}<NEW_LINE>int sleep = rndm.nextInt(100) + 1;<NEW_LINE>LOG.log(Level.INFO, "Sleeping for {0} ms", sleep);<NEW_LINE>try {<NEW_LINE>Thread.sleep(sleep);<NEW_LINE>} catch (InterruptedException ex) {<NEW_LINE>LOG.log(Level.FINE, null, ex);<NEW_LINE>}<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} | [] { retry, msg }); |
1,222,537 | protected void reapplyRowWidths() {<NEW_LINE>double rowWidth = columnConfiguration.calculateRowWidth();<NEW_LINE>if (rowWidth < 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>while (row != null) {<NEW_LINE>// IF there is a rounding error when summing the columns, we<NEW_LINE>// need to round the tr width up to ensure that columns fit and<NEW_LINE>// do not wrap<NEW_LINE>// E.g.122.95+123.25+103.75+209.25+83.52+88.57+263.45+131.21+126.85+113.13=1365.9299999999998<NEW_LINE>// For this we must set 1365.93 or the last column will wrap<NEW_LINE>row.getStyle().setWidth(WidgetUtil.roundSizeUp(rowWidth), Unit.PX);<NEW_LINE>row = row.getNextSiblingElement();<NEW_LINE>}<NEW_LINE>} | Element row = root.getFirstChildElement(); |
1,818,777 | public static boolean scrollToVisible(JViewport viewport, Rectangle fieldArea) {<NEW_LINE>Rectangle viewArea = viewport.getViewRect();<NEW_LINE>if (viewArea.contains(fieldArea)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>Point pos = new Point();<NEW_LINE>pos.x = viewArea.x;<NEW_LINE>if (fieldArea.x + fieldArea.width > viewArea.x + viewArea.width) {<NEW_LINE>pos.x = fieldArea.x + fieldArea.width - viewArea.width + 5;<NEW_LINE>}<NEW_LINE>pos.x = pos.x > fieldArea.x ? fieldArea.x - 5 : pos.x;<NEW_LINE>if (pos.x + viewArea.width > viewport.getView().getWidth()) {<NEW_LINE>pos.x = viewport.getView()<MASK><NEW_LINE>}<NEW_LINE>pos.y = viewArea.y;<NEW_LINE>if (fieldArea.y + fieldArea.height > viewArea.y + viewArea.height) {<NEW_LINE>pos.y = fieldArea.y + fieldArea.height - viewArea.height + 5;<NEW_LINE>}<NEW_LINE>pos.y = pos.y > fieldArea.y ? fieldArea.y - 5 : pos.y;<NEW_LINE>if (pos.y + viewArea.height > viewport.getView().getHeight()) {<NEW_LINE>pos.y = viewport.getView().getHeight() - viewArea.height;<NEW_LINE>}<NEW_LINE>viewport.setViewPosition(pos);<NEW_LINE>return true;<NEW_LINE>} | .getWidth() - viewArea.width; |
682,798 | public void handleInsert(InsertionContext context) {<NEW_LINE>final LookupElement delegate = getDelegate();<NEW_LINE>final TailType tailType = computeTailType(context);<NEW_LINE>final LookupItem lookupItem = delegate.as(LookupItem.CLASS_CONDITION_KEY);<NEW_LINE>if (lookupItem != null && tailType != null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>delegate.handleInsert(context);<NEW_LINE>if (tailType != null && tailType.isApplicable(context)) {<NEW_LINE>PostprocessReformattingAspect.getInstance(context.getProject()).doPostponedFormatting();<NEW_LINE>int tailOffset = context.getTailOffset();<NEW_LINE>if (tailOffset < 0) {<NEW_LINE>throw new AssertionError("tailOffset < 0: delegate=" + getDelegate() + "; this=" + this + "; tail=" + tailType);<NEW_LINE>}<NEW_LINE>tailType.processTail(context.getEditor(), tailOffset);<NEW_LINE>}<NEW_LINE>} | lookupItem.setTailType(TailType.UNKNOWN); |
882,119 | public static QueryTransferInListResponse unmarshall(QueryTransferInListResponse queryTransferInListResponse, UnmarshallerContext _ctx) {<NEW_LINE>queryTransferInListResponse.setRequestId(_ctx.stringValue("QueryTransferInListResponse.RequestId"));<NEW_LINE>queryTransferInListResponse.setTotalItemNum(_ctx.integerValue("QueryTransferInListResponse.TotalItemNum"));<NEW_LINE>queryTransferInListResponse.setCurrentPageNum(_ctx.integerValue("QueryTransferInListResponse.CurrentPageNum"));<NEW_LINE>queryTransferInListResponse.setTotalPageNum(_ctx.integerValue("QueryTransferInListResponse.TotalPageNum"));<NEW_LINE>queryTransferInListResponse.setPageSize(_ctx.integerValue("QueryTransferInListResponse.PageSize"));<NEW_LINE>queryTransferInListResponse.setPrePage(_ctx.booleanValue("QueryTransferInListResponse.PrePage"));<NEW_LINE>queryTransferInListResponse.setNextPage(_ctx.booleanValue("QueryTransferInListResponse.NextPage"));<NEW_LINE>List<TransferInInfo> data = new ArrayList<TransferInInfo>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("QueryTransferInListResponse.Data.Length"); i++) {<NEW_LINE>TransferInInfo transferInInfo = new TransferInInfo();<NEW_LINE>transferInInfo.setSubmissionDate(_ctx.stringValue("QueryTransferInListResponse.Data[" + i + "].SubmissionDate"));<NEW_LINE>transferInInfo.setModificationDate(_ctx.stringValue("QueryTransferInListResponse.Data[" + i + "].ModificationDate"));<NEW_LINE>transferInInfo.setUserId(_ctx.stringValue("QueryTransferInListResponse.Data[" + i + "].UserId"));<NEW_LINE>transferInInfo.setInstanceId(_ctx.stringValue<MASK><NEW_LINE>transferInInfo.setDomainName(_ctx.stringValue("QueryTransferInListResponse.Data[" + i + "].DomainName"));<NEW_LINE>transferInInfo.setStatus(_ctx.integerValue("QueryTransferInListResponse.Data[" + i + "].Status"));<NEW_LINE>transferInInfo.setSimpleTransferInStatus(_ctx.stringValue("QueryTransferInListResponse.Data[" + i + "].SimpleTransferInStatus"));<NEW_LINE>transferInInfo.setResultCode(_ctx.stringValue("QueryTransferInListResponse.Data[" + i + "].ResultCode"));<NEW_LINE>transferInInfo.setResultDate(_ctx.stringValue("QueryTransferInListResponse.Data[" + i + "].ResultDate"));<NEW_LINE>transferInInfo.setResultMsg(_ctx.stringValue("QueryTransferInListResponse.Data[" + i + "].ResultMsg"));<NEW_LINE>transferInInfo.setTransferAuthorizationCodeSubmissionDate(_ctx.stringValue("QueryTransferInListResponse.Data[" + i + "].TransferAuthorizationCodeSubmissionDate"));<NEW_LINE>transferInInfo.setNeedMailCheck(_ctx.booleanValue("QueryTransferInListResponse.Data[" + i + "].NeedMailCheck"));<NEW_LINE>transferInInfo.setEmail(_ctx.stringValue("QueryTransferInListResponse.Data[" + i + "].Email"));<NEW_LINE>transferInInfo.setWhoisMailStatus(_ctx.booleanValue("QueryTransferInListResponse.Data[" + i + "].WhoisMailStatus"));<NEW_LINE>transferInInfo.setExpirationDate(_ctx.stringValue("QueryTransferInListResponse.Data[" + i + "].ExpirationDate"));<NEW_LINE>transferInInfo.setProgressBarType(_ctx.integerValue("QueryTransferInListResponse.Data[" + i + "].ProgressBarType"));<NEW_LINE>transferInInfo.setSubmissionDateLong(_ctx.longValue("QueryTransferInListResponse.Data[" + i + "].SubmissionDateLong"));<NEW_LINE>transferInInfo.setModificationDateLong(_ctx.longValue("QueryTransferInListResponse.Data[" + i + "].ModificationDateLong"));<NEW_LINE>transferInInfo.setResultDateLong(_ctx.longValue("QueryTransferInListResponse.Data[" + i + "].ResultDateLong"));<NEW_LINE>transferInInfo.setExpirationDateLong(_ctx.longValue("QueryTransferInListResponse.Data[" + i + "].ExpirationDateLong"));<NEW_LINE>transferInInfo.setTransferAuthorizationCodeSubmissionDateLong(_ctx.longValue("QueryTransferInListResponse.Data[" + i + "].TransferAuthorizationCodeSubmissionDateLong"));<NEW_LINE>data.add(transferInInfo);<NEW_LINE>}<NEW_LINE>queryTransferInListResponse.setData(data);<NEW_LINE>return queryTransferInListResponse;<NEW_LINE>} | ("QueryTransferInListResponse.Data[" + i + "].InstanceId")); |
740,016 | private PoiTypeResult checkPoiType(NameStringMatcher nm, AbstractPoiType pf) {<NEW_LINE>PoiTypeResult res = null;<NEW_LINE>if (nm.matches(pf.getTranslation())) {<NEW_LINE>res = addIfMatch(nm, pf.<MASK><NEW_LINE>}<NEW_LINE>if (nm.matches(pf.getEnTranslation())) {<NEW_LINE>res = addIfMatch(nm, pf.getEnTranslation(), pf, res);<NEW_LINE>}<NEW_LINE>if (nm.matches(pf.getKeyName())) {<NEW_LINE>res = addIfMatch(nm, pf.getKeyName().replace('_', ' '), pf, res);<NEW_LINE>}<NEW_LINE>if (nm.matches(pf.getSynonyms())) {<NEW_LINE>String[] synonyms = pf.getSynonyms().split(";");<NEW_LINE>for (String synonym : synonyms) {<NEW_LINE>res = addIfMatch(nm, synonym, pf, res);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return res;<NEW_LINE>} | getTranslation(), pf, res); |
28,671 | public void controlChanged(final Object source) {<NEW_LINE>if (source == spinnerDescRadius) {<NEW_LINE>configKlt.templateRadius = ((Number) spinnerDescRadius.getValue()).intValue();<NEW_LINE>} else if (source == spinnerMaxTracks) {<NEW_LINE>configKlt.maximumTracks.setTo(spinnerMaxTracks.getValue());<NEW_LINE>} else if (source == spinnerMaxError) {<NEW_LINE>configKlt.config.maxPerPixelError = ((Number) spinnerMaxError.getValue()).floatValue();<NEW_LINE>} else if (source == spinnerForwardsBackwards) {<NEW_LINE>configKlt.toleranceFB = ((Number) spinnerForwardsBackwards.getValue()).doubleValue();<NEW_LINE>} else if (source == spinnerIterations) {<NEW_LINE>configKlt.config.maxIterations = ((Number) spinnerIterations.getValue()).intValue();<NEW_LINE>} else if (source == checkPruneClose) {<NEW_LINE>configKlt<MASK><NEW_LINE>}<NEW_LINE>listener.changedPointTrackerKlt();<NEW_LINE>} | .pruneClose = checkPruneClose.isSelected(); |
1,348,944 | private Component createRangeListPanel() {<NEW_LINE>addRangeButton = new JButton(ADD_ICON);<NEW_LINE>addRangeButton.addActionListener(new ActionListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(ActionEvent e) {<NEW_LINE>showAddRangeDialog();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>addRangeButton.setToolTipText("Add the range to the set of included addresses");<NEW_LINE>subtractRangeButton = new JButton(SUBTRACT_ICON);<NEW_LINE>subtractRangeButton.addActionListener(new ActionListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(ActionEvent e) {<NEW_LINE>showSubtractRangeDialog();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>subtractRangeButton.setToolTipText("Remove the range from the set of included addresses");<NEW_LINE>JPanel buttonPanel = new JPanel();<NEW_LINE>buttonPanel.add(addRangeButton);<NEW_LINE>buttonPanel.add(subtractRangeButton);<NEW_LINE>JPanel headerPanel = <MASK><NEW_LINE>headerPanel.add(new GLabel("Address Ranges:"), BorderLayout.WEST);<NEW_LINE>headerPanel.add(buttonPanel, BorderLayout.EAST);<NEW_LINE>listModel = new AddressSetListModel(myCurrentAddressSet.toList());<NEW_LINE>list = new GList<>(listModel);<NEW_LINE>list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);<NEW_LINE>list.getSelectionModel().addListSelectionListener(new ListSelectionListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void valueChanged(ListSelectionEvent e) {<NEW_LINE>validateRemoveButton();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>JScrollPane scrollPane = new JScrollPane(list);<NEW_LINE>JPanel panel = new JPanel(new BorderLayout());<NEW_LINE>panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));<NEW_LINE>panel.add(headerPanel, BorderLayout.NORTH);<NEW_LINE>panel.add(scrollPane, BorderLayout.CENTER);<NEW_LINE>panel.add(createRemoveRangePanel(), BorderLayout.SOUTH);<NEW_LINE>return panel;<NEW_LINE>} | new JPanel(new BorderLayout()); |
1,176,263 | public DescribeVirtualGatewaysResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>DescribeVirtualGatewaysResult describeVirtualGatewaysResult = new DescribeVirtualGatewaysResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return describeVirtualGatewaysResult;<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("virtualGateways", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>describeVirtualGatewaysResult.setVirtualGateways(new ListUnmarshaller<VirtualGateway>(VirtualGatewayJsonUnmarshaller.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 describeVirtualGatewaysResult;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
1,536,574 | private void init() {<NEW_LINE>// Set up profile array list<NEW_LINE>profileList = new ArrayList<EMMLProfile>();<NEW_LINE>// Setup the httpEquiv splitter<NEW_LINE><MASK><NEW_LINE>// Setup the url extractor<NEW_LINE>// urlMatcher = Pattern.compile("\\s*(url[(]'(.*)'\\s*(.*)\\s*[)];)\\s*").matcher("");<NEW_LINE>// urlMatcher = Pattern.compile("\\s*(url\\s*[(]\\s*'(.*?)('\\s*[)]))\\s*").matcher("");<NEW_LINE>urlMatcher = Pattern.compile("\\s*(url\\s*[(]\\s*(['\"])(.*?)(\\2\\s*[)]))\\s*").matcher("");<NEW_LINE>commentMatcher = Pattern.compile("[/][*].*?[*][/]", Pattern.DOTALL).matcher("");<NEW_LINE>profileSplitter = Pattern.compile("\\.(.*?)\\{(.*?)\\}", Pattern.DOTALL).matcher("");<NEW_LINE>bracketMatcher = Pattern.compile("(.*?)(['\"])\\s*([)])").matcher("");<NEW_LINE>loadRegex(false);<NEW_LINE>} | ctSplitter = Pattern.compile("\\s*-\\s*"); |
1,265,929 | public boolean onPreferenceClick(Preference preference) {<NEW_LINE>if (preference == mRelatedPostsPref) {<NEW_LINE>showRelatedPostsDialog();<NEW_LINE>} else if (preference == mMultipleLinksPref) {<NEW_LINE>showMultipleLinksDialog();<NEW_LINE>} else if (preference == mModerationHoldPref) {<NEW_LINE>mEditingList = mSiteSettings.getModerationKeys();<NEW_LINE>showListEditorDialog(R.string.site_settings_moderation_hold_title, R.string.site_settings_hold_for_moderation_description);<NEW_LINE>} else if (preference == mDenylistPref) {<NEW_LINE>mEditingList = mSiteSettings.getDenylistKeys();<NEW_LINE>showListEditorDialog(R.string.<MASK><NEW_LINE>} else if (preference == mJpAllowlistPref) {<NEW_LINE>AnalyticsTracker.track(Stat.SITE_SETTINGS_JETPACK_ALLOWLISTED_IPS_VIEWED);<NEW_LINE>mEditingList = mSiteSettings.getJetpackAllowlistKeys();<NEW_LINE>showListEditorDialog(R.string.jetpack_brute_force_allowlist_title, R.string.site_settings_jetpack_allowlist_description);<NEW_LINE>} else if (preference == mStartOverPref) {<NEW_LINE>handleStartOver();<NEW_LINE>} else if (preference == mCloseAfterPref) {<NEW_LINE>showCloseAfterDialog();<NEW_LINE>} else if (preference == mPagingPref) {<NEW_LINE>showPagingDialog();<NEW_LINE>} else if (preference == mThreadingPref) {<NEW_LINE>showThreadingDialog();<NEW_LINE>} else if (preference == mCategoryPref || preference == mFormatPref) {<NEW_LINE>return !shouldShowListPreference((DetailListPreference) preference);<NEW_LINE>} else if (preference == mExportSitePref) {<NEW_LINE>showExportContentDialog();<NEW_LINE>} else if (preference == mDeleteSitePref) {<NEW_LINE>AnalyticsUtils.trackWithSiteDetails(AnalyticsTracker.Stat.SITE_SETTINGS_DELETE_SITE_ACCESSED, mSite);<NEW_LINE>requestPurchasesForDeletionCheck();<NEW_LINE>} else if (preference == mTagsPref) {<NEW_LINE>SiteSettingsTagListActivity.showTagList(getActivity(), mSite);<NEW_LINE>} else if (preference == mCategoriesPref) {<NEW_LINE>ActivityLauncher.showCategoriesList(getActivity(), mSite);<NEW_LINE>} else {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | site_settings_denylist_title, R.string.site_settings_denylist_description); |
1,564,154 | private void dispose() {<NEW_LINE>if (!initialized) {<NEW_LINE>// The RubyContext will be finalized and disposed if patching fails (potentially for<NEW_LINE>// another language). In that case, there is nothing to clean or execute.<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (consoleHolder != null) {<NEW_LINE>consoleHolder.close();<NEW_LINE>}<NEW_LINE>threadManager.dispose();<NEW_LINE>threadManager.checkNoRunningThreads();<NEW_LINE>Signals.restoreDefaultHandlers();<NEW_LINE>if (options.ROPE_PRINT_INTERN_STATS) {<NEW_LINE>RubyLanguage.LOGGER.info("ropes re-used: " + <MASK><NEW_LINE>RubyLanguage.LOGGER.info("rope byte arrays re-used: " + language.ropeCache.getByteArrayReusedCount());<NEW_LINE>RubyLanguage.LOGGER.info("rope bytes saved: " + language.ropeCache.getRopeBytesSaved());<NEW_LINE>RubyLanguage.LOGGER.info("total ropes interned: " + language.ropeCache.totalRopes());<NEW_LINE>}<NEW_LINE>if (options.CEXTS_TO_NATIVE_STATS) {<NEW_LINE>RubyLanguage.LOGGER.info("Total VALUE object to native conversions: " + getValueWrapperManager().totalHandleAllocations());<NEW_LINE>}<NEW_LINE>valueWrapperManager.freeAllBlocksInMap(language);<NEW_LINE>} | language.ropeCache.getRopesReusedCount()); |
209,853 | public void handleEvent(Event event) {<NEW_LINE>if (hoveredItem == null || hoveredItem.isDisposed())<NEW_LINE>return;<NEW_LINE>if (eyeball != null) {<NEW_LINE>int endOfClientAreaX = tree.getClientArea().width + tree.getClientArea().x;<NEW_LINE>int endOfItemX = hoveredItem.getBounds().width + hoveredItem.getBounds().x;<NEW_LINE>lastDrawnX = Math.max(endOfClientAreaX, endOfItemX) - (IMAGE_MARGIN + <MASK><NEW_LINE>int itemHeight = tree.getItemHeight();<NEW_LINE>int imageHeight = eyeball.getBounds().height;<NEW_LINE>int y = hoveredItem.getBounds().y + (itemHeight - imageHeight) / 2;<NEW_LINE>event.gc.drawImage(eyeball, lastDrawnX, y);<NEW_LINE>}<NEW_LINE>} | eyeball.getBounds().width); |
339,757 | final DeleteWorkspaceResult executeDeleteWorkspace(DeleteWorkspaceRequest deleteWorkspaceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteWorkspaceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteWorkspaceRequest> request = null;<NEW_LINE>Response<DeleteWorkspaceResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new DeleteWorkspaceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteWorkspaceRequest));<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, "amp");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteWorkspace");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteWorkspaceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteWorkspaceResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.RequestMarshallTime); |
1,291,926 | protected String doIt() throws Exception {<NEW_LINE>// Instance current Payment Selection<NEW_LINE>MPaySelection paySelection = new MPaySelection(getCtx(), getRecord_ID(), get_TrxName());<NEW_LINE>sequence.set(paySelection.getLastLineNo());<NEW_LINE>// Loop for keys<NEW_LINE>getSelectionKeys().forEach(key -> {<NEW_LINE>// get values from result set<NEW_LINE>int movementId = key;<NEW_LINE>String paymentRule = getSelectionAsString(key, "HRM_PaymentRule");<NEW_LINE>BigDecimal sourceAmount = getSelectionAsBigDecimal(key, "HRM_Amount");<NEW_LINE>BigDecimal convertedAmount = getSelectionAsBigDecimal(key, "HRM_ConvertedAmount");<NEW_LINE>MPaySelectionLine line = new MPaySelectionLine(paySelection, sequence<MASK><NEW_LINE>// Add Order<NEW_LINE>X_HR_Movement payrollMovement = new X_HR_Movement(getCtx(), movementId, get_TrxName());<NEW_LINE>Optional<X_HR_Process> mybePayrollProcess = Optional.ofNullable(payrollProcessMap.get(payrollMovement.getHR_Process_ID()));<NEW_LINE>X_HR_Process payrollProcess = mybePayrollProcess.orElseGet(() -> {<NEW_LINE>X_HR_Process processFromMovement = (X_HR_Process) payrollMovement.getHR_Process();<NEW_LINE>payrollProcessMap.put(payrollMovement.getHR_Process_ID(), processFromMovement);<NEW_LINE>return processFromMovement;<NEW_LINE>});<NEW_LINE>// Set from Payroll Movement and conversion type<NEW_LINE>line.setHRMovement(payrollMovement, payrollProcess.getC_ConversionType_ID(), sourceAmount, convertedAmount);<NEW_LINE>// Save<NEW_LINE>line.saveEx();<NEW_LINE>});<NEW_LINE>// Default Ok<NEW_LINE>return "@OK@";<NEW_LINE>} | .getAndAdd(10), paymentRule); |
1,309,315 | /*<NEW_LINE>private double clamp(double d){<NEW_LINE>double abs = Math.abs(d);<NEW_LINE>if ( Math.abs(abs-Math.round(abs)) < 0.001){<NEW_LINE>return Math.round(d);<NEW_LINE>}<NEW_LINE>return d;<NEW_LINE>}<NEW_LINE>private float clamp(float d){<NEW_LINE>float <MASK><NEW_LINE>if ( Math.abs(abs-Math.round(abs)) < 0.001){<NEW_LINE>return Math.round(d);<NEW_LINE>}<NEW_LINE>return d;<NEW_LINE>}<NEW_LINE><NEW_LINE>private double[] clamp(double[] in){<NEW_LINE>for ( int i=0; i<in.length; i++){<NEW_LINE>in[i] = clamp(in[i]);<NEW_LINE>}<NEW_LINE>return in;<NEW_LINE>}<NEW_LINE>private float[] clamp(float[] in){<NEW_LINE>for ( int i=0; i<in.length; i++){<NEW_LINE>in[i] = clamp(in[i]);<NEW_LINE>}<NEW_LINE>return in;<NEW_LINE>}<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public boolean transformNativeEqualsImpl(Object t1, Object t2) {<NEW_LINE>if (t1 != null) {<NEW_LINE>AffineTransform at1 = (AffineTransform) t1;<NEW_LINE>AffineTransform at2 = (AffineTransform) t2;<NEW_LINE>return at1.equals(at2);<NEW_LINE>} else {<NEW_LINE>return t2 == null;<NEW_LINE>}<NEW_LINE>} | abs = Math.abs(d); |
299,036 | public static GetOwnerApplyOrderDetailResponse unmarshall(GetOwnerApplyOrderDetailResponse getOwnerApplyOrderDetailResponse, UnmarshallerContext _ctx) {<NEW_LINE>getOwnerApplyOrderDetailResponse.setRequestId(_ctx.stringValue("GetOwnerApplyOrderDetailResponse.RequestId"));<NEW_LINE>getOwnerApplyOrderDetailResponse.setSuccess(_ctx.booleanValue("GetOwnerApplyOrderDetailResponse.Success"));<NEW_LINE>getOwnerApplyOrderDetailResponse.setErrorMessage(_ctx.stringValue("GetOwnerApplyOrderDetailResponse.ErrorMessage"));<NEW_LINE>getOwnerApplyOrderDetailResponse.setErrorCode(_ctx.stringValue("GetOwnerApplyOrderDetailResponse.ErrorCode"));<NEW_LINE>OwnerApplyOrderDetail ownerApplyOrderDetail = new OwnerApplyOrderDetail();<NEW_LINE>ownerApplyOrderDetail.setApplyType(_ctx.stringValue("GetOwnerApplyOrderDetailResponse.OwnerApplyOrderDetail.ApplyType"));<NEW_LINE>List<Resource> resources = new ArrayList<Resource>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("GetOwnerApplyOrderDetailResponse.OwnerApplyOrderDetail.Resources.Length"); i++) {<NEW_LINE>Resource resource = new Resource();<NEW_LINE>resource.setLogic(_ctx.booleanValue("GetOwnerApplyOrderDetailResponse.OwnerApplyOrderDetail.Resources[" + i + "].Logic"));<NEW_LINE>resource.setTargetId(_ctx.stringValue("GetOwnerApplyOrderDetailResponse.OwnerApplyOrderDetail.Resources[" + i + "].TargetId"));<NEW_LINE>ResourceDetail resourceDetail = new ResourceDetail();<NEW_LINE>resourceDetail.setSearchName(_ctx.stringValue("GetOwnerApplyOrderDetailResponse.OwnerApplyOrderDetail.Resources[" + i + "].ResourceDetail.SearchName"));<NEW_LINE>resourceDetail.setDbType(_ctx.stringValue("GetOwnerApplyOrderDetailResponse.OwnerApplyOrderDetail.Resources[" + i + "].ResourceDetail.DbType"));<NEW_LINE>resourceDetail.setEnvType(_ctx.stringValue("GetOwnerApplyOrderDetailResponse.OwnerApplyOrderDetail.Resources[" + i + "].ResourceDetail.EnvType"));<NEW_LINE>resourceDetail.setTableName(_ctx.stringValue("GetOwnerApplyOrderDetailResponse.OwnerApplyOrderDetail.Resources[" + i + "].ResourceDetail.TableName"));<NEW_LINE>List<Long> ownerIds = new ArrayList<Long>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("GetOwnerApplyOrderDetailResponse.OwnerApplyOrderDetail.Resources[" + i + "].ResourceDetail.OwnerIds.Length"); j++) {<NEW_LINE>ownerIds.add(_ctx.longValue("GetOwnerApplyOrderDetailResponse.OwnerApplyOrderDetail.Resources[" + i <MASK><NEW_LINE>}<NEW_LINE>resourceDetail.setOwnerIds(ownerIds);<NEW_LINE>List<String> ownerNickNames = new ArrayList<String>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("GetOwnerApplyOrderDetailResponse.OwnerApplyOrderDetail.Resources[" + i + "].ResourceDetail.OwnerNickNames.Length"); j++) {<NEW_LINE>ownerNickNames.add(_ctx.stringValue("GetOwnerApplyOrderDetailResponse.OwnerApplyOrderDetail.Resources[" + i + "].ResourceDetail.OwnerNickNames[" + j + "]"));<NEW_LINE>}<NEW_LINE>resourceDetail.setOwnerNickNames(ownerNickNames);<NEW_LINE>resource.setResourceDetail(resourceDetail);<NEW_LINE>resources.add(resource);<NEW_LINE>}<NEW_LINE>ownerApplyOrderDetail.setResources(resources);<NEW_LINE>getOwnerApplyOrderDetailResponse.setOwnerApplyOrderDetail(ownerApplyOrderDetail);<NEW_LINE>return getOwnerApplyOrderDetailResponse;<NEW_LINE>} | + "].ResourceDetail.OwnerIds[" + j + "]")); |
25,818 | private void writeClass() {<NEW_LINE>if (writingAssocBean) {<NEW_LINE>writer.append("/**").eol();<NEW_LINE>writer.append(" * Association query bean for %s.", shortName).eol();<NEW_LINE>writer.append(" * ").eol();<NEW_LINE>writer.append(" * THIS IS A GENERATED OBJECT, DO NOT MODIFY THIS CLASS.").eol();<NEW_LINE>writer.append(" */").eol();<NEW_LINE>writer.append(Constants.AT_GENERATED).eol();<NEW_LINE>writer.append(Constants.AT_TYPEQUERYBEAN).eol();<NEW_LINE>writer.append("public class Q%s<R> extends TQAssocBean<%s,R> {", shortName, origShortName).eol();<NEW_LINE>} else {<NEW_LINE>writer.append("/**").eol();<NEW_LINE>writer.append(" * Query bean for %s.", shortName).eol();<NEW_LINE>writer.append(" * ").eol();<NEW_LINE>writer.append(" * THIS IS A GENERATED OBJECT, DO NOT MODIFY THIS CLASS.").eol();<NEW_LINE>writer.<MASK><NEW_LINE>writer.append(Constants.AT_GENERATED).eol();<NEW_LINE>writer.append(Constants.AT_TYPEQUERYBEAN).eol();<NEW_LINE>writer.append("public class Q%s extends TQRootBean<%1$s,Q%1$s> {", shortName).eol();<NEW_LINE>}<NEW_LINE>writer.eol();<NEW_LINE>} | append(" */").eol(); |
131,211 | public static LoadBalancerListenerInventory valueOf(LoadBalancerListenerVO vo) {<NEW_LINE>LoadBalancerListenerInventory inv = new LoadBalancerListenerInventory();<NEW_LINE>inv.setUuid(vo.getUuid());<NEW_LINE>inv.setLoadBalancerUuid(vo.getLoadBalancerUuid());<NEW_LINE>inv.setCreateDate(vo.getCreateDate());<NEW_LINE>inv.setLastOpDate(vo.getLastOpDate());<NEW_LINE>inv.setInstancePort(vo.getInstancePort());<NEW_LINE>inv.setLoadBalancerPort(vo.getLoadBalancerPort());<NEW_LINE>inv.setProtocol(vo.getProtocol());<NEW_LINE>inv.setSecurityPolicyType(vo.getSecurityPolicyType());<NEW_LINE>inv.setName(vo.getName());<NEW_LINE>inv.setDescription(vo.getDescription());<NEW_LINE>inv.setServerGroupUuid(vo.getServerGroupUuid());<NEW_LINE>List<LoadBalancerServerGroupVmNicRefVO> serverGroupVmNicRefVOs = Q.New(LoadBalancerServerGroupVmNicRefVO.class).eq(LoadBalancerServerGroupVmNicRefVO_.serverGroupUuid, vo.getServerGroupUuid()).list();<NEW_LINE>Set<LoadBalancerListenerVmNicRefVO> vmNicRefs = new HashSet<>();<NEW_LINE>for (LoadBalancerServerGroupVmNicRefVO serverGroupVmNicRefVO : serverGroupVmNicRefVOs) {<NEW_LINE>LoadBalancerListenerVmNicRefVO vmNicRefVO = new LoadBalancerListenerVmNicRefVO();<NEW_LINE>vmNicRefVO.setId(serverGroupVmNicRefVO.getId());<NEW_LINE>vmNicRefVO.setListenerUuid(vo.getUuid());<NEW_LINE>vmNicRefVO.setCreateDate(serverGroupVmNicRefVO.getCreateDate());<NEW_LINE>vmNicRefVO.<MASK><NEW_LINE>vmNicRefVO.setStatus(serverGroupVmNicRefVO.getStatus());<NEW_LINE>vmNicRefVO.setVmNicUuid(serverGroupVmNicRefVO.getVmNicUuid());<NEW_LINE>vmNicRefs.add(vmNicRefVO);<NEW_LINE>}<NEW_LINE>vo.setVmNicRefs(vmNicRefs);<NEW_LINE>inv.setVmNicRefs(LoadBalancerListenerVmNicRefInventory.valueOf(vo.getVmNicRefs()));<NEW_LINE>inv.setAclRefs(LoadBalancerListenerACLRefInventory.valueOf(vo.getAclRefs()));<NEW_LINE>inv.setCertificateRefs(LoadBalancerListenerCertificateRefInventory.valueOf(vo.getCertificateRefs()));<NEW_LINE>inv.setServerGroupRefs(LoadBalancerListenerServerGroupRefInventory.valueOf(vo.getServerGroupRefs()));<NEW_LINE>return inv;<NEW_LINE>} | setLastOpDate(serverGroupVmNicRefVO.getLastOpDate()); |
327,770 | private ConfigDelta computeDelta(ConfigElement oldConfig, ConfigElement newConfig, RegistryEntry registryEntry, Map<String, DeltaType> variableDelta) throws ConfigMergeException {<NEW_LINE>ConfigElement oldElement = (oldConfig == null || !oldConfig.isEnabled()) ? null : oldConfig;<NEW_LINE>ConfigElement newElement = (newConfig == null || !newConfig.isEnabled()) ? null : newConfig;<NEW_LINE>List<ConfigDelta> nestedDelta = null;<NEW_LINE>if ((oldElement != null && oldElement.hasNestedElements()) || (newElement != null && newElement.hasNestedElements())) {<NEW_LINE>BaseConfiguration oldNestedConfiguration = buildConfiguration(oldElement, registryEntry);<NEW_LINE>BaseConfiguration <MASK><NEW_LINE>ConfigComparator nestedComparator = new ConfigComparator(oldNestedConfiguration, newNestedConfiguration, metatypeRegistry);<NEW_LINE>nestedComparator.setParent(registryEntry);<NEW_LINE>nestedDelta = nestedComparator.computeConfigDelta(variableDelta);<NEW_LINE>}<NEW_LINE>if (oldElement == null) {<NEW_LINE>if (newElement == null) {<NEW_LINE>return null;<NEW_LINE>} else {<NEW_LINE>return new ConfigDelta(newElement, DeltaType.ADDED, nestedDelta, registryEntry, REASON.PROPERTIES_UPDATE);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (newElement == null) {<NEW_LINE>ConfigElement removedConfig = newConfig == null ? oldConfig : newConfig;<NEW_LINE>return new ConfigDelta(removedConfig, DeltaType.REMOVED, nestedDelta, registryEntry, REASON.PROPERTIES_UPDATE);<NEW_LINE>}<NEW_LINE>if (!compare(oldElement, newElement) || hasChangedVariables(newElement, registryEntry, variableDelta)) {<NEW_LINE>// If either properties or variables have changed, process an update<NEW_LINE>return new ConfigDelta(newElement, DeltaType.MODIFIED, nestedDelta, registryEntry, REASON.PROPERTIES_UPDATE);<NEW_LINE>} else if (nestedDelta != null && !nestedDelta.isEmpty()) {<NEW_LINE>// We produce a delta in this case because we update parents when<NEW_LINE>// nested elements change (unless hideFromParent is specified.)<NEW_LINE>return new ConfigDelta(newElement, DeltaType.MODIFIED, nestedDelta, registryEntry, REASON.NESTED_UPDATE_ONLY);<NEW_LINE>} else {<NEW_LINE>// No changes<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | newNestedConfiguration = buildConfiguration(newElement, registryEntry); |
579,990 | private void fillUp() {<NEW_LINE>List<NodeHandler> connectNodes = new ArrayList<>();<NEW_LINE>Set<InetAddress> addressInUse = new HashSet<>();<NEW_LINE>Set<String> nodesInUse = new HashSet<>();<NEW_LINE>channelManager.getActivePeers().forEach(channel -> {<NEW_LINE>nodesInUse.add(channel.getPeerId());<NEW_LINE>addressInUse.<MASK><NEW_LINE>});<NEW_LINE>channelManager.getActiveNodes().forEach((address, node) -> {<NEW_LINE>nodesInUse.add(node.getHexId());<NEW_LINE>if (!addressInUse.contains(address)) {<NEW_LINE>connectNodes.add(nodeManager.getNodeHandler(node));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>int size = Math.max((int) (maxActiveNodes * factor) - activePeers.size(), (int) (maxActiveNodes * activeFactor - activePeersCount.get()));<NEW_LINE>int lackSize = size - connectNodes.size();<NEW_LINE>if (lackSize > 0) {<NEW_LINE>nodesInUse.add(nodeManager.getPublicHomeNode().getHexId());<NEW_LINE>List<NodeHandler> newNodes = nodeManager.getNodes(new NodeSelector(nodesInUse), lackSize);<NEW_LINE>connectNodes.addAll(newNodes);<NEW_LINE>}<NEW_LINE>connectNodes.forEach(n -> {<NEW_LINE>peerClient.connectAsync(n, false);<NEW_LINE>nodeHandlerCache.put(n, System.currentTimeMillis());<NEW_LINE>});<NEW_LINE>} | add(channel.getInetAddress()); |
1,583,515 | private Contentlet runCheckinPublishNoWorkflow(final String resourceUri, final User user, final boolean isAutoPub, final boolean disableWorkflow, Contentlet fileAsset) throws DotDataException, DotSecurityException {<NEW_LINE>fileAsset.setBoolProperty(Contentlet.DISABLE_WORKFLOW, disableWorkflow);<NEW_LINE>fileAsset = conAPI.checkin(fileAsset, user, false);<NEW_LINE>fileAsset.getMap().put(Contentlet.VALIDATE_EMPTY_FILE, false);<NEW_LINE>if (isAutoPub && perAPI.doesUserHavePermission(fileAsset, PermissionAPI.PERMISSION_PUBLISH, user)) {<NEW_LINE>fileAsset.setBoolProperty(Contentlet.DISABLE_WORKFLOW, disableWorkflow);<NEW_LINE>conAPI.publish(fileAsset, user, false);<NEW_LINE>final Date currentDate = new Date();<NEW_LINE>fileResourceCache.add(resourceUri + "|" + user.getUserId(<MASK><NEW_LINE>}<NEW_LINE>return fileAsset;<NEW_LINE>} | ), currentDate.getTime()); |
1,366,490 | private void showConfigPanelForCustomizer(WebModule webModule) {<NEW_LINE>Project enclosingProject = Util.getEnclosingProjectFromWebModule(webModule);<NEW_LINE>HibernateEnvironment he = enclosingProject.getLookup().lookup(HibernateEnvironment.class);<NEW_LINE>List<FileObject> configFileObjects = he.getAllHibernateConfigFileObjects();<NEW_LINE>for (FileObject configFile : configFileObjects) {<NEW_LINE>if (configFile.getName().equals(DEFAULT_CONFIG_FILENAME)) {<NEW_LINE>try {<NEW_LINE>HibernateCfgDataObject hibernateDO = (<MASK><NEW_LINE>SessionFactory sessionFactory = hibernateDO.getHibernateConfiguration().getSessionFactory();<NEW_LINE>int index = 0;<NEW_LINE>for (String propValue : sessionFactory.getProperty2()) {<NEW_LINE>// NOI18N<NEW_LINE>String propName = sessionFactory.getAttributeValue(SessionFactory.PROPERTY2, index++, "name");<NEW_LINE>if (dialect.contains(propName)) {<NEW_LINE>configPanel.setDialect(propValue);<NEW_LINE>}<NEW_LINE>if (url.contains(propName)) {<NEW_LINE>configPanel.setDatabaseConnection(propValue);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (DataObjectNotFoundException ex) {<NEW_LINE>Exceptions.printStackTrace(ex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>configPanel.disable();<NEW_LINE>}<NEW_LINE>} | HibernateCfgDataObject) DataObject.find(configFile); |
1,049,153 | public DataSet<Row> buildIndex(BatchOperator in, Params params) {<NEW_LINE>Preconditions.checkArgument(params.get(VectorApproxNearestNeighborTrainParams.METRIC).equals(VectorApproxNearestNeighborTrainParams.Metric.EUCLIDEAN), "KDTree solver only supports Euclidean distance!");<NEW_LINE>EuclideanDistance distance = new EuclideanDistance();<NEW_LINE>Tuple2<DataSet<Vector>, DataSet<BaseVectorSummary>> statistics = StatisticsHelper.summaryHelper(in, null, params.get(VectorApproxNearestNeighborTrainParams.SELECTED_COL));<NEW_LINE>return in.getDataSet().rebalance().mapPartition(new RichMapPartitionFunction<Row, Row>() {<NEW_LINE><NEW_LINE>private static final long serialVersionUID = 6654757741959479783L;<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void mapPartition(Iterable<Row> values, Collector<Row> out) throws Exception {<NEW_LINE>BaseVectorSummary summary = (BaseVectorSummary) getRuntimeContext().getBroadcastVariable("vectorSize").get(0);<NEW_LINE>int vectorSize = summary.vectorSize();<NEW_LINE>List<FastDistanceVectorData> list = new ArrayList<>();<NEW_LINE>for (Row row : values) {<NEW_LINE>FastDistanceVectorData vector = distance.prepareVectorData(row, 1, 0);<NEW_LINE>list.add(vector);<NEW_LINE>vectorSize = vector.getVector().size();<NEW_LINE>}<NEW_LINE>if (list.size() > 0) {<NEW_LINE>FastDistanceVectorData[] vectorArray = list.toArray(new FastDistanceVectorData[0]);<NEW_LINE>KDTree tree = new KDTree(vectorArray, vectorSize, distance);<NEW_LINE>tree.buildTree();<NEW_LINE>int taskId = getRuntimeContext().getIndexOfThisSubtask();<NEW_LINE>Row row = new Row(ROW_SIZE);<NEW_LINE>row.setField(TASKID_INDEX, (long) taskId);<NEW_LINE>for (int i = 0; i < vectorArray.length; i++) {<NEW_LINE>row.setField(DATA_ID_INDEX, (long) i);<NEW_LINE>row.setField(DATA_IDNEX, vectorArray[i].toString());<NEW_LINE>out.collect(row);<NEW_LINE>}<NEW_LINE>row.setField(DATA_ID_INDEX, null);<NEW_LINE>row.setField(DATA_IDNEX, null);<NEW_LINE>row.setField(ROOT_IDDEX, JsonConverter.toJson(tree.getRoot()));<NEW_LINE>out.collect(row);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}).withBroadcastSet(statistics.f1, "vectorSize").mapPartition(new RichMapPartitionFunction<Row, Row>() {<NEW_LINE><NEW_LINE>private static final long serialVersionUID = 6849403933586157611L;<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void mapPartition(Iterable<Row> values, Collector<Row> out) throws Exception {<NEW_LINE>Params meta = null;<NEW_LINE>if (getRuntimeContext().getIndexOfThisSubtask() == 0) {<NEW_LINE>meta = params;<NEW_LINE>BaseVectorSummary summary = (BaseVectorSummary) getRuntimeContext().getBroadcastVariable("vectorSize").get(0);<NEW_LINE>int vectorSize = summary.vectorSize();<NEW_LINE>meta.set(VECTOR_SIZE, vectorSize);<NEW_LINE>}<NEW_LINE>new KDTreeModelDataConverter().save(Tuple2.of(meta, values), out);<NEW_LINE>}<NEW_LINE>}).<MASK><NEW_LINE>} | withBroadcastSet(statistics.f1, "vectorSize"); |
1,388,312 | final TagResourceResult executeTagResource(TagResourceRequest tagResourceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(tagResourceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<TagResourceRequest> request = null;<NEW_LINE>Response<TagResourceResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new TagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(tagResourceRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "IoT 1Click Projects");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "TagResource");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<TagResourceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new TagResourceResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden()); |
1,644,992 | public void enterS_interface(S_interfaceContext ctx) {<NEW_LINE>String nameAlpha = ctx.iname.name_prefix_alpha.getText();<NEW_LINE>String canonicalNamePrefix;<NEW_LINE>try {<NEW_LINE>canonicalNamePrefix = AsaConfiguration.getCanonicalInterfaceNamePrefix(nameAlpha);<NEW_LINE>} catch (BatfishException e) {<NEW_LINE>warn(ctx, "Error fetching interface name: " + e.getMessage());<NEW_LINE>_currentInterfaces = ImmutableList.of();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>StringBuilder namePrefix = new StringBuilder(canonicalNamePrefix);<NEW_LINE>for (Token part : ctx.iname.name_middle_parts) {<NEW_LINE>namePrefix.append(part.getText());<NEW_LINE>}<NEW_LINE>_currentInterfaces = new ArrayList<>();<NEW_LINE>if (ctx.iname.range() != null) {<NEW_LINE>List<SubRange> ranges = toRange(ctx.iname.range());<NEW_LINE>for (SubRange range : ranges) {<NEW_LINE>for (int i = range.getStart(); i <= range.getEnd(); i++) {<NEW_LINE>String name <MASK><NEW_LINE>addInterface(name, ctx.iname, true);<NEW_LINE>_configuration.defineStructure(INTERFACE, name, ctx);<NEW_LINE>_configuration.referenceStructure(INTERFACE, name, INTERFACE_SELF_REF, ctx.getStart().getLine());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>addInterface(namePrefix.toString(), ctx.iname, true);<NEW_LINE>}<NEW_LINE>if (ctx.MULTIPOINT() != null) {<NEW_LINE>todo(ctx);<NEW_LINE>}<NEW_LINE>} | = namePrefix.toString() + i; |
1,637,247 | private void runLayoutCodeProcess(final Runnable readAction, final Runnable writeAction) {<NEW_LINE>final ProgressWindow progressWindow = new ProgressWindow(true, myProject);<NEW_LINE>progressWindow.setTitle(myCommandName);<NEW_LINE>progressWindow.setText(myProgressText);<NEW_LINE>final <MASK><NEW_LINE>final Runnable process = () -> ApplicationManager.getApplication().runReadAction(readAction);<NEW_LINE>Runnable runnable = () -> {<NEW_LINE>try {<NEW_LINE>ProgressManager.getInstance().runProcess(process, progressWindow);<NEW_LINE>} catch (ProcessCanceledException e) {<NEW_LINE>return;<NEW_LINE>} catch (IndexNotReadyException e) {<NEW_LINE>LOG.warn(e);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final Runnable writeRunnable = () -> CommandProcessor.getInstance().executeCommand(myProject, () -> {<NEW_LINE>try {<NEW_LINE>writeAction.run();<NEW_LINE>if (myPostRunnable != null) {<NEW_LINE>ApplicationManager.getApplication().invokeLater(myPostRunnable);<NEW_LINE>}<NEW_LINE>} catch (IndexNotReadyException e) {<NEW_LINE>LOG.warn(e);<NEW_LINE>}<NEW_LINE>}, myCommandName, null);<NEW_LINE>if (ApplicationManager.getApplication().isUnitTestMode()) {<NEW_LINE>writeRunnable.run();<NEW_LINE>} else {<NEW_LINE>ApplicationManager.getApplication().invokeLater(writeRunnable, modalityState, myProject.getDisposed());<NEW_LINE>}<NEW_LINE>};<NEW_LINE>if (ApplicationManager.getApplication().isUnitTestMode()) {<NEW_LINE>runnable.run();<NEW_LINE>} else {<NEW_LINE>ApplicationManager.getApplication().executeOnPooledThread(runnable);<NEW_LINE>}<NEW_LINE>} | ModalityState modalityState = ModalityState.current(); |
343,500 | public static void consumeRecipes(Consumer<FillingRecipe> consumer, IIngredientManager ingredientManager) {<NEW_LINE>Collection<FluidStack> fluidStacks = ingredientManager.getAllIngredients(VanillaTypes.FLUID);<NEW_LINE>for (ItemStack stack : ingredientManager.getAllIngredients(VanillaTypes.ITEM)) {<NEW_LINE>if (stack.getItem() instanceof PotionItem) {<NEW_LINE>FluidStack fluidFromPotionItem = PotionFluidHandler.getFluidFromPotionItem(stack);<NEW_LINE>Ingredient bottle = Ingredient.of(Items.GLASS_BOTTLE);<NEW_LINE>consumer.accept(new ProcessingRecipeBuilder<>(FillingRecipe::new, Create.asResource("potions")).withItemIngredients(bottle).withFluidIngredients(FluidIngredient.fromFluidStack(fluidFromPotionItem)).withSingleItemOutput(stack).build());<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>LazyOptional<IFluidHandlerItem> capability = stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY);<NEW_LINE>if (!capability.isPresent())<NEW_LINE>continue;<NEW_LINE>for (FluidStack fluidStack : fluidStacks) {<NEW_LINE>ItemStack copy = stack.copy();<NEW_LINE>copy.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY).ifPresent(fhi -> {<NEW_LINE>if (!GenericItemFilling.isFluidHandlerValid(copy, fhi))<NEW_LINE>return;<NEW_LINE>FluidStack fluidCopy = fluidStack.copy();<NEW_LINE>fluidCopy.setAmount(1000);<NEW_LINE>fhi.fill(fluidCopy, FluidAction.EXECUTE);<NEW_LINE>ItemStack container = fhi.getContainer();<NEW_LINE>if (container.sameItem(copy))<NEW_LINE>return;<NEW_LINE>if (container.isEmpty())<NEW_LINE>return;<NEW_LINE>Ingredient bucket = Ingredient.of(stack);<NEW_LINE>ResourceLocation itemName = stack.getItem().getRegistryName();<NEW_LINE>ResourceLocation fluidName = fluidCopy<MASK><NEW_LINE>consumer.accept(new ProcessingRecipeBuilder<>(FillingRecipe::new, Create.asResource("fill_" + itemName.getNamespace() + "_" + itemName.getPath() + "_with_" + fluidName.getNamespace() + "_" + fluidName.getPath())).withItemIngredients(bucket).withFluidIngredients(FluidIngredient.fromFluidStack(fluidCopy)).withSingleItemOutput(container).build());<NEW_LINE>});<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .getFluid().getRegistryName(); |
1,740,722 | public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {<NEW_LINE>if (holder instanceof MapMarkersGroupHeaderViewHolder) {<NEW_LINE>MapMarkersGroupHeaderViewHolder markersGroupHeaderViewHolder = (MapMarkersGroupHeaderViewHolder) holder;<NEW_LINE>markersGroupHeaderViewHolder.title.setText(app.getText(R.string.favourites_group));<NEW_LINE>markersGroupHeaderViewHolder.description.setText(app.getText(R.string.add_favourites_group_to_markers_descr));<NEW_LINE>} else if (holder instanceof MapMarkersGroupViewHolder) {<NEW_LINE>FavoriteGroup favoriteGroup = getItem(position);<NEW_LINE>MapMarkersGroupViewHolder markersGroupViewHolder = (MapMarkersGroupViewHolder) holder;<NEW_LINE>int color = favoriteGroup.getColor() == 0 ? ContextCompat.getColor(app, R.color.color_favorite) : favoriteGroup.getColor();<NEW_LINE>markersGroupViewHolder.icon.setImageDrawable(iconsCache.getPaintedIcon(R.drawable<MASK><NEW_LINE>markersGroupViewHolder.name.setText(favoriteGroup.getName().length() == 0 ? app.getString(R.string.shared_string_favorites) : favoriteGroup.getName());<NEW_LINE>markersGroupViewHolder.numberCount.setText(String.valueOf(favoriteGroup.getPoints().size()));<NEW_LINE>}<NEW_LINE>} | .ic_action_folder, color | 0xff000000)); |
647,073 | public String changeMyselfPassword(@RequestAttribute SysSite site, @SessionAttribute SysUser admin, String oldpassword, String password, String repassword, String encoding, HttpServletRequest request, HttpServletResponse response, ModelMap model) {<NEW_LINE>SysUser user = service.getEntity(admin.getId());<NEW_LINE>String encodedOldPassword = UserPasswordUtils.passwordEncode(oldpassword, user.getSalt(), encoding);<NEW_LINE>if (null != user.getPassword() && ControllerUtils.verifyNotEquals("password", user.getPassword(), encodedOldPassword, model)) {<NEW_LINE>return CommonConstants.TEMPLATE_ERROR;<NEW_LINE>} else if (ControllerUtils.verifyNotEmpty("password", password, model) || ControllerUtils.verifyNotEquals("repassword", password, repassword, model)) {<NEW_LINE>return CommonConstants.TEMPLATE_ERROR;<NEW_LINE>} else {<NEW_LINE>ControllerUtils.clearAdminToSession(request.getContextPath(), request.getSession(), response);<NEW_LINE>model.<MASK><NEW_LINE>}<NEW_LINE>String salt = UserPasswordUtils.getSalt();<NEW_LINE>service.updatePassword(user.getId(), UserPasswordUtils.passwordEncode(password, salt, encoding), salt);<NEW_LINE>if (user.isWeakPassword() && !UserPasswordUtils.isWeek(user.getName(), password)) {<NEW_LINE>service.updateWeekPassword(user.getId(), false);<NEW_LINE>}<NEW_LINE>sysUserTokenService.delete(user.getId());<NEW_LINE>logOperateService.save(new LogOperate(site.getId(), user.getId(), LogLoginService.CHANNEL_WEB_MANAGER, "changepassword", RequestUtils.getIpAddress(request), CommonUtils.getDate(), encodedOldPassword));<NEW_LINE>return "common/ajaxTimeout";<NEW_LINE>} | addAttribute(CommonConstants.MESSAGE, "message.needReLogin"); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.