idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
962,420 | @SaCheckLogin<NEW_LINE>public Object child(String siteId, @Param("pid") String pid, HttpServletRequest req) {<NEW_LINE>List<Cms_channel> list = new ArrayList<>();<NEW_LINE>List<NutMap> treeList = new ArrayList<>();<NEW_LINE><MASK><NEW_LINE>if (Strings.isBlank(pid)) {<NEW_LINE>cnd.and(Cnd.exps("parentId", "=", "").or("parentId", "is", null));<NEW_LINE>} else {<NEW_LINE>cnd.and("parentId", "=", pid);<NEW_LINE>}<NEW_LINE>cnd.and("siteid", "=", siteId);<NEW_LINE>cnd.asc("location").asc("path");<NEW_LINE>list = cmsChannelService.query(cnd);<NEW_LINE>for (Cms_channel channel : list) {<NEW_LINE>if (cmsChannelService.count(Cnd.where("parentId", "=", channel.getId())) > 0) {<NEW_LINE>channel.setHasChildren(true);<NEW_LINE>}<NEW_LINE>NutMap map = Lang.obj2nutmap(channel);<NEW_LINE>map.addv("expanded", false);<NEW_LINE>map.addv("children", new ArrayList<>());<NEW_LINE>treeList.add(map);<NEW_LINE>}<NEW_LINE>return Result.success().addData(treeList);<NEW_LINE>} | Cnd cnd = Cnd.NEW(); |
1,266,226 | public static double svmPredict(SvmModelData model, Vector x, KernelType kernelType, double gamma, double coef0, int degree) {<NEW_LINE>double[] svCoef = model.svCoef[0];<NEW_LINE>double sum = 0;<NEW_LINE>Vector[] supportVec = model.supportDenseVec != null ? model.supportDenseVec : model.supportSparseVec;<NEW_LINE>for (int i = 0; i < model.numSupportVec; i++) {<NEW_LINE>switch(kernelType) {<NEW_LINE>case LINEAR:<NEW_LINE>sum += svCoef[i] * x.dot(supportVec[i]);<NEW_LINE>break;<NEW_LINE>case POLY:<NEW_LINE>sum += svCoef[i] * Math.pow(gamma * x.dot(supportVec[i]) + coef0, degree);<NEW_LINE>break;<NEW_LINE>case RBF:<NEW_LINE>sum += svCoef[i] * Math.exp(-gamma * x.minus(supportVec[<MASK><NEW_LINE>break;<NEW_LINE>case SIGMOID:<NEW_LINE>sum += svCoef[i] * Math.tanh(gamma * x.dot(supportVec[i]) + coef0);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>}<NEW_LINE>}<NEW_LINE>sum -= model.rho[0];<NEW_LINE>return sum;<NEW_LINE>} | i]).normL2Square()); |
385,156 | private Object toJson(Comparative comparative) {<NEW_LINE>if (comparative instanceof ComparativeAND) {<NEW_LINE>final Map<String, Object<MASK><NEW_LINE>map.put("type", ComparativeAND.class.getSimpleName());<NEW_LINE>map.put("list", toJson(((ComparativeAND) comparative).getList()));<NEW_LINE>return map;<NEW_LINE>} else if (comparative instanceof ComparativeOR) {<NEW_LINE>final Map<String, Object> map = jsonBuilder.map();<NEW_LINE>map.put("type", ComparativeOR.class.getSimpleName());<NEW_LINE>map.put("list", toJson(((ComparativeOR) comparative).getList()));<NEW_LINE>return map;<NEW_LINE>} else if (comparative instanceof ExtComparative) {<NEW_LINE>final Map<String, Object> map = jsonBuilder.map();<NEW_LINE>map.put("type", ExtComparative.class.getSimpleName());<NEW_LINE>map.put("comparison", comparative.getComparison());<NEW_LINE>map.put("value", toJson(comparative.getValue()));<NEW_LINE>map.put("columnName", ((ExtComparative) comparative).getColumnName());<NEW_LINE>return map;<NEW_LINE>} else {<NEW_LINE>final Map<String, Object> map = jsonBuilder.map();<NEW_LINE>map.put("type", Comparative.class.getSimpleName());<NEW_LINE>map.put("comparison", comparative.getComparison());<NEW_LINE>map.put("value", toJson(comparative.getValue()));<NEW_LINE>return map;<NEW_LINE>}<NEW_LINE>} | > map = jsonBuilder.map(); |
331,913 | public static void checkModulePreconditions(String deploymentId, String moduleName, DeploymentInternal deployment, EPServicesContext services) throws EPUndeployPreconditionException {<NEW_LINE>for (String namedWindow : deployment.getPathNamedWindows()) {<NEW_LINE>checkDependency(services.getNamedWindowPathRegistry(), namedWindow, moduleName);<NEW_LINE>}<NEW_LINE>for (String table : deployment.getPathTables()) {<NEW_LINE>checkDependency(services.getTablePathRegistry(), table, moduleName);<NEW_LINE>}<NEW_LINE>for (String variable : deployment.getPathVariables()) {<NEW_LINE>checkDependency(services.getVariablePathRegistry(), variable, moduleName);<NEW_LINE>}<NEW_LINE>for (String context : deployment.getPathContexts()) {<NEW_LINE>checkDependency(services.getContextPathRegistry(), context, moduleName);<NEW_LINE>}<NEW_LINE>for (String eventType : deployment.getPathEventTypes()) {<NEW_LINE>checkDependency(services.getEventTypePathRegistry(), eventType, moduleName);<NEW_LINE>}<NEW_LINE>for (String exprDecl : deployment.getPathExprDecls()) {<NEW_LINE>checkDependency(services.getExprDeclaredPathRegistry(), exprDecl, moduleName);<NEW_LINE>}<NEW_LINE>for (NameAndParamNum script : deployment.getPathScripts()) {<NEW_LINE>checkDependency(services.getScriptPathRegistry(), script, moduleName);<NEW_LINE>}<NEW_LINE>for (ModuleIndexMeta index : deployment.getPathIndexes()) {<NEW_LINE>if (index.isNamedWindow()) {<NEW_LINE>NamedWindowMetaData namedWindow = services.getNamedWindowPathRegistry().getWithModule(index.getInfraName(<MASK><NEW_LINE>validateIndexPrecondition(namedWindow.getIndexMetadata(), index, deploymentId);<NEW_LINE>} else {<NEW_LINE>TableMetaData table = services.getTablePathRegistry().getWithModule(index.getInfraName(), index.getInfraModuleName());<NEW_LINE>validateIndexPrecondition(table.getIndexMetadata(), index, deploymentId);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (String classProvided : deployment.getPathClassProvideds()) {<NEW_LINE>checkDependency(services.getClassProvidedPathRegistry(), classProvided, moduleName);<NEW_LINE>}<NEW_LINE>} | ), index.getInfraModuleName()); |
1,793,418 | private void saveButtonPressed() {<NEW_LINE>// IProfileStore store = formatterFactory.getProfileStore();<NEW_LINE>IProfileStore store = ProfileManager.getInstance().getProfileStore();<NEW_LINE>IProfile selected = manager.create(dialogOwner.getProject(), ProfileKind.TEMPORARY, fProfileNameField.getText(), getPreferences(<MASK><NEW_LINE>final FileDialog dialog = new FileDialog(getShell(), SWT.SAVE);<NEW_LINE>dialog.setText(FormatterMessages.FormatterModifyDialog_exportProfile);<NEW_LINE>// $NON-NLS-1$<NEW_LINE>dialog.setFilterExtensions(new String[] { "*.xml" });<NEW_LINE>final String path = dialog.open();<NEW_LINE>if (path == null)<NEW_LINE>return;<NEW_LINE>final File file = new File(path);<NEW_LINE>String message = NLS.bind(FormatterMessages.FormatterModifyDialog_replaceFileQuestion, file.getAbsolutePath());<NEW_LINE>if (file.exists() && !MessageDialog.openQuestion(getShell(), FormatterMessages.FormatterModifyDialog_exportProfile, message)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final Collection<IProfile> profiles = new ArrayList<IProfile>();<NEW_LINE>profiles.add(selected);<NEW_LINE>try {<NEW_LINE>// TODO - WRITE ALL PROFILES<NEW_LINE>store.writeProfilesToFile(profiles, file);<NEW_LINE>} catch (CoreException e) {<NEW_LINE>final String title = FormatterMessages.FormatterModifyDialog_exportProfile;<NEW_LINE>message = FormatterMessages.FormatterModifyDialog_exportProblem;<NEW_LINE>ExceptionHandler.handle(e, getShell(), title, message);<NEW_LINE>}<NEW_LINE>} | ), profile.getVersion()); |
167,842 | protected byte[] createKeyWithService(UUID universeUUID, UUID configUUID, EncryptionAtRestConfig config) {<NEW_LINE>final String algorithm = "AES";<NEW_LINE>final int keySize = 256;<NEW_LINE>final ObjectNode validateResult = validateEncryptionKeyParams(algorithm, keySize);<NEW_LINE>if (!validateResult.get("result").asBoolean()) {<NEW_LINE>final String errMsg = String.format("Invalid encryption key parameters detected for create operation in " + "universe %s: %s", universeUUID, validateResult.get("errors").asText());<NEW_LINE>LOG.error(errMsg);<NEW_LINE>throw new IllegalArgumentException(errMsg);<NEW_LINE>}<NEW_LINE>final String endpoint = "/crypto/v1/keys";<NEW_LINE>final ArrayNode keyOps = Json.newArray().add("EXPORT").add("APPMANAGEABLE");<NEW_LINE>ObjectNode payload = Json.newObject().put("name", universeUUID.toString()).put("obj_type", algorithm<MASK><NEW_LINE>payload.set("key_ops", keyOps);<NEW_LINE>final ObjectNode authConfig = getAuthConfig(configUUID);<NEW_LINE>final String sessionToken = retrieveSessionAuthorization(authConfig);<NEW_LINE>final Map<String, String> headers = ImmutableMap.of("Authorization", sessionToken, "Content-Type", "application/json");<NEW_LINE>final String baseUrl = authConfig.get("base_url").asText();<NEW_LINE>final String url = Util.buildURL(baseUrl, endpoint);<NEW_LINE>final JsonNode response = this.apiHelper.postRequest(url, payload, headers);<NEW_LINE>final JsonNode errors = response.get("error");<NEW_LINE>if (errors != null)<NEW_LINE>throw new RuntimeException(errors.toString());<NEW_LINE>final String kId = response.get("kid").asText();<NEW_LINE>return kId.getBytes();<NEW_LINE>} | ).put("key_size", keySize); |
1,035,711 | public TargetReservationValue unmarshall(StaxUnmarshallerContext context) throws Exception {<NEW_LINE>TargetReservationValue targetReservationValue = new TargetReservationValue();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>if (context.isStartOfDocument())<NEW_LINE>targetDepth += 1;<NEW_LINE>while (true) {<NEW_LINE>XMLEvent xmlEvent = context.nextEvent();<NEW_LINE>if (xmlEvent.isEndDocument())<NEW_LINE>return targetReservationValue;<NEW_LINE>if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {<NEW_LINE>if (context.testExpression("reservationValue", targetDepth)) {<NEW_LINE>targetReservationValue.setReservationValue(ReservationValueStaxUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (context.testExpression("targetConfiguration", targetDepth)) {<NEW_LINE>targetReservationValue.setTargetConfiguration(TargetConfigurationStaxUnmarshaller.getInstance<MASK><NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>} else if (xmlEvent.isEndElement()) {<NEW_LINE>if (context.getCurrentDepth() < originalDepth) {<NEW_LINE>return targetReservationValue;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ().unmarshall(context)); |
303,982 | private static void writeCommandConfigJson(JsonGenerator json, HystrixCommandKey key, HystrixCommandConfiguration commandConfig) throws IOException {<NEW_LINE>json.writeObjectFieldStart(key.name());<NEW_LINE>json.writeStringField("threadPoolKey", commandConfig.getThreadPoolKey().name());<NEW_LINE>json.writeStringField("groupKey", commandConfig.getGroupKey().name());<NEW_LINE>json.writeObjectFieldStart("execution");<NEW_LINE>HystrixCommandConfiguration.HystrixCommandExecutionConfig executionConfig = commandConfig.getExecutionConfig();<NEW_LINE>json.writeStringField("isolationStrategy", executionConfig.<MASK><NEW_LINE>json.writeStringField("threadPoolKeyOverride", executionConfig.getThreadPoolKeyOverride());<NEW_LINE>json.writeBooleanField("requestCacheEnabled", executionConfig.isRequestCacheEnabled());<NEW_LINE>json.writeBooleanField("requestLogEnabled", executionConfig.isRequestLogEnabled());<NEW_LINE>json.writeBooleanField("timeoutEnabled", executionConfig.isTimeoutEnabled());<NEW_LINE>json.writeBooleanField("fallbackEnabled", executionConfig.isFallbackEnabled());<NEW_LINE>json.writeNumberField("timeoutInMilliseconds", executionConfig.getTimeoutInMilliseconds());<NEW_LINE>json.writeNumberField("semaphoreSize", executionConfig.getSemaphoreMaxConcurrentRequests());<NEW_LINE>json.writeNumberField("fallbackSemaphoreSize", executionConfig.getFallbackMaxConcurrentRequest());<NEW_LINE>json.writeBooleanField("threadInterruptOnTimeout", executionConfig.isThreadInterruptOnTimeout());<NEW_LINE>json.writeEndObject();<NEW_LINE>json.writeObjectFieldStart("metrics");<NEW_LINE>HystrixCommandConfiguration.HystrixCommandMetricsConfig metricsConfig = commandConfig.getMetricsConfig();<NEW_LINE>json.writeNumberField("healthBucketSizeInMs", metricsConfig.getHealthIntervalInMilliseconds());<NEW_LINE>json.writeNumberField("percentileBucketSizeInMilliseconds", metricsConfig.getRollingPercentileBucketSizeInMilliseconds());<NEW_LINE>json.writeNumberField("percentileBucketCount", metricsConfig.getRollingCounterNumberOfBuckets());<NEW_LINE>json.writeBooleanField("percentileEnabled", metricsConfig.isRollingPercentileEnabled());<NEW_LINE>json.writeNumberField("counterBucketSizeInMilliseconds", metricsConfig.getRollingCounterBucketSizeInMilliseconds());<NEW_LINE>json.writeNumberField("counterBucketCount", metricsConfig.getRollingCounterNumberOfBuckets());<NEW_LINE>json.writeEndObject();<NEW_LINE>json.writeObjectFieldStart("circuitBreaker");<NEW_LINE>HystrixCommandConfiguration.HystrixCommandCircuitBreakerConfig circuitBreakerConfig = commandConfig.getCircuitBreakerConfig();<NEW_LINE>json.writeBooleanField("enabled", circuitBreakerConfig.isEnabled());<NEW_LINE>json.writeBooleanField("isForcedOpen", circuitBreakerConfig.isForceOpen());<NEW_LINE>json.writeBooleanField("isForcedClosed", circuitBreakerConfig.isForceOpen());<NEW_LINE>json.writeNumberField("requestVolumeThreshold", circuitBreakerConfig.getRequestVolumeThreshold());<NEW_LINE>json.writeNumberField("errorPercentageThreshold", circuitBreakerConfig.getErrorThresholdPercentage());<NEW_LINE>json.writeNumberField("sleepInMilliseconds", circuitBreakerConfig.getSleepWindowInMilliseconds());<NEW_LINE>json.writeEndObject();<NEW_LINE>json.writeEndObject();<NEW_LINE>} | getIsolationStrategy().name()); |
1,084,216 | private String commitToGitLab(String repositoryUrl, String content, String commitMessage, boolean create) throws SourceConnectorException {<NEW_LINE>try (CloseableHttpClient httpClient = HttpClients.createDefault()) {<NEW_LINE>GitLabResource resource = resolver.resolve(repositoryUrl);<NEW_LINE>String contentUrl = this.endpoint("/api/v4/projects/:id/repository/commits").bind("id", toEncodedId(resource)).toString();<NEW_LINE>HttpPost post = new HttpPost(contentUrl);<NEW_LINE>post.addHeader("Content-Type", "application/json");<NEW_LINE>addSecurity(post);<NEW_LINE>GitLabCreateFileRequest body = new GitLabCreateFileRequest();<NEW_LINE>body.setBranch(resource.getBranch());<NEW_LINE>body.setCommitMessage(commitMessage);<NEW_LINE>body.setActions(new ArrayList<>());<NEW_LINE>GitLabAction action = new GitLabAction();<NEW_LINE>String b64Content = Base64.encodeBase64String(content.getBytes(StandardCharsets.UTF_8));<NEW_LINE>action.setGitLabAction(GitLabActionType.UPDATE);<NEW_LINE>if (create) {<NEW_LINE>action.setGitLabAction(GitLabActionType.CREATE);<NEW_LINE>}<NEW_LINE>action.setFilePath(resource.getResourcePath());<NEW_LINE>action.setContent(b64Content);<NEW_LINE>action.setEncoding("base64");<NEW_LINE>body.<MASK><NEW_LINE>// Set the POST body<NEW_LINE>post.setEntity(new StringEntity(mapper.writeValueAsString(body), StandardCharsets.UTF_8));<NEW_LINE>try (CloseableHttpResponse response = httpClient.execute(post)) {<NEW_LINE>if (response.getStatusLine().getStatusCode() != 201) {<NEW_LINE>throw new SourceConnectorException("Unexpected response from GitLab: " + response.getStatusLine().toString());<NEW_LINE>}<NEW_LINE>try (InputStream contentStream = response.getEntity().getContent()) {<NEW_LINE>JsonNode node = mapper.readTree(contentStream);<NEW_LINE>return node.get("id").asText();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new SourceConnectorException("Error creating GitLab resource content.", e);<NEW_LINE>}<NEW_LINE>} | getActions().add(action); |
1,631,349 | public void marshall(EndpointProperties endpointProperties, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (endpointProperties == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(endpointProperties.getEndpointArn(), ENDPOINTARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(endpointProperties.getStatus(), STATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(endpointProperties.getMessage(), MESSAGE_BINDING);<NEW_LINE>protocolMarshaller.marshall(endpointProperties.getModelArn(), MODELARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(endpointProperties.getDesiredModelArn(), DESIREDMODELARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(endpointProperties.getDesiredInferenceUnits(), DESIREDINFERENCEUNITS_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(endpointProperties.getCreationTime(), CREATIONTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(endpointProperties.getLastModifiedTime(), LASTMODIFIEDTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(endpointProperties.getDataAccessRoleArn(), DATAACCESSROLEARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(endpointProperties.getDesiredDataAccessRoleArn(), DESIREDDATAACCESSROLEARN_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | endpointProperties.getCurrentInferenceUnits(), CURRENTINFERENCEUNITS_BINDING); |
598,792 | public static void main(String[] args) {<NEW_LINE>Exercise38_Sensitivity sensitivity = new Exercise38_Sensitivity();<NEW_LINE>EdgeWeightedDigraph edgeWeightedDigraph1 = new EdgeWeightedDigraph(6);<NEW_LINE>edgeWeightedDigraph1.addEdge(new DirectedEdge<MASK><NEW_LINE>edgeWeightedDigraph1.addEdge(new DirectedEdge(1, 2, 1));<NEW_LINE>edgeWeightedDigraph1.addEdge(new DirectedEdge(2, 3, 1));<NEW_LINE>edgeWeightedDigraph1.addEdge(new DirectedEdge(3, 4, 1));<NEW_LINE>edgeWeightedDigraph1.addEdge(new DirectedEdge(5, 0, 3));<NEW_LINE>edgeWeightedDigraph1.addEdge(new DirectedEdge(1, 0, 2));<NEW_LINE>edgeWeightedDigraph1.addEdge(new DirectedEdge(1, 3, 2));<NEW_LINE>edgeWeightedDigraph1.addEdge(new DirectedEdge(0, 2, 3));<NEW_LINE>edgeWeightedDigraph1.addEdge(new DirectedEdge(3, 4, 3));<NEW_LINE>boolean[][] sensitivity1 = sensitivity.computeSensitivity(edgeWeightedDigraph1);<NEW_LINE>StdOut.print("Upwards critical edges 1: ");<NEW_LINE>for (int i = 0; i < sensitivity1.length; i++) {<NEW_LINE>for (int j = 0; j < sensitivity1[0].length; j++) {<NEW_LINE>if (!sensitivity1[i][j]) {<NEW_LINE>StdOut.print(i + "->" + j + " ");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>StdOut.println("\nExpected: 0->1 1->0 1->2 2->3 3->4 5->0");<NEW_LINE>EdgeWeightedDigraph edgeWeightedDigraph2 = new EdgeWeightedDigraph(5);<NEW_LINE>edgeWeightedDigraph2.addEdge(new DirectedEdge(0, 1, 2));<NEW_LINE>edgeWeightedDigraph2.addEdge(new DirectedEdge(1, 2, 1));<NEW_LINE>// this is a bridge<NEW_LINE>edgeWeightedDigraph2.addEdge(new DirectedEdge(2, 3, 1));<NEW_LINE>edgeWeightedDigraph2.addEdge(new DirectedEdge(0, 4, 1));<NEW_LINE>edgeWeightedDigraph2.addEdge(new DirectedEdge(4, 1, 1));<NEW_LINE>edgeWeightedDigraph2.addEdge(new DirectedEdge(1, 2, 1));<NEW_LINE>boolean[][] sensitivity2 = sensitivity.computeSensitivity(edgeWeightedDigraph2);<NEW_LINE>StdOut.print("\nUpwards critical edges 2: ");<NEW_LINE>for (int i = 0; i < sensitivity2.length; i++) {<NEW_LINE>for (int j = 0; j < sensitivity2[0].length; j++) {<NEW_LINE>if (!sensitivity2[i][j]) {<NEW_LINE>StdOut.print(i + "->" + j + " ");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>StdOut.println("\nExpected: 0->4 2->3 4->1");<NEW_LINE>} | (0, 1, 2)); |
449,066 | public void validate(Body body, List<ValidationException> exceptions) {<NEW_LINE>final SootMethod method = body.getMethod();<NEW_LINE>final <MASK><NEW_LINE>final boolean[] parameterRefs = new boolean[paramCount];<NEW_LINE>boolean hasThisLocal = false;<NEW_LINE>for (Unit u : body.getUnits()) {<NEW_LINE>if (u instanceof IdentityUnit) {<NEW_LINE>final IdentityUnit id = (IdentityUnit) u;<NEW_LINE>final Value rhs = id.getRightOp();<NEW_LINE>if (rhs instanceof ThisRef) {<NEW_LINE>hasThisLocal = true;<NEW_LINE>} else if (rhs instanceof ParameterRef) {<NEW_LINE>ParameterRef ref = (ParameterRef) rhs;<NEW_LINE>if (ref.getIndex() < 0 || ref.getIndex() >= paramCount) {<NEW_LINE>if (paramCount == 0) {<NEW_LINE>exceptions.add(new ValidationException(id, "This method has no parameters, so no parameter reference is allowed"));<NEW_LINE>} else {<NEW_LINE>exceptions.add(new ValidationException(id, String.format("Parameter reference index must be between 0 and %d (inclusive)", paramCount - 1)));<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (parameterRefs[ref.getIndex()]) {<NEW_LINE>exceptions.add(new ValidationException(id, String.format("Only one local for parameter %d is allowed", ref.getIndex())));<NEW_LINE>}<NEW_LINE>parameterRefs[ref.getIndex()] = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!method.isStatic() && !hasThisLocal) {<NEW_LINE>exceptions.add(new ValidationException(body, String.format("The method %s is not static, but does not have a this local", method.getSignature())));<NEW_LINE>}<NEW_LINE>for (int i = 0; i < paramCount; i++) {<NEW_LINE>if (!parameterRefs[i]) {<NEW_LINE>exceptions.add(new ValidationException(body, String.format("There is no parameter local for parameter number %d", i)));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | int paramCount = method.getParameterCount(); |
755,354 | void decode(Decoder decoder, Instruction instruction) {<NEW_LINE>if (decoder.invalidCheckMask != 0 && (((decoder.state_zs_flags & (StateFlags.Z | StateFlags.B)) | (decoder.state_vvvv_invalidCheck & 0xF)) != 0 || decoder.state_aaa == 0))<NEW_LINE>decoder.setInvalidInstruction();<NEW_LINE>instruction.setCode(code);<NEW_LINE>int regNum = (decoder.state_reg + decoder.state_zs_extraRegisterBase + decoder.state_extraRegisterBaseEVEX);<NEW_LINE>instruction.setOp0Register(regNum + baseReg);<NEW_LINE>if (decoder.state_mod == 3)<NEW_LINE>decoder.setInvalidInstruction();<NEW_LINE>else {<NEW_LINE><MASK><NEW_LINE>decoder.readOpMem_VSIB(instruction, vsibBase, tupleType);<NEW_LINE>if (decoder.invalidCheckMask != 0) {<NEW_LINE>if (regNum == Integer.remainderUnsigned(instruction.getMemoryIndex() - Register.XMM0, IcedConstants.VMM_COUNT))<NEW_LINE>decoder.setInvalidInstruction();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | instruction.setOp1Kind(OpKind.MEMORY); |
92,843 | private ModeEntry process(final boolean add, final char mode) {<NEW_LINE>switch(mode) {<NEW_LINE>case 'O':<NEW_LINE>return new ModeEntry(add, Mode.OWNER, this.<MASK><NEW_LINE>case 'o':<NEW_LINE>return new ModeEntry(add, Mode.OPERATOR, this.params[this.index++]);<NEW_LINE>case 'v':<NEW_LINE>return new ModeEntry(add, Mode.VOICE, this.params[this.index++]);<NEW_LINE>case 'l':<NEW_LINE>String[] limitparams;<NEW_LINE>if (add) {<NEW_LINE>limitparams = new String[] { this.params[this.index++] };<NEW_LINE>} else {<NEW_LINE>limitparams = new String[] {};<NEW_LINE>}<NEW_LINE>return new ModeEntry(add, Mode.LIMIT, limitparams);<NEW_LINE>case 'p':<NEW_LINE>return new ModeEntry(add, Mode.PRIVATE);<NEW_LINE>case 's':<NEW_LINE>return new ModeEntry(add, Mode.SECRET);<NEW_LINE>case 'i':<NEW_LINE>return new ModeEntry(add, Mode.INVITE);<NEW_LINE>case 'b':<NEW_LINE>return new ModeEntry(add, Mode.BAN, this.params[this.index++]);<NEW_LINE>default:<NEW_LINE>return new ModeEntry(add, Mode.UNKNOWN, "" + mode);<NEW_LINE>}<NEW_LINE>} | params[this.index++]); |
1,266,536 | private static Map<String, String> createDefaultCheckerSetMap() {<NEW_LINE>Map<String, String> folderMap = new HashMap<>();<NEW_LINE>folderMap.put(Tool.COVERITY.name(), "codecc_default_rules_" + Tool.COVERITY.name().toLowerCase());<NEW_LINE>folderMap.put(Tool.KLOCWORK.name(), "codecc_default_rules_" + Tool.KLOCWORK.name().toLowerCase());<NEW_LINE>folderMap.put(Tool.PINPOINT.name(), "codecc_default_rules_" + Tool.PINPOINT.<MASK><NEW_LINE>folderMap.put(Tool.CPPLINT.name(), "codecc_default_rules_" + Tool.CPPLINT.name().toLowerCase());<NEW_LINE>folderMap.put(Tool.CHECKSTYLE.name(), "codecc_default_rules_" + Tool.CHECKSTYLE.name().toLowerCase());<NEW_LINE>folderMap.put(Tool.STYLECOP.name(), "codecc_default_rules_" + Tool.STYLECOP.name().toLowerCase());<NEW_LINE>folderMap.put(Tool.GOML.name(), "codecc_default_rules_" + Tool.GOML.name().toLowerCase());<NEW_LINE>folderMap.put(Tool.DETEKT.name(), "codecc_default_rules_" + Tool.DETEKT.name().toLowerCase());<NEW_LINE>folderMap.put(Tool.PYLINT.name(), "codecc_default_rules_" + Tool.PYLINT.name().toLowerCase());<NEW_LINE>folderMap.put(Tool.OCCHECK.name(), "codecc_default_rules_" + Tool.OCCHECK.name().toLowerCase());<NEW_LINE>folderMap.put(ComConstants.PHPCSStandardCode.PSR2.name(), "codecc_default_psr2_rules");<NEW_LINE>folderMap.put(ComConstants.PHPCSStandardCode.PSR12.name(), "codecc_default_psr12_rules");<NEW_LINE>folderMap.put(ComConstants.PHPCSStandardCode.PSR1.name(), "codecc_default_psr1_rules");<NEW_LINE>folderMap.put(ComConstants.PHPCSStandardCode.PEAR.name(), "codecc_default_pear_rules");<NEW_LINE>folderMap.put(ComConstants.PHPCSStandardCode.Zend.name(), "codecc_default_zend_rules");<NEW_LINE>folderMap.put(ComConstants.PHPCSStandardCode.Squiz.name(), "codecc_default_squiz_rules");<NEW_LINE>folderMap.put(ComConstants.PHPCSStandardCode.MySource.name(), "codecc_default_mysource_rules");<NEW_LINE>folderMap.put(ComConstants.PHPCSStandardCode.Generic.name(), "codecc_default_generic_rules");<NEW_LINE>folderMap.put(ComConstants.EslintFrameworkType.react.name(), "codecc_default_react_rules");<NEW_LINE>folderMap.put(ComConstants.EslintFrameworkType.vue.name(), "codecc_default_vue_rules");<NEW_LINE>folderMap.put(ComConstants.EslintFrameworkType.standard.name(), "codecc_default_standard_rules");<NEW_LINE>folderMap.put(Tool.SENSITIVE.name(), "codecc_default_rules_" + Tool.SENSITIVE.name().toLowerCase());<NEW_LINE>folderMap.put(Tool.HORUSPY.name(), "codecc_v2_default_" + Tool.HORUSPY.name().toLowerCase());<NEW_LINE>folderMap.put(Tool.WOODPECKER_SENSITIVE.name(), "codecc_v2_default_" + Tool.WOODPECKER_SENSITIVE.name().toLowerCase());<NEW_LINE>folderMap.put(Tool.RIPS.name(), "codecc_v2_default_" + Tool.RIPS.name().toLowerCase());<NEW_LINE>return folderMap;<NEW_LINE>} | name().toLowerCase()); |
99,826 | private void determineMainSize(@FlexDirection int flexDirection, int widthMeasureSpec, int heightMeasureSpec) {<NEW_LINE>int mainSize;<NEW_LINE>int paddingAlongMainAxis;<NEW_LINE>switch(flexDirection) {<NEW_LINE>// Intentional fall through<NEW_LINE>case FLEX_DIRECTION_ROW:<NEW_LINE>case FLEX_DIRECTION_ROW_REVERSE:<NEW_LINE>int widthMode = MeasureSpec.getMode(widthMeasureSpec);<NEW_LINE>int widthSize = MeasureSpec.getSize(widthMeasureSpec);<NEW_LINE>if (widthMode == MeasureSpec.EXACTLY) {<NEW_LINE>mainSize = widthSize;<NEW_LINE>} else {<NEW_LINE>mainSize = getLargestMainSize();<NEW_LINE>}<NEW_LINE>paddingAlongMainAxis <MASK><NEW_LINE>break;<NEW_LINE>// Intentional fall through<NEW_LINE>case FLEX_DIRECTION_COLUMN:<NEW_LINE>case FLEX_DIRECTION_COLUMN_REVERSE:<NEW_LINE>int heightMode = MeasureSpec.getMode(heightMeasureSpec);<NEW_LINE>int heightSize = MeasureSpec.getSize(heightMeasureSpec);<NEW_LINE>if (heightMode == MeasureSpec.EXACTLY) {<NEW_LINE>mainSize = heightSize;<NEW_LINE>} else {<NEW_LINE>mainSize = getLargestMainSize();<NEW_LINE>}<NEW_LINE>paddingAlongMainAxis = getPaddingTop() + getPaddingBottom();<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new IllegalArgumentException("Invalid flex direction: " + flexDirection);<NEW_LINE>}<NEW_LINE>int childIndex = 0;<NEW_LINE>for (FlexLine flexLine : mFlexLines) {<NEW_LINE>if (flexLine.mMainSize < mainSize) {<NEW_LINE>childIndex = expandFlexItems(flexLine, flexDirection, mainSize, paddingAlongMainAxis, childIndex);<NEW_LINE>} else {<NEW_LINE>childIndex = shrinkFlexItems(flexLine, flexDirection, mainSize, paddingAlongMainAxis, childIndex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | = getPaddingLeft() + getPaddingRight(); |
408,737 | private void insideTypeParameter(Env env) throws IOException {<NEW_LINE>int offset = env.getOffset();<NEW_LINE>TreePath path = env.getPath();<NEW_LINE>TypeParameterTree tp = (TypeParameterTree) path.getLeaf();<NEW_LINE>CompilationController controller = env.getController();<NEW_LINE>TokenSequence<JavaTokenId> ts = findLastNonWhitespaceToken(env, tp, offset);<NEW_LINE>if (ts != null) {<NEW_LINE>switch(ts.token().id()) {<NEW_LINE>case EXTENDS:<NEW_LINE>controller.toPhase(Phase.ELEMENTS_RESOLVED);<NEW_LINE>addTypes(env, EnumSet.of(CLASS, INTERFACE, ANNOTATION_TYPE), null);<NEW_LINE>break;<NEW_LINE>case AMP:<NEW_LINE>controller.toPhase(Phase.ELEMENTS_RESOLVED);<NEW_LINE>addTypes(env, EnumSet.of(INTERFACE, ANNOTATION_TYPE), null);<NEW_LINE>break;<NEW_LINE>case IDENTIFIER:<NEW_LINE>if (ts.offset() == env.getSourcePositions().getStartPosition(env.getRoot(), tp)) {<NEW_LINE>addKeyword(<MASK><NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | env, EXTENDS_KEYWORD, SPACE, false); |
496,552 | private I_C_OrderLine createOrderLine(final PurchaseCandidate candidate) {<NEW_LINE>final int flatrateDataEntryId = candidate.getC_Flatrate_DataEntry_ID();<NEW_LINE>final int huPIItemProductId = candidate.getM_HU_PI_Item_Product_ID();<NEW_LINE>final Timestamp datePromised = candidate.getDatePromised();<NEW_LINE>final BigDecimal price = candidate.getPrice();<NEW_LINE>final I_C_OrderLine orderLine = orderLineBL.createOrderLine(order, I_C_OrderLine.class);<NEW_LINE>orderLine.setIsMFProcurement(true);<NEW_LINE>//<NEW_LINE>// BPartner/Location/Contact<NEW_LINE>OrderLineDocumentLocationAdapterFactory.locationAdapter(orderLine).setFromOrderHeader(order);<NEW_LINE>//<NEW_LINE>// PMM Contract<NEW_LINE>if (flatrateDataEntryId > 0) {<NEW_LINE>orderLine.setC_Flatrate_DataEntry_ID(flatrateDataEntryId);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// Product/UOM/Handling unit<NEW_LINE>orderLine.setM_Product_ID(candidate.getM_Product_ID());<NEW_LINE>orderLine.setC_UOM_ID(candidate.getC_UOM_ID());<NEW_LINE>if (huPIItemProductId > 0) {<NEW_LINE>orderLine.setM_HU_PI_Item_Product_ID(huPIItemProductId);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>// ASI<NEW_LINE>final <MASK><NEW_LINE>final I_M_AttributeSetInstance contractASI = attributeSetInstanceId.isRegular() ? Services.get(IAttributeDAO.class).getAttributeSetInstanceById(attributeSetInstanceId) : null;<NEW_LINE>final I_M_AttributeSetInstance asi;<NEW_LINE>if (contractASI != null) {<NEW_LINE>asi = Services.get(IAttributeDAO.class).copy(contractASI);<NEW_LINE>} else {<NEW_LINE>asi = null;<NEW_LINE>}<NEW_LINE>orderLine.setPMM_Contract_ASI(contractASI);<NEW_LINE>orderLine.setM_AttributeSetInstance(asi);<NEW_LINE>//<NEW_LINE>// Quantities<NEW_LINE>orderLine.setQtyEntered(BigDecimal.ZERO);<NEW_LINE>orderLine.setQtyOrdered(BigDecimal.ZERO);<NEW_LINE>//<NEW_LINE>// Dates<NEW_LINE>orderLine.setDatePromised(datePromised);<NEW_LINE>//<NEW_LINE>// Pricing<NEW_LINE>// go with the candidate's price. e.g. don't reset it to 0 because we have no PL<NEW_LINE>orderLine.setIsManualPrice(true);<NEW_LINE>orderLine.setPriceEntered(price);<NEW_LINE>orderLine.setPriceActual(price);<NEW_LINE>//<NEW_LINE>// BPartner/Location/Contact<NEW_LINE>return orderLine;<NEW_LINE>} | AttributeSetInstanceId attributeSetInstanceId = candidate.getAttributeSetInstanceId(); |
826,178 | public IRubyObject op_div(ThreadContext context, IRubyObject other) {<NEW_LINE>if (other instanceof RubyInteger) {<NEW_LINE>return op_div(context, (RubyInteger) other);<NEW_LINE>}<NEW_LINE>if (other instanceof RubyFloat) {<NEW_LINE>IRubyObject fval = r_to_f(context, this);<NEW_LINE>// fval / other<NEW_LINE>return context.sites.Float.op_quo.call(<MASK><NEW_LINE>}<NEW_LINE>if (other instanceof RubyRational) {<NEW_LINE>if (((RubyRational) other).isZero()) {<NEW_LINE>throw context.runtime.newZeroDivisionError();<NEW_LINE>}<NEW_LINE>RubyRational otherRational = (RubyRational) other;<NEW_LINE>return f_muldiv(context, getMetaClass(), num, den, otherRational.num, otherRational.den, false);<NEW_LINE>}<NEW_LINE>return coerceBin(context, sites(context).op_quo, other);<NEW_LINE>} | context, fval, fval, other); |
845,107 | private void select() {<NEW_LINE>try {<NEW_LINE>// wait for io events.<NEW_LINE>selector.select(TNonblockingServer.selectWaitTime_);<NEW_LINE>// process the io events we received<NEW_LINE>Iterator<SelectionKey> selectedKeys = selector.selectedKeys().iterator();<NEW_LINE>while (!stopped_ && selectedKeys.hasNext()) {<NEW_LINE>SelectionKey key = selectedKeys.next();<NEW_LINE>selectedKeys.remove();<NEW_LINE>// skip if not valid<NEW_LINE>if (!key.isValid()) {<NEW_LINE>cleanupSelectionkey(key);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// if the key is marked Accept, then it has to be the server<NEW_LINE>// transport.<NEW_LINE>if (key.isAcceptable()) {<NEW_LINE>handleAccept();<NEW_LINE>} else if (key.isReadable()) {<NEW_LINE>// deal with reads<NEW_LINE>key.interestOps(0);<NEW_LINE>TcpHandler readHandler = new TcpReader(key);<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>} catch (ServerOverloadedException e) {<NEW_LINE>cleanupSelectionkey(key);<NEW_LINE>}<NEW_LINE>} else if (key.isWritable()) {<NEW_LINE>// deal with writes<NEW_LINE>key.interestOps(0);<NEW_LINE>TcpHandler writeHandler = new TcpWriter(key);<NEW_LINE>try {<NEW_LINE>TNonblockingServer.this.submitTask(writeHandler);<NEW_LINE>} catch (ServerOverloadedException e) {<NEW_LINE>cleanupSelectionkey(key);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>LOGGER.warn("Unexpected state in select! " + key.interestOps());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>LOGGER.warn("Got an IOException while selecting!", e);<NEW_LINE>}<NEW_LINE>} | TNonblockingServer.this.submitTask(readHandler); |
1,130,229 | private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents<NEW_LINE>void initComponents() {<NEW_LINE>buttonGroup1 = new javax.swing.ButtonGroup();<NEW_LINE>descriptionLabel = <MASK><NEW_LINE>issuePanel = new javax.swing.JPanel();<NEW_LINE>descriptionLabel.setLabelFor(descriptionTextField);<NEW_LINE>// NOI18N<NEW_LINE>org.openide.awt.Mnemonics.setLocalizedText(descriptionLabel, org.openide.util.NbBundle.getMessage(AttachPanel.class, "AttachPanel.descriptionLabel.text"));<NEW_LINE>descriptionTextField.setColumns(30);<NEW_LINE>// NOI18N<NEW_LINE>descriptionTextField.setText(org.openide.util.NbBundle.getMessage(AttachPanel.class, "AttachPanel.descriptionTextField.text"));<NEW_LINE>issuePanel.setLayout(new java.awt.BorderLayout());<NEW_LINE>javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);<NEW_LINE>this.setLayout(layout);<NEW_LINE>layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(descriptionLabel).addGap(36, 36, 36).addComponent(descriptionTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 458, Short.MAX_VALUE)).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(issuePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addContainerGap()));<NEW_LINE>layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(issuePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(descriptionTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(descriptionLabel))));<NEW_LINE>// NOI18N<NEW_LINE>descriptionTextField.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(AttachPanel.class, "AttachPanel.descriptionTextField.AccessibleContext.accessibleDescription"));<NEW_LINE>} | new javax.swing.JLabel(); |
85,352 | Object aroundInvoke(InvocationContext invCtx) throws Exception {<NEW_LINE>CheckInvocation.getInstance().recordCallInfo("AroundInvoke", "Interceptor03.aroundInvoke", this);<NEW_LINE>svLogger.info("Interceptor03.aroundInvoke: this=" + this);<NEW_LINE>for (Iterator<Entry<String, Object>> it = invCtx.getContextData().entrySet().iterator(); it.hasNext(); ) {<NEW_LINE>Entry<String, Object> entry = it.next();<NEW_LINE>svLogger.info("Interceptor03.aroundInvoke: ctxData.key=" + entry.getKey() + "; ctxData.value=" + (<MASK><NEW_LINE>CheckInvocation.getInstance().recordCallInfo(entry.getKey(), (String) entry.getValue(), this);<NEW_LINE>}<NEW_LINE>String targetStr = invCtx.getTarget().toString();<NEW_LINE>String methodStr = invCtx.getMethod().toString();<NEW_LINE>String parameterStr = Arrays.toString(invCtx.getParameters());<NEW_LINE>svLogger.info("Interceptor03.aroundInvoke: getTarget=" + targetStr);<NEW_LINE>svLogger.info("Interceptor03.aroundInvoke: getMethod=" + methodStr);<NEW_LINE>svLogger.info("Interceptor03.aroundInvoke: getParameters=" + parameterStr);<NEW_LINE>CheckInvocation.getInstance().recordCallInfo("Target", invCtx.getTarget().toString(), this);<NEW_LINE>CheckInvocation.getInstance().recordCallInfo("Method", invCtx.getMethod().toString(), this);<NEW_LINE>CheckInvocation.getInstance().recordCallInfo("Parameters", Arrays.toString(invCtx.getParameters()), this);<NEW_LINE>return invCtx.proceed();<NEW_LINE>} | String) entry.getValue()); |
340,012 | public void reuse(Tag handler) {<NEW_LINE>PerThreadData ptd = (PerThreadData) perThread.get();<NEW_LINE>if (ptd == null) {<NEW_LINE>ptd = new PerThreadData();<NEW_LINE>ptd.handlers = new Tag[initialSize];<NEW_LINE>ptd.current = 0;<NEW_LINE>threadData.put(ptd, ptd);<NEW_LINE>}<NEW_LINE>if (ptd.current < (ptd.handlers.length - 1)) {<NEW_LINE>ptd.handlers<MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// no more space<NEW_LINE>if (ptd.handlers.length < maxSize) {<NEW_LINE>// reallocate<NEW_LINE>Tag[] newH = new Tag[ptd.handlers.length + initialSize];<NEW_LINE>System.arraycopy(ptd.handlers, 0, newH, 0, ptd.handlers.length);<NEW_LINE>ptd.handlers = newH;<NEW_LINE>ptd.handlers[++ptd.current] = handler;<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// else<NEW_LINE>handler.release();<NEW_LINE>} | [++ptd.current] = handler; |
1,402,215 | final GetGroupPolicyResult executeGetGroupPolicy(GetGroupPolicyRequest getGroupPolicyRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getGroupPolicyRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetGroupPolicyRequest> request = null;<NEW_LINE>Response<GetGroupPolicyResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetGroupPolicyRequestMarshaller().marshall(super.beforeMarshalling(getGroupPolicyRequest));<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, "IAM");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetGroupPolicy");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>StaxResponseHandler<GetGroupPolicyResult> responseHandler = new StaxResponseHandler<GetGroupPolicyResult>(new GetGroupPolicyResultStaxUnmarshaller());<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.endEvent(Field.RequestMarshallTime); |
1,039,039 | protected void onSizeChanged(int w, int h, int oldw, int oldh) {<NEW_LINE>super.onSizeChanged(w, h, oldw, oldh);<NEW_LINE>try {<NEW_LINE>rect = new Rect(innerPadding, innerPadding, w - innerPadding, h - innerPadding);<NEW_LINE>bitmap = Bitmap.createBitmap(w - 2 * innerPadding, h - 2 * innerPadding, Config.ARGB_8888);<NEW_LINE>fullCircleRadius = Math.min(rect.width(), rect.height()) / 2;<NEW_LINE>innerCircleRadius = fullCircleRadius * (1 - FADE_OUT_FRACTION);<NEW_LINE>scaledWidth = rect.width() / scale;<NEW_LINE>scaledHeight <MASK><NEW_LINE>scaledFullCircleRadius = Math.min(scaledWidth, scaledHeight) / 2;<NEW_LINE>scaledInnerCircleRadius = scaledFullCircleRadius * (1 - FADE_OUT_FRACTION);<NEW_LINE>scaledFadeOutSize = scaledFullCircleRadius - scaledInnerCircleRadius;<NEW_LINE>scaledPixels = new int[scaledWidth * scaledHeight];<NEW_LINE>pixels = new int[rect.width() * rect.height()];<NEW_LINE>createBitmap();<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.e(e);<NEW_LINE>}<NEW_LINE>} | = rect.height() / scale; |
872,964 | private void handleMappingExceptions() {<NEW_LINE>if (singleValueIsAllowed) {<NEW_LINE>org.<MASK><NEW_LINE>if (arg instanceof org.python.types.Range) {<NEW_LINE>throw new org.python.exceptions.TypeError("range indices must be integers or slices, not str");<NEW_LINE>} else if (arg instanceof org.python.types.Bytes) {<NEW_LINE>throw new org.python.exceptions.TypeError("byte indices must be integers, not str");<NEW_LINE>} else if (arg instanceof org.python.types.ByteArray) {<NEW_LINE>throw new org.python.exceptions.TypeError(arg.typeName() + " indices must be integers");<NEW_LINE>} else {<NEW_LINE>throw new org.python.exceptions.TypeError(arg.typeName() + " indices must be integers, not str");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (dict == null) {<NEW_LINE>throw new org.python.exceptions.TypeError("format requires a mapping");<NEW_LINE>}<NEW_LINE>} | python.Object arg = peekNextArg(); |
424,454 | private void doAddPane(@Nonnull final AbstractProjectViewPane newPane) {<NEW_LINE>ApplicationManager.getApplication().assertIsDispatchThread();<NEW_LINE>int index;<NEW_LINE>final ContentManager manager = getContentManager();<NEW_LINE>for (index = 0; index < manager.getContentCount(); index++) {<NEW_LINE>Content content = manager.getContent(index);<NEW_LINE>String id = content.getUserData(ID_KEY);<NEW_LINE>AbstractProjectViewPane pane = myId2Pane.get(id);<NEW_LINE>int comp = PANE_WEIGHT_COMPARATOR.compare(pane, newPane);<NEW_LINE>LOG.assertTrue(comp != 0, "Project view pane " + newPane + " has the same weight as " + pane + ". Please make sure that you overload getWeight() and return a distinct weight value.");<NEW_LINE>if (comp > 0) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final String id = newPane.getId();<NEW_LINE><MASK><NEW_LINE>String[] subIds = newPane.getSubIds();<NEW_LINE>subIds = subIds.length == 0 ? new String[] { null } : subIds;<NEW_LINE>boolean first = true;<NEW_LINE>for (String subId : subIds) {<NEW_LINE>final String title = subId != null ? newPane.getPresentableSubIdName(subId) : newPane.getTitle();<NEW_LINE>final Content content = getContentManager().getFactory().createContent(getComponent(), title, false);<NEW_LINE>content.setTabName(title);<NEW_LINE>content.putUserData(ID_KEY, id);<NEW_LINE>content.putUserData(SUB_ID_KEY, subId);<NEW_LINE>content.putUserData(ToolWindow.SHOW_CONTENT_ICON, Boolean.TRUE);<NEW_LINE>Image icon = subId != null ? newPane.getPresentableSubIdIcon(subId) : newPane.getIcon();<NEW_LINE>content.setIcon(icon);<NEW_LINE>content.setPopupIcon(subId != null ? AllIcons.General.Bullet : newPane.getIcon());<NEW_LINE>content.setPreferredFocusedComponent(() -> {<NEW_LINE>final AbstractProjectViewPane current = getCurrentProjectViewPane();<NEW_LINE>return current != null ? current.getComponentToFocus() : null;<NEW_LINE>});<NEW_LINE>content.setBusyObject(this);<NEW_LINE>if (first && subId != null) {<NEW_LINE>content.setSeparator(newPane.getTitle());<NEW_LINE>}<NEW_LINE>manager.addContent(content, index++);<NEW_LINE>first = false;<NEW_LINE>}<NEW_LINE>} | myId2Pane.put(id, newPane); |
698,609 | private HashMap<Integer, EnumMap<TrafficEnums.TravelDirection, Integer[]>> readRefPatterns() {<NEW_LINE>List<List<String>> rawPatternReferenceList = CSVUtility.readFile(patternsReferenceFile);<NEW_LINE>HashMap<Integer, EnumMap<TrafficEnums.TravelDirection, Integer[]>> processedPatternReferenceList = new HashMap<>();<NEW_LINE>for (List<String> rawPatternReference : rawPatternReferenceList) {<NEW_LINE>EnumMap<TrafficEnums.TravelDirection, Integer[]> patternMap = new EnumMap<>(TrafficEnums.TravelDirection.class);<NEW_LINE>Integer linkId = Integer.parseInt(rawPatternReference.get(0));<NEW_LINE>TrafficEnums.TravelDirection travelDirection = TrafficEnums.TravelDirection.forValue<MASK><NEW_LINE>if (travelDirection == null || rawPatternReference.size() != 9) {<NEW_LINE>// Skip this entry as its not a complete week pattern.<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Integer[] patternList = new Integer[rawPatternReference.size() - 2];<NEW_LINE>for (int i = 2; i < rawPatternReference.size(); i++) {<NEW_LINE>patternList[i - 2] = Integer.parseInt(rawPatternReference.get(i));<NEW_LINE>}<NEW_LINE>patternMap.put(travelDirection, patternList);<NEW_LINE>processedPatternReferenceList.put(linkId, patternMap);<NEW_LINE>}<NEW_LINE>return processedPatternReferenceList;<NEW_LINE>} | (rawPatternReference.get(1)); |
441,358 | private static void drawItemIndicatorLockedDark(Canvas canvas, RectF targetFrame, ResizingBehavior resizing, int indicatorLocked, int lockColor, int indicatorLockedDark, int itemIndicatorColorBackground) {<NEW_LINE>// Resize to Target Frame<NEW_LINE>canvas.save();<NEW_LINE>RectF resizedFrame = CacheForItemIndicatorLockedDark.resizedFrame;<NEW_LINE>HabiticaIcons.resizingBehaviorApply(resizing, CacheForItemIndicatorLockedDark.originalFrame, targetFrame, resizedFrame);<NEW_LINE>canvas.translate(resizedFrame.left, resizedFrame.top);<NEW_LINE>canvas.scale(resizedFrame.width() / 28f, resizedFrame.height() / 28f);<NEW_LINE>// Symbol<NEW_LINE>RectF symbolRect = CacheForItemIndicatorLockedDark.symbolRect;<NEW_LINE>symbolRect.set(<MASK><NEW_LINE>canvas.save();<NEW_LINE>canvas.clipRect(symbolRect);<NEW_LINE>canvas.translate(symbolRect.left, symbolRect.top);<NEW_LINE>RectF symbolTargetRect = CacheForItemIndicatorLockedDark.symbolTargetRect;<NEW_LINE>symbolTargetRect.set(0f, 0f, symbolRect.width(), symbolRect.height());<NEW_LINE>HabiticaIcons.drawItemIndicator(canvas, symbolTargetRect, ResizingBehavior.Stretch, indicatorLocked, lockColor, indicatorLockedDark, itemIndicatorColorBackground, true, false, true);<NEW_LINE>canvas.restore();<NEW_LINE>canvas.restore();<NEW_LINE>} | 0f, 0f, 28f, 28f); |
1,412,680 | public static void newFutureTaskTransaction(final String type, final String name, final CommandFuture<?> future) {<NEW_LINE>if (!CatConfig.isCatenabled()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>logger.debug("[newFutureTaskTransaction]{}, {}", type, name);<NEW_LINE>try {<NEW_LINE>executors.execute(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>Transaction transaction = <MASK><NEW_LINE>try {<NEW_LINE>boolean result = future.await(1, TimeUnit.HOURS);<NEW_LINE>logger.debug("[newFutureTaskTransaction][complete]{}, {}, {}, ({})", type, name, future.isSuccess(), result);<NEW_LINE>if (result && future.isSuccess()) {<NEW_LINE>transaction.setStatus(Transaction.SUCCESS);<NEW_LINE>} else {<NEW_LINE>if (!result) {<NEW_LINE>transaction.setStatus(new TimeoutException("wait for transaction timeout...[1 hour]"));<NEW_LINE>} else {<NEW_LINE>transaction.setStatus(future.cause());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Throwable th) {<NEW_LINE>logger.error("[run]" + type + "," + name, th);<NEW_LINE>transaction.setStatus(th);<NEW_LINE>} finally {<NEW_LINE>transaction.complete();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.error("[newFutureTaskTransaction]" + type + "," + name, e);<NEW_LINE>}<NEW_LINE>} | Cat.newTransaction(type, name); |
88,402 | private ExcludeSpec intersectGroup(GroupExclude left, ExcludeSpec right) {<NEW_LINE>String group = left.getGroup();<NEW_LINE>if (right instanceof GroupExclude) {<NEW_LINE>// equality has been tested before so we know groups are different<NEW_LINE>return factory.nothing();<NEW_LINE>} else if (right instanceof ModuleIdExclude) {<NEW_LINE>if (((ModuleIdExclude) right).getModuleId().getGroup().equals(group)) {<NEW_LINE>return right;<NEW_LINE>} else {<NEW_LINE>return factory.nothing();<NEW_LINE>}<NEW_LINE>} else if (right instanceof GroupSetExclude) {<NEW_LINE>if (((GroupSetExclude) right).getGroups().stream().anyMatch(g -> g.equals(group))) {<NEW_LINE>return left;<NEW_LINE>}<NEW_LINE>return factory.nothing();<NEW_LINE>} else if (right instanceof ModuleIdSetExclude) {<NEW_LINE>Set<ModuleIdentifier> moduleIds = ((ModuleIdSetExclude) right).getModuleIds().stream().filter(id -> id.getGroup().equals(group)).collect(toSet());<NEW_LINE>return moduleIdSet(moduleIds);<NEW_LINE>} else if (right instanceof ModuleExclude) {<NEW_LINE>return factory.moduleId(DefaultModuleIdentifier.newId(left.getGroup(), ((ModuleExclude) <MASK><NEW_LINE>} else if (right instanceof ModuleSetExclude) {<NEW_LINE>ModuleSetExclude moduleSet = (ModuleSetExclude) right;<NEW_LINE>return factory.moduleIdSet(moduleSet.getModules().stream().map(module -> DefaultModuleIdentifier.newId(left.getGroup(), module)).collect(toSet()));<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | right).getModule())); |
162,447 | public static void initializeFilterMap(final TSDB tsdb) throws ClassNotFoundException, NoSuchMethodException, NoSuchFieldException, IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException {<NEW_LINE>final List<TagVFilter> filter_plugins = PluginLoader.loadPlugins(TagVFilter.class);<NEW_LINE>if (filter_plugins != null) {<NEW_LINE>for (final TagVFilter filter : filter_plugins) {<NEW_LINE>// validate required fields and methods<NEW_LINE>filter.getClass().getDeclaredMethod("description");<NEW_LINE>filter.getClass().getDeclaredMethod("examples");<NEW_LINE>filter.getClass().getDeclaredField("FILTER_NAME");<NEW_LINE>final Method initialize = filter.getClass().<MASK><NEW_LINE>initialize.invoke(null, tsdb);<NEW_LINE>final Constructor<? extends TagVFilter> ctor = filter.getClass().getDeclaredConstructor(String.class, String.class);<NEW_LINE>final Pair<Class<?>, Constructor<? extends TagVFilter>> existing = tagv_filter_map.get(filter.getType());<NEW_LINE>if (existing != null) {<NEW_LINE>LOG.warn("Overloading existing filter " + existing.getClass().getCanonicalName() + " with new filter " + filter.getClass().getCanonicalName());<NEW_LINE>}<NEW_LINE>tagv_filter_map.put(filter.getType().toLowerCase(), new Pair<Class<?>, Constructor<? extends TagVFilter>>(filter.getClass(), ctor));<NEW_LINE>LOG.info("Successfully loaded TagVFilter plugin: " + filter.getClass().getCanonicalName());<NEW_LINE>}<NEW_LINE>LOG.info("Loaded " + tagv_filter_map.size() + " filters");<NEW_LINE>}<NEW_LINE>} | getDeclaredMethod("initialize", TSDB.class); |
943,301 | public void run() {<NEW_LINE>final Object rootObject = getDisplayObjectById(id);<NEW_LINE>if (rootObject == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<Object> responders = null;<NEW_LINE>java.lang.Runnable action = null;<NEW_LINE>if (rootObject instanceof NativePropertyResponder) {<NEW_LINE>NativePropertyResponder npr = (NativePropertyResponder) rootObject;<NEW_LINE>responders = npr.getNativePropertyResponder();<NEW_LINE>action = npr.getCustomPropertyAction(key, booleanValue, stringValue, integerValue, doubleValue);<NEW_LINE>}<NEW_LINE>if (responders == null) {<NEW_LINE>responders = new LinkedList<Object>();<NEW_LINE>responders.add(rootObject);<NEW_LINE>}<NEW_LINE>for (Object view : responders) {<NEW_LINE>if (action != null)<NEW_LINE>break;<NEW_LINE>switch(lt) {<NEW_LINE>case BOOLEAN:<NEW_LINE>action = GetTypedViewMethod(view, key, booleanValue);<NEW_LINE>break;<NEW_LINE>case NUMBER:<NEW_LINE>action = GetTypedViewMethod(view, key, integerValue);<NEW_LINE>if (action == null)<NEW_LINE>action = GetTypedViewMethod(view, key, (long) integerValue);<NEW_LINE>if (action == null)<NEW_LINE>action = GetTypedViewMethod(view, key, (short) integerValue);<NEW_LINE>if (action == null)<NEW_LINE>action = GetTypedViewMethod(view<MASK><NEW_LINE>if (action == null)<NEW_LINE>action = GetTypedViewMethod(view, key, (byte) integerValue);<NEW_LINE>if (action == null)<NEW_LINE>action = GetTypedViewMethod(view, key, (float) doubleValue);<NEW_LINE>if (action == null)<NEW_LINE>action = GetTypedViewMethod(view, key, doubleValue);<NEW_LINE>break;<NEW_LINE>case STRING:<NEW_LINE>action = GetTypedViewMethod(view, key, stringValue);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (action == null) {<NEW_LINE>Log.e("Corona", "Unable to setNativeProperty " + key);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>action.run();<NEW_LINE>} catch (Throwable ignore) {<NEW_LINE>ignore.printStackTrace();<NEW_LINE>}<NEW_LINE>} | , key, (char) integerValue); |
1,209,974 | public boolean readableWithWorkOrWorkCompleted(EffectivePerson effectivePerson, String workOrWorkCompleted, PromptException entityException) throws Exception {<NEW_LINE>if (effectivePerson.isManager()) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>Work work = emc.fetch(workOrWorkCompleted, Work.class, ListTools.toList(Work.job_FIELDNAME, Work.application_FIELDNAME, Work.process_FIELDNAME, Work.creatorPerson_FIELDNAME));<NEW_LINE>WorkCompleted workCompleted = null;<NEW_LINE>String job = null;<NEW_LINE>String creatorPerson = null;<NEW_LINE>String applicationId = null;<NEW_LINE>String processId = null;<NEW_LINE>if (null == work) {<NEW_LINE>workCompleted = emc.fetch(workOrWorkCompleted, WorkCompleted.class, ListTools.toList(Work.job_FIELDNAME, Work.application_FIELDNAME, Work.process_FIELDNAME, Work.creatorPerson_FIELDNAME));<NEW_LINE>if (null == workCompleted) {<NEW_LINE>List<WorkCompleted> os = emc.fetchEqual(WorkCompleted.class, ListTools.toList(WorkCompleted.job_FIELDNAME, WorkCompleted.application_FIELDNAME, WorkCompleted.process_FIELDNAME, WorkCompleted.creatorPerson_FIELDNAME), WorkCompleted.work_FIELDNAME, workOrWorkCompleted);<NEW_LINE>if (os.size() == 1) {<NEW_LINE>workCompleted = os.get(0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (null != workCompleted) {<NEW_LINE>job = workCompleted.getJob();<NEW_LINE>creatorPerson = workCompleted.getCreatorPerson();<NEW_LINE>applicationId = workCompleted.getApplication();<NEW_LINE>processId = workCompleted.getProcess();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>job = work.getJob();<NEW_LINE>creatorPerson = work.getCreatorPerson();<NEW_LINE>applicationId = work.getApplication();<NEW_LINE>processId = work.getProcess();<NEW_LINE>}<NEW_LINE>if (StringUtils.isEmpty(job)) {<NEW_LINE>if (null != entityException) {<NEW_LINE>throw entityException;<NEW_LINE>} else {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (effectivePerson.isPerson(creatorPerson)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (emc.countEqualAndEqual(Review.class, Review.person_FIELDNAME, effectivePerson.getDistinguishedName(), Review.job_FIELDNAME, job) == 0) {<NEW_LINE>if (emc.countEqualAndEqual(Task.class, Task.person_FIELDNAME, effectivePerson.getDistinguishedName(), Task.job_FIELDNAME, job) == 0) {<NEW_LINE>if (emc.countEqualAndEqual(Read.class, Read.person_FIELDNAME, effectivePerson.getDistinguishedName(), Read.job_FIELDNAME, job) == 0) {<NEW_LINE>if (emc.countEqualAndEqual(TaskCompleted.class, TaskCompleted.person_FIELDNAME, effectivePerson.getDistinguishedName(), TaskCompleted.job_FIELDNAME, job) == 0) {<NEW_LINE>if (emc.countEqualAndEqual(ReadCompleted.class, ReadCompleted.person_FIELDNAME, effectivePerson.getDistinguishedName(), ReadCompleted.job_FIELDNAME, job) == 0) {<NEW_LINE>Application application = <MASK><NEW_LINE>Process process = process().pick(processId);<NEW_LINE>if (!canManageApplicationOrProcess(effectivePerson, application, process)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | application().pick(applicationId); |
1,606,198 | private void calcWidthOfLineHeaderBoxes(Graphics2D g2, FontHandler fontHandler, Vector<String> obj, int numObjects) {<NEW_LINE>// find out the width of the column with the longest text<NEW_LINE>double maxWidth = 0;<NEW_LINE>double maxHeight = 0;<NEW_LINE>for (int i = 0; i < numObjects; i++) {<NEW_LINE>String s = obj.elementAt(i);<NEW_LINE>if (s.startsWith(FormatLabels.UNDERLINE.getValue()) && s.endsWith(FormatLabels.UNDERLINE.getValue()) && s.length() > 2) {<NEW_LINE>s = s.substring(1, s.length() - 1);<NEW_LINE>}<NEW_LINE>TextLayout layout = new TextLayout(s, fontHandler.getFont(), g2.getFontRenderContext());<NEW_LINE>maxWidth = Math.max(layout.getBounds().getWidth(), maxWidth);<NEW_LINE>maxHeight = Math.max(layout.getBounds(<MASK><NEW_LINE>}<NEW_LINE>rectWidth = (int) Math.floor(maxWidth + 1) + 2 * (int) fontHandler.getDistanceBetweenTexts() + (int) fontHandler.getFontSize();<NEW_LINE>rectHeight = (int) Math.floor(maxHeight + 1) + (int) fontHandler.getDistanceBetweenTexts() + (int) fontHandler.getFontSize();<NEW_LINE>} | ).getHeight(), maxHeight); |
981,624 | private List<HighLight> computeFirstRowHilites(int rowStart, String left, String right) {<NEW_LINE>List<HighLight> hilites = new ArrayList<HighLight>(4);<NEW_LINE>String leftRows = wordsToRows(left);<NEW_LINE>String rightRows = wordsToRows(right);<NEW_LINE>DiffProvider diffprovider = Lookup.getDefault().lookup(DiffProvider.class);<NEW_LINE>if (diffprovider == null) {<NEW_LINE>return hilites;<NEW_LINE>}<NEW_LINE>Difference[] diffs;<NEW_LINE>try {<NEW_LINE>diffs = diffprovider.computeDiff(new StringReader(leftRows), new StringReader(rightRows));<NEW_LINE>} catch (IOException e) {<NEW_LINE>return hilites;<NEW_LINE>}<NEW_LINE>// what we can hilite in first source<NEW_LINE>for (Difference diff : diffs) {<NEW_LINE>if (diff.getType() == Difference.ADD)<NEW_LINE>continue;<NEW_LINE>int start = rowOffset(leftRows, diff.getFirstStart());<NEW_LINE>int end = rowOffset(leftRows, diff.getFirstEnd() + 1);<NEW_LINE>SimpleAttributeSet attrs = new SimpleAttributeSet();<NEW_LINE>StyleConstants.setBackground(attrs, master.getColor(diff));<NEW_LINE>hilites.add(new HighLight(rowStart + start<MASK><NEW_LINE>}<NEW_LINE>return hilites;<NEW_LINE>} | , rowStart + end, attrs)); |
200,742 | private static void walkGraph(ReportNode node, StringBuilder json) {<NEW_LINE>List<ReportNode> children = node.getChildren();<NEW_LINE>if (node.getData() == null) {<NEW_LINE>// root<NEW_LINE>json.append("<ul id=\"root\">\n");<NEW_LINE>for (int n = 0; n < children.size(); n++) {<NEW_LINE>if (n > 0) {<NEW_LINE>json.append("\n");<NEW_LINE>}<NEW_LINE>walkGraph(children.get(n), json);<NEW_LINE>}<NEW_LINE>json.append("</ul>\n");<NEW_LINE>} else {<NEW_LINE>if (children.size() == 0) {<NEW_LINE>json.append("<li>" + node.getData() + " (" + String.format("%,d", node.getSize()) + "bytes)</li>");<NEW_LINE>} else {<NEW_LINE>// (children.size()!=0?":"+node.totalChildren():"");<NEW_LINE>String label = node.getData() + " (" + String.format("%,d", <MASK><NEW_LINE>json.append("<li><span class=\"caret\">" + label + "</span>\n");<NEW_LINE>if (children.size() != 0) {<NEW_LINE>json.append("<ul class=\"nested\"\n");<NEW_LINE>for (int n = 0; n < children.size(); n++) {<NEW_LINE>walkGraph(children.get(n), json);<NEW_LINE>}<NEW_LINE>json.append("</ul>\n");<NEW_LINE>}<NEW_LINE>json.append("</li>");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | node.getSize()) + "bytes)"; |
92,476 | private Intent createOpenUrlIntentFrom(KrollInvocation invocation, String url) {<NEW_LINE>// Validate argument.<NEW_LINE>if ((url == null) || url.isEmpty()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>// Create a URI object from the given string.<NEW_LINE>Uri uri = null;<NEW_LINE>if (TiFileFactory.isLocalScheme(url)) {<NEW_LINE>String resolvedUrl = url;<NEW_LINE>if (invocation != null) {<NEW_LINE>TiUrl tiUrl = TiUrl.createProxyUrl(invocation.getSourceUrl());<NEW_LINE>resolvedUrl = TiUrl.resolve(<MASK><NEW_LINE>}<NEW_LINE>TiBaseFile tiFile = TiFileFactory.createTitaniumFile(resolvedUrl, false);<NEW_LINE>uri = TiFileProvider.createUriFrom(tiFile);<NEW_LINE>}<NEW_LINE>if (uri == null) {<NEW_LINE>uri = Uri.parse(url);<NEW_LINE>if (uri == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Fetch the URL's scheme.<NEW_LINE>String scheme = uri.getScheme();<NEW_LINE>if (scheme == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>// Create an intent for the given URL.<NEW_LINE>Intent intent = null;<NEW_LINE>if (scheme.equals("tel")) {<NEW_LINE>intent = new Intent(Intent.ACTION_DIAL, uri);<NEW_LINE>} else {<NEW_LINE>intent = new Intent(Intent.ACTION_VIEW, uri);<NEW_LINE>try {<NEW_LINE>String mimeType = null;<NEW_LINE>if (scheme.equals(ContentResolver.SCHEME_CONTENT)) {<NEW_LINE>mimeType = TiApplication.getInstance().getContentResolver().getType(uri);<NEW_LINE>} else if (scheme.equals(ContentResolver.SCHEME_FILE)) {<NEW_LINE>mimeType = TiMimeTypeHelper.getMimeType(uri, null);<NEW_LINE>}<NEW_LINE>if ((mimeType != null) && (mimeType.length() > 0)) {<NEW_LINE>intent.setDataAndType(uri, mimeType);<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return intent;<NEW_LINE>} | tiUrl.baseUrl, url, null); |
1,763,422 | public void testInputStreamIsClosedByUserBeforeSending() throws Exception {<NEW_LINE>List<IAttachment> <MASK><NEW_LINE>CheckableInputStream inputStream = Util.wrapStream(Util.xmlFile());<NEW_LINE>attachments.add(AttachmentBuilder.newBuilder("file1").inputStream("some.xml", inputStream).contentType(MediaType.APPLICATION_XML).build());<NEW_LINE>inputStream.close();<NEW_LINE>assertTrue("InputStream was closed but is reporting as unclosed...", inputStream.isClosed());<NEW_LINE>try {<NEW_LINE>client.target(URI_CONTEXT_ROOT).path("/app/multi").request(MediaType.TEXT_PLAIN).put(Entity.entity(attachments, MediaType.MULTIPART_FORM_DATA));<NEW_LINE>fail("Did not throw expected ProcessingException when sending a previously-closed input stream");<NEW_LINE>} catch (ProcessingException ex) {<NEW_LINE>// expected<NEW_LINE>} catch (Throwable t) {<NEW_LINE>System.out.println("Caught unexcepted exception: " + t);<NEW_LINE>t.printStackTrace();<NEW_LINE>fail("Caught unexcepted exception: " + t);<NEW_LINE>}<NEW_LINE>} | attachments = new ArrayList<>(); |
1,090,241 | final StartElasticsearchServiceSoftwareUpdateResult executeStartElasticsearchServiceSoftwareUpdate(StartElasticsearchServiceSoftwareUpdateRequest startElasticsearchServiceSoftwareUpdateRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(startElasticsearchServiceSoftwareUpdateRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<StartElasticsearchServiceSoftwareUpdateRequest> request = null;<NEW_LINE>Response<StartElasticsearchServiceSoftwareUpdateResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new StartElasticsearchServiceSoftwareUpdateRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(startElasticsearchServiceSoftwareUpdateRequest));<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, "Elasticsearch Service");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StartElasticsearchServiceSoftwareUpdate");<NEW_LINE>request.<MASK><NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<StartElasticsearchServiceSoftwareUpdateResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new StartElasticsearchServiceSoftwareUpdateResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); |
308,783 | public void run() {<NEW_LINE>while (!Tray.this.appIsReady) {<NEW_LINE>Tray.this.ti.setImage(Tray.this.progressIcons[this.ic]);<NEW_LINE>if (OS.isMacArchitecture)<NEW_LINE>setDockIcon(Tray.this.progressIcons[this.ic]);<NEW_LINE>this.ic++;<NEW_LINE>if (this.ic >= 4)<NEW_LINE>this.ic = 0;<NEW_LINE>try {<NEW_LINE>Thread.sleep(80);<NEW_LINE>} catch (final InterruptedException e) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>// do not write a cache to disc; keep in RAM<NEW_LINE>ImageIO.setUseCache(false);<NEW_LINE>final Image trayIcon = ImageIO.read(new File(Tray.this.iconPath));<NEW_LINE>Tray.<MASK><NEW_LINE>Tray.this.ti.setToolTip(Tray.this.readyMessage());<NEW_LINE>setDockIcon(trayIcon);<NEW_LINE>} catch (final IOException e) {<NEW_LINE>ConcurrentLog.logException(e);<NEW_LINE>}<NEW_LINE>Tray.this.progressIcons = null;<NEW_LINE>} | this.ti.setImage(trayIcon); |
622,566 | private void store_pubkey(File dbPath, String serverName, String pk) {<NEW_LINE>ArrayList<String> lines = new ArrayList<String>();<NEW_LINE>File vncDir = new File(FileUtils.getVncHomeDir());<NEW_LINE>try {<NEW_LINE>if (dbPath.exists()) {<NEW_LINE>FileReader db = new FileReader(dbPath);<NEW_LINE>BufferedReader dbBuf = new BufferedReader(db);<NEW_LINE>String line;<NEW_LINE>while ((line = dbBuf.readLine()) != null) {<NEW_LINE>String[] fields = line.split("\\|");<NEW_LINE>if (fields.length == 6)<NEW_LINE>if (!serverName.equals(fields[2]) && !pk.equals(fields[5]))<NEW_LINE>lines.add(line);<NEW_LINE>}<NEW_LINE>dbBuf.close();<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new AuthFailureException("Could not load known hosts database");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>if (!dbPath.exists())<NEW_LINE>dbPath.createNewFile();<NEW_LINE>FileWriter fw = new FileWriter(dbPath.getAbsolutePath(), false);<NEW_LINE>Iterator i = lines.iterator();<NEW_LINE>while (i.hasNext()) fw.write((String) <MASK><NEW_LINE>fw.write("|g0|" + serverName + "|*|0|" + pk + "\n");<NEW_LINE>fw.close();<NEW_LINE>} catch (IOException e) {<NEW_LINE>vlog.error("Failed to store server certificate to known hosts database");<NEW_LINE>}<NEW_LINE>} | i.next() + "\n"); |
1,087,116 | public List<Placement> resolve() {<NEW_LINE>if (entryViews == null || entryViews.isEmpty()) {<NEW_LINE>return Collections.emptyList();<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>columns.add(new TimeBoundsColumn());<NEW_LINE>for (EntryViewBase<?> view : entryViews) {<NEW_LINE>boolean added = false;<NEW_LINE>// Try to add the activity to an existing column.<NEW_LINE>for (TimeBoundsColumn column : columns) {<NEW_LINE>if (column.hasRoomFor(view)) {<NEW_LINE>column.add(view);<NEW_LINE>added = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// No column found, create a new column.<NEW_LINE>if (!added) {<NEW_LINE>TimeBoundsColumn column = new TimeBoundsColumn();<NEW_LINE>columns.add(column);<NEW_LINE>column.add(view);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final List<Placement> placements = new ArrayList<>();<NEW_LINE>final int colCount = columns.size();<NEW_LINE>for (int col = 0; col < columns.size(); col++) {<NEW_LINE>TimeBoundsColumn column = columns.get(col);<NEW_LINE>for (EntryViewBase<?> view : column.getEntryViews()) {<NEW_LINE>placements.add(new Placement(view, col, colCount));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return placements;<NEW_LINE>} | columns = new ArrayList<>(); |
1,026,654 | public void onSessionFinished(@NonNull TerminalSession finishedSession) {<NEW_LINE>TermuxService service = mActivity.getTermuxService();<NEW_LINE>if (service == null || service.wantsToStop()) {<NEW_LINE>// The service wants to stop as soon as possible.<NEW_LINE>mActivity.finishActivityIfNotFinishing();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int index = service.getIndexOfSession(finishedSession);<NEW_LINE>// For plugin commands that expect the result back, we should immediately close the session<NEW_LINE>// and send the result back instead of waiting fo the user to press enter.<NEW_LINE>// The plugin can handle/show errors itself.<NEW_LINE>boolean isPluginExecutionCommandWithPendingResult = false;<NEW_LINE>TermuxSession <MASK><NEW_LINE>if (termuxSession != null) {<NEW_LINE>isPluginExecutionCommandWithPendingResult = termuxSession.getExecutionCommand().isPluginExecutionCommandWithPendingResult();<NEW_LINE>if (isPluginExecutionCommandWithPendingResult)<NEW_LINE>Logger.logVerbose(LOG_TAG, "The \"" + finishedSession.mSessionName + "\" session will be force finished automatically since result in pending.");<NEW_LINE>}<NEW_LINE>if (mActivity.isVisible() && finishedSession != mActivity.getCurrentSession()) {<NEW_LINE>// Show toast for non-current sessions that exit.<NEW_LINE>// Verify that session was not removed before we got told about it finishing:<NEW_LINE>if (index >= 0)<NEW_LINE>mActivity.showToast(toToastTitle(finishedSession) + " - exited", true);<NEW_LINE>}<NEW_LINE>if (mActivity.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK)) {<NEW_LINE>// On Android TV devices we need to use older behaviour because we may<NEW_LINE>// not be able to have multiple launcher icons.<NEW_LINE>if (service.getTermuxSessionsSize() > 1 || isPluginExecutionCommandWithPendingResult) {<NEW_LINE>removeFinishedSession(finishedSession);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// Once we have a separate launcher icon for the failsafe session, it<NEW_LINE>// should be safe to auto-close session on exit code '0' or '130'.<NEW_LINE>if (finishedSession.getExitStatus() == 0 || finishedSession.getExitStatus() == 130 || isPluginExecutionCommandWithPendingResult) {<NEW_LINE>removeFinishedSession(finishedSession);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | termuxSession = service.getTermuxSession(index); |
1,237,818 | final ModifyIdentityIdFormatResult executeModifyIdentityIdFormat(ModifyIdentityIdFormatRequest modifyIdentityIdFormatRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(modifyIdentityIdFormatRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ModifyIdentityIdFormatRequest> request = null;<NEW_LINE>Response<ModifyIdentityIdFormatResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ModifyIdentityIdFormatRequestMarshaller().marshall(super.beforeMarshalling(modifyIdentityIdFormatRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "EC2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ModifyIdentityIdFormat");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<ModifyIdentityIdFormatResult> responseHandler = new StaxResponseHandler<ModifyIdentityIdFormatResult>(new ModifyIdentityIdFormatResultStaxUnmarshaller());<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 awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
592,426 | protected String processChangeExecutionConcurrencyRequest() {<NEW_LINE>ChangeExecutionConcurrencyParameters changeExecutionConcurrencyParameters = _parameters.changeExecutionConcurrencyParameters();<NEW_LINE>if (changeExecutionConcurrencyParameters == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>// 1. Change inter-broker partition concurrency.<NEW_LINE><MASK><NEW_LINE>if (concurrentInterBrokerPartitionMovements != null) {<NEW_LINE>_kafkaCruiseControl.setRequestedInterBrokerPartitionMovementConcurrency(concurrentInterBrokerPartitionMovements);<NEW_LINE>sb.append(String.format("Inter-broker partition movement concurrency is set to %d%n", concurrentInterBrokerPartitionMovements));<NEW_LINE>LOG.info("Inter-broker partition movement concurrency is set to: {} by user.", concurrentInterBrokerPartitionMovements);<NEW_LINE>}<NEW_LINE>// 2. Change intra-broker partition concurrency.<NEW_LINE>Integer concurrentIntraBrokerPartitionMovements = changeExecutionConcurrencyParameters.concurrentIntraBrokerPartitionMovements();<NEW_LINE>if (concurrentIntraBrokerPartitionMovements != null) {<NEW_LINE>_kafkaCruiseControl.setRequestedIntraBrokerPartitionMovementConcurrency(concurrentIntraBrokerPartitionMovements);<NEW_LINE>sb.append(String.format("Intra-broker partition movement concurrency is set to %d%n", concurrentIntraBrokerPartitionMovements));<NEW_LINE>LOG.info("Intra-broker partition movement concurrency is set to: {} by user.", concurrentIntraBrokerPartitionMovements);<NEW_LINE>}<NEW_LINE>// 3. Change leadership concurrency.<NEW_LINE>Integer concurrentLeaderMovements = changeExecutionConcurrencyParameters.concurrentLeaderMovements();<NEW_LINE>if (concurrentLeaderMovements != null) {<NEW_LINE>_kafkaCruiseControl.setRequestedLeadershipMovementConcurrency(concurrentLeaderMovements);<NEW_LINE>sb.append(String.format("Leadership movement concurrency is set to %d%n", concurrentLeaderMovements));<NEW_LINE>LOG.info("Leadership movement concurrency is set to: {} by user.", concurrentLeaderMovements);<NEW_LINE>}<NEW_LINE>// 4. Change the interval between checking and updating (if needed) the progress of an initiated execution.<NEW_LINE>Long executionProgressCheckIntervalMs = changeExecutionConcurrencyParameters.executionProgressCheckIntervalMs();<NEW_LINE>if (executionProgressCheckIntervalMs != null) {<NEW_LINE>_kafkaCruiseControl.setRequestedExecutionProgressCheckIntervalMs(executionProgressCheckIntervalMs);<NEW_LINE>sb.append(String.format("Execution progress check interval is set to %dMs%n", executionProgressCheckIntervalMs));<NEW_LINE>LOG.info("Execution progress check interval is set to: {}Ms by user.", executionProgressCheckIntervalMs);<NEW_LINE>}<NEW_LINE>// 5. Change max inter-broker partition concurrency.<NEW_LINE>Integer maxInterBrokerPartitionMovements = changeExecutionConcurrencyParameters.maxInterBrokerPartitionMovements();<NEW_LINE>if (maxInterBrokerPartitionMovements != null) {<NEW_LINE>_kafkaCruiseControl.setRequestedMaxInterBrokerPartitionMovements(maxInterBrokerPartitionMovements);<NEW_LINE>sb.append(String.format("Max inter-broker partition movements is set to %d%n", maxInterBrokerPartitionMovements));<NEW_LINE>LOG.info("Max inter-broker partition movements is set to: {} by user.", maxInterBrokerPartitionMovements);<NEW_LINE>}<NEW_LINE>return sb.toString();<NEW_LINE>} | Integer concurrentInterBrokerPartitionMovements = changeExecutionConcurrencyParameters.concurrentInterBrokerPartitionMovements(); |
1,790,855 | private void printResult(PrintStream printStream, Source source) {<NEW_LINE>String path = source.getPath();<NEW_LINE>int lineCount = source.getLineCount();<NEW_LINE>Set<Integer> nonCoveredLineNumbers = nonCoveredLineNumbers(source);<NEW_LINE>Set<Integer> loadedLineNumbers = coverageMap.get(source).loadedLineNumbers();<NEW_LINE>double coveredPercentage = 100 * ((double) loadedLineNumbers.size() - nonCoveredLineNumbers.size()) / lineCount;<NEW_LINE>printStream.println("==");<NEW_LINE>printStream.println("Coverage of " + path + " is " + String.format("%.2f%%", coveredPercentage));<NEW_LINE>for (int i = 1; i <= source.getLineCount(); i++) {<NEW_LINE>char covered = getCoverageCharacter(nonCoveredLineNumbers, loadedLineNumbers, i);<NEW_LINE>printStream.println(String.format("%s %s", covered, <MASK><NEW_LINE>}<NEW_LINE>} | source.getCharacters(i))); |
861,141 | /* protobuf only */<NEW_LINE>List<PKeyValue> toProto(Client client) {<NEW_LINE>if (map.isEmpty())<NEW_LINE>return Collections.emptyList();<NEW_LINE>List<PKeyValue> answer = new ArrayList<>();<NEW_LINE>for (Entry<String, Object> entry : map.entrySet()) {<NEW_LINE>if (entry.getValue() == null) {<NEW_LINE>// shortcut: we can save null values without knowing the actual<NEW_LINE>// attribute type<NEW_LINE>answer.add(PKeyValue.newBuilder().setKey(entry.getKey()).setValue(PAnyValue.newBuilder().setNullValue(NullValue.NULL_VALUE_VALUE)).build());<NEW_LINE>} else {<NEW_LINE>client.getSettings().getAttributeTypes().filter(a -> entry.getKey().equals(a.getId())).findAny().ifPresent(at -> answer.add(PKeyValue.newBuilder().setKey(entry.getKey()).setValue(((ProtoConverter) at.getConverter()).toProto(entry.getValue()<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return answer;<NEW_LINE>} | )).build())); |
1,636,963 | public void show(final DialogInterface.OnClickListener... listener) {<NEW_LINE>final AlertDialog.Builder builder = Dialogs.newBuilder(getContext());<NEW_LINE>applyCommons(builder);<NEW_LINE>builder.setCancelable(true);<NEW_LINE>if (listener == null || listener.length == 0) {<NEW_LINE>builder.setPositiveButton(getPositiveButton(), DO_NOTHING);<NEW_LINE>} else {<NEW_LINE>builder.setPositiveButton(getPositiveButton<MASK><NEW_LINE>if (listener.length > 1 && listener[1] != null) {<NEW_LINE>builder.setNegativeButton(getNegativeButton(), listener[1]);<NEW_LINE>}<NEW_LINE>if (listener.length > 2 && listener[2] != null) {<NEW_LINE>builder.setNeutralButton(getNeutralButton(), listener[2]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final AlertDialog dialog = builder.create();<NEW_LINE>if (getContext() instanceof Activity) {<NEW_LINE>dialog.setOwnerActivity((Activity) getContext());<NEW_LINE>}<NEW_LINE>dialog.show();<NEW_LINE>adjustCommons(dialog);<NEW_LINE>} | (), listener[0]); |
644,806 | private static List<Byte> flatten(final ConditionNode root, final Map<ConditionNode, Integer> nodeIds) {<NEW_LINE>final List<Byte> flattenedTree = new ArrayList<Byte>();<NEW_LINE>addAll(flattenedTree, getType(root));<NEW_LINE>final List<Byte> payload = getPayload(root);<NEW_LINE>addAll(flattenedTree, ByteHelpers.toBigEndianDword(payload.size()));<NEW_LINE>flattenedTree.addAll(payload);<NEW_LINE>addAll(flattenedTree, ByteHelpers.toBigEndianDword(root.getChildren().size()));<NEW_LINE>for (final ConditionNode child : root.getChildren()) {<NEW_LINE>addAll(flattenedTree, ByteHelpers.toBigEndianDword(<MASK><NEW_LINE>}<NEW_LINE>for (final ConditionNode child : root.getChildren()) {<NEW_LINE>flattenedTree.addAll(flatten(child, nodeIds));<NEW_LINE>}<NEW_LINE>return flattenedTree;<NEW_LINE>} | nodeIds.get(child))); |
1,453,056 | public static String addLimits(String query, long offSet, long limit) {<NEW_LINE>if (offSet == 0 && limit == -1) {<NEW_LINE>// Nothing to do...<NEW_LINE>return query;<NEW_LINE>}<NEW_LINE>StringBuffer queryString = new StringBuffer();<NEW_LINE>int count = 0;<NEW_LINE>if (query != null) {<NEW_LINE>query = query.toLowerCase();<NEW_LINE>count = StringUtil.count(query, "select");<NEW_LINE>}<NEW_LINE>if (!UtilMethods.isSet(query) || !query.trim().contains("select") || count > 1) {<NEW_LINE>return query;<NEW_LINE>} else {<NEW_LINE>if (DbConnectionFactory.isPostgres() || DbConnectionFactory.isMySql()) {<NEW_LINE>query = query + " LIMIT " + limit + " OFFSET " + offSet;<NEW_LINE>queryString.append(query);<NEW_LINE>} else if (DbConnectionFactory.isMsSql()) {<NEW_LINE>String str = "";<NEW_LINE>if (query.startsWith("select")) {<NEW_LINE>query = query.substring(6);<NEW_LINE>}<NEW_LINE>if (query.contains("order by")) {<NEW_LINE>str = query.substring(query.indexOf("order by"), query.length());<NEW_LINE>query = query.replace(<MASK><NEW_LINE>}<NEW_LINE>query = " SELECT TOP " + limit + " * FROM (SELECT ROW_NUMBER() " + " OVER (" + str + ") AS RowNumber," + query + ") temp " + " WHERE RowNumber >" + offSet;<NEW_LINE>queryString.append(query);<NEW_LINE>} else if (DbConnectionFactory.isOracle()) {<NEW_LINE>limit = limit + offSet;<NEW_LINE>query = "select * from ( select temp.*, ROWNUM rnum from ( " + query + " ) temp where ROWNUM <= " + limit + " ) where rnum > " + offSet;<NEW_LINE>queryString.append(query);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return queryString.toString();<NEW_LINE>} | str, "").trim(); |
1,622,947 | private static Long localTimestampMillisSerializer(Object data, Schema schema, Schema.Type primitiveType, LogicalType logicalType) {<NEW_LINE>LocalDateTime value;<NEW_LINE>if (data instanceof String) {<NEW_LINE>try {<NEW_LINE>value = LocalDateTime.ofInstant(Instant.ofEpochMilli(Long.parseLong((String) data)), ZoneOffset.UTC);<NEW_LINE>} catch (NumberFormatException ignored) {<NEW_LINE>value = LocalDateTime.parse((String) data);<NEW_LINE>}<NEW_LINE>} else if (data instanceof Long) {<NEW_LINE>value = LocalDateTime.ofInstant(Instant.ofEpochMilli((Long<MASK><NEW_LINE>} else if (data instanceof Integer) {<NEW_LINE>value = LocalDateTime.ofInstant(Instant.ofEpochMilli(((Integer) data).longValue()), ZoneOffset.UTC);<NEW_LINE>} else {<NEW_LINE>value = (LocalDateTime) data;<NEW_LINE>}<NEW_LINE>if (primitiveType == Schema.Type.LONG) {<NEW_LINE>return AvroSerializer.LOCAL_TIMESTAMP_MILLIS_CONVERSION.toLong(value, schema, logicalType);<NEW_LINE>}<NEW_LINE>throw new IllegalStateException("Unexpected value: " + primitiveType + " on schema " + schema);<NEW_LINE>} | ) data), ZoneOffset.UTC); |
393,264 | final ListAcceleratorsResult executeListAccelerators(ListAcceleratorsRequest listAcceleratorsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listAcceleratorsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListAcceleratorsRequest> request = null;<NEW_LINE>Response<ListAcceleratorsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListAcceleratorsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listAcceleratorsRequest));<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(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Global Accelerator");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListAccelerators");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListAcceleratorsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListAcceleratorsResultJsonUnmarshaller());<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.SIGNING_REGION, getSigningRegion()); |
648,488 | private Path findModelFile(String prefix) {<NEW_LINE>if (Files.isRegularFile(modelDir)) {<NEW_LINE>Path file = modelDir;<NEW_LINE>modelDir = modelDir.getParent();<NEW_LINE>String fileName = file.toFile().getName();<NEW_LINE>if (fileName.endsWith(".json")) {<NEW_LINE>modelName = fileName.substring(0, fileName.length() - 5);<NEW_LINE>} else {<NEW_LINE>modelName = fileName;<NEW_LINE>}<NEW_LINE>return file;<NEW_LINE>}<NEW_LINE>if (prefix == null) {<NEW_LINE>prefix = modelName;<NEW_LINE>}<NEW_LINE>Path modelFile = modelDir.resolve(prefix);<NEW_LINE>if (Files.notExists(modelFile) || !Files.isRegularFile(modelFile)) {<NEW_LINE>if (prefix.endsWith(".json")) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>modelFile = <MASK><NEW_LINE>if (Files.notExists(modelFile) || !Files.isRegularFile(modelFile)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return modelFile;<NEW_LINE>} | modelDir.resolve(prefix + ".json"); |
651,073 | public static DescriptorSupport mbeanDescriptor(final boolean immutable, final Class<?> intf, final boolean singleton, final boolean globalSingleton, final String group, final boolean supportsAdoption, final String[] subTypes) {<NEW_LINE>final DescriptorSupport desc = new DescriptorSupport();<NEW_LINE>if (intf == null || !intf.isInterface()) {<NEW_LINE>throw new IllegalArgumentException("interface class must be an interface");<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>desc.setField(DESC_STD_INTERFACE_NAME, intf.getName());<NEW_LINE>desc.setField(DESC_IS_SINGLETON, singleton);<NEW_LINE>desc.setField(DESC_IS_GLOBAL_SINGLETON, globalSingleton);<NEW_LINE>desc.setField(DESC_GROUP, group);<NEW_LINE>desc.setField(DESC_SUPPORTS_ADOPTION, supportsAdoption);<NEW_LINE>if (subTypes != null) {<NEW_LINE>desc.setField(DESC_SUB_TYPES, subTypes);<NEW_LINE>}<NEW_LINE>return desc;<NEW_LINE>} | desc.setField(DESC_STD_IMMUTABLE_INFO, immutable); |
500,762 | protected void internalTransform(final Body body, String phaseName, Map<String, String> options) {<NEW_LINE>final ExceptionalUnitGraph g = ExceptionalUnitGraphFactory.createExceptionalUnitGraph(body, DalvikThrowAnalysis.v());<NEW_LINE>final LocalDefs defs = G.v().soot_toolkits_scalar_LocalDefsFactory().newLocalDefs(g);<NEW_LINE>final LocalCreation lc = Scene.v().createLocalCreation(body.getLocals(), "ex");<NEW_LINE>boolean changed = false;<NEW_LINE>for (Iterator<Unit> unitIt = body.getUnits().snapshotIterator(); unitIt.hasNext(); ) {<NEW_LINE>Stmt s = (Stmt) unitIt.next();<NEW_LINE>if (s.containsArrayRef()) {<NEW_LINE>// Check array reference<NEW_LINE>Value base = s.getArrayRef().getBase();<NEW_LINE>if (isAlwaysNullBefore(s, (Local) base, defs)) {<NEW_LINE>createThrowStmt(body, s, lc);<NEW_LINE>changed = true;<NEW_LINE>}<NEW_LINE>} else if (s instanceof AssignStmt) {<NEW_LINE>AssignStmt ass = (AssignStmt) s;<NEW_LINE>Value rightOp = ass.getRightOp();<NEW_LINE>if (rightOp instanceof LengthExpr) {<NEW_LINE>// Check lengthof expression<NEW_LINE>LengthExpr l = (LengthExpr) ass.getRightOp();<NEW_LINE>Value base = l.getOp();<NEW_LINE>if (base instanceof IntConstant) {<NEW_LINE>IntConstant ic = (IntConstant) base;<NEW_LINE>if (ic.value == 0) {<NEW_LINE>createThrowStmt(body, s, lc);<NEW_LINE>changed = true;<NEW_LINE>}<NEW_LINE>} else if (base == NullConstant.v() || isAlwaysNullBefore(s, (Local) base, defs)) {<NEW_LINE><MASK><NEW_LINE>changed = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (changed) {<NEW_LINE>UnreachableCodeEliminator.v().transform(body);<NEW_LINE>}<NEW_LINE>} | createThrowStmt(body, s, lc); |
1,550,447 | public void extractAndSetEsrReference(@NonNull final EntryTransaction2 txDtls, @NonNull final ESRTransactionBuilder trxBuilder) {<NEW_LINE>final IMsgBL msgBL = Services.get(IMsgBL.class);<NEW_LINE>final Optional<String> esrReferenceNumberString = extractEsrReference(txDtls);<NEW_LINE>if (esrReferenceNumberString.isPresent()) {<NEW_LINE>trxBuilder.esrReferenceNumber(esrReferenceNumberString.get());<NEW_LINE>} else {<NEW_LINE>final Optional<String> fallback = extractReferenceFallback(txDtls);<NEW_LINE>if (fallback.isPresent()) {<NEW_LINE>trxBuilder.esrReferenceNumber(fallback.get());<NEW_LINE>trxBuilder.errorMsg(msgBL.getMsg(Env<MASK><NEW_LINE>} else {<NEW_LINE>trxBuilder.errorMsg(msgBL.getMsg(Env.getCtx(), MSG_MISSING_ESR_REFERENCE));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .getCtx(), MSG_AMBIGOUS_REFERENCE)); |
409,652 | // @formatter:on<NEW_LINE>@Override<NEW_LINE>PComplex compute(VirtualFrame frame, double real, double imag) {<NEW_LINE>PComplex result = specialValue(factory(), SPECIAL_VALUES, real, imag);<NEW_LINE>if (result != null) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>double rreal;<NEW_LINE>double rimag;<NEW_LINE>if (Math.abs(real) > LARGE_DOUBLE || Math.abs(imag) > LARGE_DOUBLE) {<NEW_LINE>rreal = Math.log(Math.hypot(real / 2.0, imag <MASK><NEW_LINE>rimag = Math.atan2(imag, real);<NEW_LINE>} else {<NEW_LINE>PComplex s1 = sqrtNode.executeComplex(frame, factory().createComplex(real - 1.0, imag));<NEW_LINE>PComplex s2 = sqrtNode.executeComplex(frame, factory().createComplex(real + 1.0, imag));<NEW_LINE>rreal = realAsinhNode.executeObject(frame, s1.getReal() * s2.getReal() + s1.getImag() * s2.getImag());<NEW_LINE>rimag = 2.0 * Math.atan2(s1.getImag(), s2.getReal());<NEW_LINE>}<NEW_LINE>return factory().createComplex(rreal, rimag);<NEW_LINE>} | / 2.0)) + LN_2 * 2.0; |
373,956 | private void convert(OutputStream outputStream, File docs, EPackage ePackage) throws IOException {<NEW_LINE>IfcDoc ifcDoc = null;<NEW_LINE>if (docs != null) {<NEW_LINE>ifcDoc = new IfcDoc(docs);<NEW_LINE>}<NEW_LINE>ObjectMapper objectMapper = new ObjectMapper();<NEW_LINE>ObjectNode root = objectMapper.createObjectNode();<NEW_LINE>ObjectNode classes = objectMapper.createObjectNode();<NEW_LINE>root.set("classes", classes);<NEW_LINE>for (EClassifier eClassifier : ePackage.getEClassifiers()) {<NEW_LINE>ObjectNode classifierNode = objectMapper.createObjectNode();<NEW_LINE>classes.set(eClassifier.getName(), classifierNode);<NEW_LINE>if (eClassifier instanceof EEnum) {<NEW_LINE>} else if (eClassifier instanceof EClass) {<NEW_LINE>EClass eClass = (EClass) eClassifier;<NEW_LINE>String domain = "geometry";<NEW_LINE>if (ifcDoc != null) {<NEW_LINE>domain = ifcDoc.getDomain(eClass.getName());<NEW_LINE>}<NEW_LINE>classifierNode.put("domain", domain);<NEW_LINE>ArrayNode superClassesNode = objectMapper.createArrayNode();<NEW_LINE>classifierNode.set("superclasses", superClassesNode);<NEW_LINE>for (EClass superClass : eClass.getESuperTypes()) {<NEW_LINE>superClassesNode.add(superClass.getName());<NEW_LINE>}<NEW_LINE>ObjectNode fieldsNode = objectMapper.createObjectNode();<NEW_LINE>classifierNode.set("fields", fieldsNode);<NEW_LINE>for (EStructuralFeature eStructuralFeature : eClass.getEStructuralFeatures()) {<NEW_LINE>ObjectNode fieldNode = objectMapper.createObjectNode();<NEW_LINE>fieldsNode.set(<MASK><NEW_LINE>fieldNode.put("type", convertType(eStructuralFeature.getEType()));<NEW_LINE>fieldNode.put("reference", eStructuralFeature instanceof EReference);<NEW_LINE>fieldNode.put("many", eStructuralFeature.isMany());<NEW_LINE>fieldNode.put("inverse", eStructuralFeature.getEAnnotation("inverse") != null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>objectMapper.writerWithDefaultPrettyPrinter().writeValue(outputStream, root);<NEW_LINE>} | eStructuralFeature.getName(), fieldNode); |
764,634 | public Request<GetSegmentImportJobsRequest> marshall(GetSegmentImportJobsRequest getSegmentImportJobsRequest) {<NEW_LINE>if (getSegmentImportJobsRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(GetSegmentImportJobsRequest)");<NEW_LINE>}<NEW_LINE>Request<GetSegmentImportJobsRequest> request = new DefaultRequest<GetSegmentImportJobsRequest>(getSegmentImportJobsRequest, "AmazonPinpoint");<NEW_LINE>request.setHttpMethod(HttpMethodName.GET);<NEW_LINE>String uriResourcePath = "/v1/apps/{application-id}/segments/{segment-id}/jobs/import";<NEW_LINE>uriResourcePath = uriResourcePath.replace("{application-id}", (getSegmentImportJobsRequest.getApplicationId() == null) ? "" : StringUtils.fromString(getSegmentImportJobsRequest.getApplicationId()));<NEW_LINE>if (getSegmentImportJobsRequest.getPageSize() != null) {<NEW_LINE>request.addParameter("page-size", StringUtils.fromString(getSegmentImportJobsRequest.getPageSize()));<NEW_LINE>}<NEW_LINE>uriResourcePath = uriResourcePath.replace("{segment-id}", (getSegmentImportJobsRequest.getSegmentId() == null) ? "" : StringUtils.fromString(getSegmentImportJobsRequest.getSegmentId()));<NEW_LINE>if (getSegmentImportJobsRequest.getToken() != null) {<NEW_LINE>request.addParameter("token", StringUtils.fromString<MASK><NEW_LINE>}<NEW_LINE>request.setResourcePath(uriResourcePath);<NEW_LINE>if (!request.getHeaders().containsKey("Content-Type")) {<NEW_LINE>request.addHeader("Content-Type", "application/x-amz-json-1.1");<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | (getSegmentImportJobsRequest.getToken())); |
103,044 | private void handlePostTouchScrolling(int velocityX, int velocityY) {<NEW_LINE>// If we aren't going to do anything (send events or snap to page), we can early out.<NEW_LINE>if (!mSendMomentumEvents && !mPagingEnabled && !isScrollPerfLoggingEnabled()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Check if we are already handling this which may occur if this is called by both the touch up<NEW_LINE>// and a fling call<NEW_LINE>if (mPostTouchRunnable != null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (mSendMomentumEvents) {<NEW_LINE>ReactScrollViewHelper.emitScrollMomentumBeginEvent(this, velocityX, velocityY);<NEW_LINE>}<NEW_LINE>mActivelyScrolling = false;<NEW_LINE>mPostTouchRunnable = new Runnable() {<NEW_LINE><NEW_LINE>private boolean mSnappingToPage = false;<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>if (mActivelyScrolling) {<NEW_LINE>// We are still scrolling so we just post to check again a frame later<NEW_LINE>mActivelyScrolling = false;<NEW_LINE>ReactHorizontalScrollView.this.<MASK><NEW_LINE>} else {<NEW_LINE>if (mPagingEnabled && !mSnappingToPage) {<NEW_LINE>// Only if we have pagingEnabled and we have not snapped to the page do we<NEW_LINE>// need to continue checking for the scroll. And we cause that scroll by asking for it<NEW_LINE>mSnappingToPage = true;<NEW_LINE>smoothScrollToPage(0);<NEW_LINE>ReactHorizontalScrollView.this.postOnAnimationDelayed(this, ReactScrollViewHelper.MOMENTUM_DELAY);<NEW_LINE>} else {<NEW_LINE>if (mSendMomentumEvents) {<NEW_LINE>ReactScrollViewHelper.emitScrollMomentumEndEvent(ReactHorizontalScrollView.this);<NEW_LINE>}<NEW_LINE>ReactHorizontalScrollView.this.mPostTouchRunnable = null;<NEW_LINE>disableFpsListener();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>postOnAnimationDelayed(mPostTouchRunnable, ReactScrollViewHelper.MOMENTUM_DELAY);<NEW_LINE>} | postOnAnimationDelayed(this, ReactScrollViewHelper.MOMENTUM_DELAY); |
645,325 | public void beforeIndexRemoved(IndexService indexService, IndexRemovalReason reason) {<NEW_LINE>if (shouldEvictCacheFiles(reason)) {<NEW_LINE>if (indexService.getMetadata().isSearchableSnapshot()) {<NEW_LINE>final IndexSettings indexSettings = indexService.getIndexSettings();<NEW_LINE>for (IndexShard indexShard : indexService) {<NEW_LINE>final ShardId shardId = indexShard.shardId();<NEW_LINE>logger.debug("{} marking shard as evicted in searchable snapshots cache (reason: {})", shardId, reason);<NEW_LINE>if (cacheService != null) {<NEW_LINE>cacheService.markShardAsEvictedInCache(SNAPSHOT_SNAPSHOT_ID_SETTING.get(indexSettings.getSettings()), SNAPSHOT_INDEX_NAME_SETTING.get(indexSettings.getSettings()), shardId);<NEW_LINE>}<NEW_LINE>if (frozenCacheService != null) {<NEW_LINE>frozenCacheService.markShardAsEvictedInCache(SNAPSHOT_SNAPSHOT_ID_SETTING.get(indexSettings.getSettings()), SNAPSHOT_INDEX_NAME_SETTING.get(indexSettings<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .getSettings()), shardId); |
1,824,824 | public static GetBoxCodeListResponse unmarshall(GetBoxCodeListResponse getBoxCodeListResponse, UnmarshallerContext context) {<NEW_LINE>getBoxCodeListResponse.setRequestId(context.stringValue("GetBoxCodeListResponse.RequestId"));<NEW_LINE>getBoxCodeListResponse.setErrorCode(context.integerValue("GetBoxCodeListResponse.ErrorCode"));<NEW_LINE>getBoxCodeListResponse.setErrorMsg(context.stringValue("GetBoxCodeListResponse.ErrorMsg"));<NEW_LINE>getBoxCodeListResponse.setSuccess(context.booleanValue("GetBoxCodeListResponse.Success"));<NEW_LINE>List<BoxCodeInfo> data = new ArrayList<BoxCodeInfo>();<NEW_LINE>for (int i = 0; i < context.lengthValue("GetBoxCodeListResponse.Data.Length"); i++) {<NEW_LINE>BoxCodeInfo boxCodeInfo = new BoxCodeInfo();<NEW_LINE>boxCodeInfo.setBeginTime(context.longValue("GetBoxCodeListResponse.Data[" + i + "].BeginTime"));<NEW_LINE>boxCodeInfo.setBoxInfo(context.stringValue("GetBoxCodeListResponse.Data[" + i + "].BoxInfo"));<NEW_LINE>boxCodeInfo.setCode(context.stringValue("GetBoxCodeListResponse.Data[" + i + "].Code"));<NEW_LINE>boxCodeInfo.setEndTime(context.longValue<MASK><NEW_LINE>boxCodeInfo.setModifyTime(context.longValue("GetBoxCodeListResponse.Data[" + i + "].ModifyTime"));<NEW_LINE>boxCodeInfo.setOperator(context.stringValue("GetBoxCodeListResponse.Data[" + i + "].Operator"));<NEW_LINE>boxCodeInfo.setScreencode(context.stringValue("GetBoxCodeListResponse.Data[" + i + "].Screencode"));<NEW_LINE>boxCodeInfo.setStatus(context.integerValue("GetBoxCodeListResponse.Data[" + i + "].Status"));<NEW_LINE>boxCodeInfo.setStatusTxt(context.stringValue("GetBoxCodeListResponse.Data[" + i + "].StatusTxt"));<NEW_LINE>data.add(boxCodeInfo);<NEW_LINE>}<NEW_LINE>getBoxCodeListResponse.setData(data);<NEW_LINE>List<ErrorMessage> errorList = new ArrayList<ErrorMessage>();<NEW_LINE>for (int i = 0; i < context.lengthValue("GetBoxCodeListResponse.ErrorList.Length"); i++) {<NEW_LINE>ErrorMessage errorMessage = new ErrorMessage();<NEW_LINE>errorMessage.setErrorMessage(context.stringValue("GetBoxCodeListResponse.ErrorList[" + i + "].ErrorMessage"));<NEW_LINE>errorList.add(errorMessage);<NEW_LINE>}<NEW_LINE>getBoxCodeListResponse.setErrorList(errorList);<NEW_LINE>return getBoxCodeListResponse;<NEW_LINE>} | ("GetBoxCodeListResponse.Data[" + i + "].EndTime")); |
1,039,051 | private void proxyLocationListener(XParam param, int arg, Class<?> interfaze, boolean client) throws Throwable {<NEW_LINE>if (param.args.length > arg)<NEW_LINE>if (param.args[arg] instanceof PendingIntent)<NEW_LINE>param.setResult(null);<NEW_LINE>else if (param.args[arg] != null && param.thisObject != null) {<NEW_LINE>if (client) {<NEW_LINE>Object key = param.args[arg];<NEW_LINE>synchronized (mMapProxy) {<NEW_LINE>// Reuse existing proxy<NEW_LINE>if (mMapProxy.containsKey(key)) {<NEW_LINE>Util.log(this, Log.INFO, "Reuse existing proxy uid=" + Binder.getCallingUid());<NEW_LINE>param.args[arg] = mMapProxy.get(key);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Already proxied<NEW_LINE>if (mMapProxy.containsValue(key)) {<NEW_LINE>Util.log(this, Log.INFO, "Already proxied uid=" + Binder.getCallingUid());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Create proxy<NEW_LINE>Util.log(this, Log.INFO, "Creating proxy uid=" + Binder.getCallingUid());<NEW_LINE>Object proxy = new ProxyLocationListener(Binder.getCallingUid(), (LocationListener) param.args[arg]);<NEW_LINE>// Use proxy<NEW_LINE>synchronized (mMapProxy) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>param.args[arg] = proxy;<NEW_LINE>} else {<NEW_LINE>// Create proxy<NEW_LINE>ClassLoader cl = param.thisObject.getClass().getClassLoader();<NEW_LINE>InvocationHandler ih = new OnLocationChangedHandler(Binder.getCallingUid(), param.args[arg]);<NEW_LINE>Object proxy = Proxy.newProxyInstance(cl, new Class<?>[] { interfaze }, ih);<NEW_LINE>Object key = param.args[arg];<NEW_LINE>if (key instanceof IInterface)<NEW_LINE>key = ((IInterface) key).asBinder();<NEW_LINE>// Use proxy<NEW_LINE>synchronized (mMapProxy) {<NEW_LINE>mMapProxy.put(key, proxy);<NEW_LINE>}<NEW_LINE>param.args[arg] = proxy;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | mMapProxy.put(key, proxy); |
1,009,877 | private static void appendGroup(StringBuffer sb, String indent, ThreadGroup tg, java.util.Map<Thread, StackTraceElement[]> data) {<NEW_LINE>sb.append(indent).append("Group ").append(tg.getName()).append('\n');<NEW_LINE><MASK><NEW_LINE>int groups = tg.activeGroupCount();<NEW_LINE>ThreadGroup[] chg = new ThreadGroup[groups];<NEW_LINE>tg.enumerate(chg, false);<NEW_LINE>for (ThreadGroup inner : chg) {<NEW_LINE>if (inner != null) {<NEW_LINE>appendGroup(sb, indent, inner, data);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int threads = tg.activeCount();<NEW_LINE>Thread[] cht = new Thread[threads];<NEW_LINE>tg.enumerate(cht, false);<NEW_LINE>for (Thread t : cht) {<NEW_LINE>if (t != null) {<NEW_LINE>appendThread(sb, indent, t, data);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | indent = indent.concat(" "); |
1,179,001 | public void propertyChange(java.beans.PropertyChangeEvent evt) {<NEW_LINE>if (ExplorerManager.PROP_SELECTED_NODES.equals(evt.getPropertyName())) {<NEW_LINE>final Node[] nodes = (Node[]) evt.getNewValue();<NEW_LINE>boolean res = nodes != null && nodes.length > 0;<NEW_LINE>int i = 0;<NEW_LINE>while (res && i < nodes.length) {<NEW_LINE>Node n = nodes[i++];<NEW_LINE>if (n instanceof CatalogNode && ((CatalogNode) n).isRemovable()) {<NEW_LINE>res = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>Object node = n.getCookie(CatalogEntryNode.class);<NEW_LINE>res = node instanceof CatalogEntryNode && ((<MASK><NEW_LINE>}<NEW_LINE>removeButton.setEnabled(res);<NEW_LINE>if (nodes.length > 0) {<NEW_LINE>Object node = nodes[0].getCookie(CatalogNode.class);<NEW_LINE>addLocalButton.setEnabled(node instanceof CatalogNode && ((CatalogNode) node).getCatalogReader() instanceof CatalogWriter);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | CatalogEntryNode) node).isCatalogWriter(); |
24,000 | public JSONObject toJsonObject(ClassDescriptor cd) throws Exception {<NEW_LINE>JSONObject jsonObject = new JSONObject();<NEW_LINE>jsonObject.put("name", cd.getName());<NEW_LINE>if (cd.getCondition() != null && cd.getCondition().getTypeReachable() != null) {<NEW_LINE>JSONObject conditionJsonObject = new JSONObject();<NEW_LINE>conditionJsonObject.put("typeReachable", cd.getCondition().getTypeReachable());<NEW_LINE>jsonObject.put("condition", conditionJsonObject);<NEW_LINE>}<NEW_LINE>Set<TypeAccess> accesses = cd.getAccess();<NEW_LINE>if (accesses != null) {<NEW_LINE>for (TypeAccess access : TypeAccess.values()) {<NEW_LINE>if (accesses.contains(access)) {<NEW_LINE>putTrueFlag(jsonObject, access.value());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List<FieldDescriptor> fds = cd.getFields();<NEW_LINE>if (fds != null) {<NEW_LINE>JSONArray fieldJsonArray = new JSONArray();<NEW_LINE>for (FieldDescriptor fd : fds) {<NEW_LINE>JSONObject fieldjo = new JSONObject();<NEW_LINE>fieldjo.put("name", fd.getName());<NEW_LINE>if (fd.isAllowWrite()) {<NEW_LINE>fieldjo.put("allowWrite", true);<NEW_LINE>}<NEW_LINE>if (fd.isAllowUnsafeAccess()) {<NEW_LINE>fieldjo.put("allowUnsafeAccess", true);<NEW_LINE>}<NEW_LINE>fieldJsonArray.put(fieldjo);<NEW_LINE>}<NEW_LINE>jsonObject.put("fields", fieldJsonArray);<NEW_LINE>}<NEW_LINE>List<MethodDescriptor> mds = cd.getMethods();<NEW_LINE>if (mds != null) {<NEW_LINE>JSONArray methodsJsonArray = new JSONArray();<NEW_LINE>for (MethodDescriptor md : mds) {<NEW_LINE>JSONObject methodJsonObject = new JSONObject();<NEW_LINE>methodJsonObject.put("name", md.getName());<NEW_LINE>List<String> parameterTypes = md.getParameterTypes();<NEW_LINE>JSONArray parameterArray = new JSONArray();<NEW_LINE>if (parameterTypes != null) {<NEW_LINE>for (String pt : parameterTypes) {<NEW_LINE>parameterArray.put(pt);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>methodJsonObject.put("parameterTypes", parameterArray);<NEW_LINE>methodsJsonArray.put(methodJsonObject);<NEW_LINE>}<NEW_LINE>jsonObject.put("methods", methodsJsonArray);<NEW_LINE>}<NEW_LINE>List<MethodDescriptor> qmds = cd.getQueriedMethods();<NEW_LINE>if (qmds != null) {<NEW_LINE>JSONArray methodsJsonArray = new JSONArray();<NEW_LINE>for (MethodDescriptor md : qmds) {<NEW_LINE>JSONObject methodJsonObject = new JSONObject();<NEW_LINE>methodJsonObject.put("name", md.getName());<NEW_LINE>List<String> parameterTypes = md.getParameterTypes();<NEW_LINE>JSONArray parameterArray = new JSONArray();<NEW_LINE>if (parameterTypes != null) {<NEW_LINE>for (String pt : parameterTypes) {<NEW_LINE>parameterArray.put(pt);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>methodJsonObject.put("parameterTypes", parameterArray);<NEW_LINE>methodsJsonArray.put(methodJsonObject);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>return jsonObject;<NEW_LINE>} | jsonObject.put("queriedMethods", methodsJsonArray); |
446,954 | TSpanEvent buildTSpanEvent(SpanEvent spanEvent) {<NEW_LINE>final TSpanEvent tSpanEvent = new TSpanEvent();<NEW_LINE>// if (spanEvent.getStartElapsed() != 0) {<NEW_LINE>// tSpanEvent.setStartElapsed(spanEvent.getStartElapsed());<NEW_LINE>// }<NEW_LINE>// tSpanEvent.setStartElapsed(spanEvent.getStartElapsed());<NEW_LINE>if (spanEvent.getElapsedTime() != 0) {<NEW_LINE>tSpanEvent.setEndElapsed(spanEvent.getElapsedTime());<NEW_LINE>}<NEW_LINE>tSpanEvent.setSequence((short) spanEvent.getSequence());<NEW_LINE>// tSpanEvent.setRpc(spanEvent.getRpc());<NEW_LINE>tSpanEvent.setServiceType(spanEvent.getServiceType());<NEW_LINE>tSpanEvent.setEndPoint(spanEvent.getEndPoint());<NEW_LINE>// tSpanEvent.setAnnotations();<NEW_LINE>if (spanEvent.getDepth() != -1) {<NEW_LINE>tSpanEvent.setDepth(spanEvent.getDepth());<NEW_LINE>}<NEW_LINE>if (spanEvent.getNextSpanId() != -1) {<NEW_LINE>tSpanEvent.setNextSpanId(spanEvent.getNextSpanId());<NEW_LINE>}<NEW_LINE>tSpanEvent.setDestinationId(spanEvent.getDestinationId());<NEW_LINE>tSpanEvent.setApiId(spanEvent.getApiId());<NEW_LINE>final IntStringValue exceptionInfo = spanEvent.getExceptionInfo();<NEW_LINE>if (exceptionInfo != null) {<NEW_LINE>TIntStringValue tIntStringValue = buildTIntStringValue(exceptionInfo);<NEW_LINE>tSpanEvent.setExceptionInfo(tIntStringValue);<NEW_LINE>}<NEW_LINE>final AsyncId asyncIdObject = spanEvent.getAsyncIdObject();<NEW_LINE>if (asyncIdObject != null) {<NEW_LINE>tSpanEvent.setNextAsyncId(asyncIdObject.getAsyncId());<NEW_LINE>}<NEW_LINE>final List<Annotation<?><MASK><NEW_LINE>if (CollectionUtils.hasLength(annotations)) {<NEW_LINE>final List<TAnnotation> tAnnotations = buildTAnnotation(annotations);<NEW_LINE>tSpanEvent.setAnnotations(tAnnotations);<NEW_LINE>}<NEW_LINE>return tSpanEvent;<NEW_LINE>} | > annotations = spanEvent.getAnnotations(); |
147,518 | private void performAndWritePutAll(@NotNull Map<? extends K, ? extends V> m) {<NEW_LINE>Excerpt excerpt = getExcerpt(m.size() * maxMessageSize, putAll);<NEW_LINE>long eventId = excerpt.index();<NEW_LINE>int pos = excerpt.position();<NEW_LINE>// place holder for the actual size.<NEW_LINE>excerpt.writeInt(0);<NEW_LINE>int count = 0;<NEW_LINE>for (int i = 0; i < listeners.size(); i++) {<NEW_LINE>MapListener<K, V> <MASK><NEW_LINE>listener.eventStart(eventId, name);<NEW_LINE>}<NEW_LINE>for (Entry<? extends K, ? extends V> entry : m.entrySet()) {<NEW_LINE>K key = entry.getKey();<NEW_LINE>V value = entry.getValue();<NEW_LINE>V previous = underlying.put(key, value);<NEW_LINE>if (sameOrNotEqual(previous, value)) {<NEW_LINE>writeKey(excerpt, key);<NEW_LINE>writeValue(excerpt, value);<NEW_LINE>for (int i = 0; i < listeners.size(); i++) {<NEW_LINE>MapListener<K, V> listener = listeners.get(i);<NEW_LINE>if (previous == null)<NEW_LINE>listener.add(key, value);<NEW_LINE>else<NEW_LINE>listener.update(key, previous, value);<NEW_LINE>}<NEW_LINE>count++;<NEW_LINE>}<NEW_LINE>for (int i = 0; i < listeners.size(); i++) {<NEW_LINE>MapListener<K, V> listener = listeners.get(i);<NEW_LINE>listener.eventEnd(true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>excerpt.writeInt(pos, count);<NEW_LINE>excerpt.finish();<NEW_LINE>} | listener = listeners.get(i); |
836,746 | public static void convolveBorder(GrayS32 integral, IntegralKernel kernel, GrayS32 output, int borderX, int borderY) {<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, integral.width, x -> {<NEW_LINE>for (int x = 0; x < integral.width; x++) {<NEW_LINE>for (int y = 0; y < borderY; y++) {<NEW_LINE>int total = 0;<NEW_LINE>for (int i = 0; i < kernel.blocks.length; i++) {<NEW_LINE>ImageRectangle <MASK><NEW_LINE>total += block_zero(integral, x + b.x0, y + b.y0, x + b.x1, y + b.y1) * kernel.scales[i];<NEW_LINE>}<NEW_LINE>output.set(x, y, total);<NEW_LINE>}<NEW_LINE>for (int y = integral.height - borderY; y < integral.height; y++) {<NEW_LINE>int total = 0;<NEW_LINE>for (int i = 0; i < kernel.blocks.length; i++) {<NEW_LINE>ImageRectangle b = kernel.blocks[i];<NEW_LINE>total += block_zero(integral, x + b.x0, y + b.y0, x + b.x1, y + b.y1) * kernel.scales[i];<NEW_LINE>}<NEW_LINE>output.set(x, y, total);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>int endY = integral.height - borderY;<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(borderY, endY, y -> {<NEW_LINE>for (int y = borderY; y < endY; y++) {<NEW_LINE>for (int x = 0; x < borderX; x++) {<NEW_LINE>int total = 0;<NEW_LINE>for (int i = 0; i < kernel.blocks.length; i++) {<NEW_LINE>ImageRectangle b = kernel.blocks[i];<NEW_LINE>total += block_zero(integral, x + b.x0, y + b.y0, x + b.x1, y + b.y1) * kernel.scales[i];<NEW_LINE>}<NEW_LINE>output.set(x, y, total);<NEW_LINE>}<NEW_LINE>for (int x = integral.width - borderX; x < integral.width; x++) {<NEW_LINE>int total = 0;<NEW_LINE>for (int i = 0; i < kernel.blocks.length; i++) {<NEW_LINE>ImageRectangle b = kernel.blocks[i];<NEW_LINE>total += block_zero(integral, x + b.x0, y + b.y0, x + b.x1, y + b.y1) * kernel.scales[i];<NEW_LINE>}<NEW_LINE>output.set(x, y, total);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} | b = kernel.blocks[i]; |
628,570 | public void run() {<NEW_LINE>if (zibase != null && eventPublisher != null) {<NEW_LINE>try {<NEW_LINE>// register to zibase for listening<NEW_LINE>zibase.hostRegistering(listenerHost, listenerPort);<NEW_LINE>// bind<NEW_LINE>DatagramSocket serverSocket = new DatagramSocket(listenerPort);<NEW_LINE>byte[] receiveData = new byte[470];<NEW_LINE>DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);<NEW_LINE>running = true;<NEW_LINE>// the real thread work is their : read message and analyse it to publish events on openhab bus<NEW_LINE>while (running) {<NEW_LINE>serverSocket.receive(receivePacket);<NEW_LINE>ZbResponse zbResponse = new ZbResponse(receivePacket.getData());<NEW_LINE>logger.debug("ZIBASE MESSAGE: {}", zbResponse.getMessage());<NEW_LINE>publishEvents(zbResponse);<NEW_LINE>// reset buffer<NEW_LINE>Arrays.fill(receivePacket.getData(), 0, receivePacket.getLength(), (byte) 0);<NEW_LINE>}<NEW_LINE>zibase.hostUnregistering(listenerHost, listenerPort);<NEW_LINE>serverSocket.close();<NEW_LINE>} catch (SocketException ex) {<NEW_LINE><MASK><NEW_LINE>} catch (UnknownHostException ex) {<NEW_LINE>logger.error("Given Zibase host not reachable : {}", ex);<NEW_LINE>} catch (IOException ex) {<NEW_LINE>logger.error("IO error reading Zibase socket : {}", ex);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>logger.error("Zibase not initialized. IP address may be wrong or not reachable !");<NEW_LINE>}<NEW_LINE>} | logger.error("Could not open socket to zibase : {}", ex); |
821,352 | private void loadNode984() {<NEW_LINE>BaseDataVariableTypeNode node = new BaseDataVariableTypeNode(this.context, Identifiers.SessionDiagnosticsObjectType_SessionDiagnostics_TranslateBrowsePathsToNodeIdsCount, new QualifiedName(0, "TranslateBrowsePathsToNodeIdsCount"), new LocalizedText("en", "TranslateBrowsePathsToNodeIdsCount"), LocalizedText.NULL_VALUE, UInteger.valueOf(0), UInteger.valueOf(0), new DataValue(Variant.NULL_VALUE), Identifiers.ServiceCounterDataType, -1, new UInteger[] {}, UByte.valueOf(1), UByte.valueOf(1), 0.0, false);<NEW_LINE>node.addReference(new Reference(Identifiers.SessionDiagnosticsObjectType_SessionDiagnostics_TranslateBrowsePathsToNodeIdsCount, Identifiers.HasTypeDefinition, Identifiers.BaseDataVariableType.expanded(), true));<NEW_LINE>node.addReference(new Reference(Identifiers.SessionDiagnosticsObjectType_SessionDiagnostics_TranslateBrowsePathsToNodeIdsCount, Identifiers.HasModellingRule, Identifiers.ModellingRule_Mandatory<MASK><NEW_LINE>node.addReference(new Reference(Identifiers.SessionDiagnosticsObjectType_SessionDiagnostics_TranslateBrowsePathsToNodeIdsCount, Identifiers.HasComponent, Identifiers.SessionDiagnosticsObjectType_SessionDiagnostics.expanded(), false));<NEW_LINE>this.nodeManager.addNode(node);<NEW_LINE>} | .expanded(), true)); |
1,354,297 | private static Future<Void> postUserTask(final Source src, final UserTask task, final AtomicReference<Throwable> status) {<NEW_LINE>boolean retry = false;<NEW_LINE><MASK><NEW_LINE>boolean mode = b == null || b.booleanValue();<NEW_LINE>try {<NEW_LINE>retryGuard.set(mode);<NEW_LINE>ParserManager.parse(Collections.singleton(src), task);<NEW_LINE>} catch (ParseException ex) {<NEW_LINE>status.set(ex);<NEW_LINE>} catch (RetryWhenScanFinished e) {<NEW_LINE>// expected, will retry in runWhenParseFinished<NEW_LINE>retry = true;<NEW_LINE>} finally {<NEW_LINE>if (b == null) {<NEW_LINE>retryGuard.remove();<NEW_LINE>} else {<NEW_LINE>retryGuard.set(b);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!retry) {<NEW_LINE>return new FinishedFuture();<NEW_LINE>}<NEW_LINE>final TaskWrapper wrapper;<NEW_LINE>Future<Void> handle;<NEW_LINE>wrapper = new TaskWrapper(task, status, mode);<NEW_LINE>try {<NEW_LINE>handle = ParserManager.parseWhenScanFinished(Collections.singletonList(src), wrapper);<NEW_LINE>} catch (ParseException ex) {<NEW_LINE>status.set(ex);<NEW_LINE>handle = new FinishedFuture();<NEW_LINE>}<NEW_LINE>return handle;<NEW_LINE>} | Boolean b = retryGuard.get(); |
558,296 | public PathAttributes toAttributes(final StorageObject object) {<NEW_LINE>final PathAttributes attributes = new PathAttributes();<NEW_LINE>if (StringUtils.isNotBlank(object.getMd5sum())) {<NEW_LINE>// For manifest files, the ETag in the response for a GET or HEAD on the manifest file is the MD5 sum of<NEW_LINE>// the concatenated string of ETags for each of the segments in the manifest.<NEW_LINE>attributes.setChecksum(Checksum.parse(object.getMd5sum()));<NEW_LINE>}<NEW_LINE>attributes.setSize(object.getSize());<NEW_LINE>final String lastModified = object.getLastModified();<NEW_LINE>if (lastModified != null) {<NEW_LINE>try {<NEW_LINE>attributes.setModificationDate(iso8601DateParser.parse(lastModified).getTime());<NEW_LINE>} catch (InvalidDateException e) {<NEW_LINE>log.warn(String.format("%s is not ISO 8601 format %s", lastModified<MASK><NEW_LINE>try {<NEW_LINE>attributes.setModificationDate(rfc1123DateFormatter.parse(lastModified).getTime());<NEW_LINE>} catch (InvalidDateException f) {<NEW_LINE>log.warn(String.format("%s is not RFC 1123 format %s", lastModified, f.getMessage()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return attributes;<NEW_LINE>} | , e.getMessage())); |
1,143,937 | public ResultStatus modifyTopic(Long clusterId, String topicName, String description, String operator) {<NEW_LINE>try {<NEW_LINE>if (!PhysicalClusterMetadataManager.isTopicExist(clusterId, topicName)) {<NEW_LINE>return ResultStatus.TOPIC_NOT_EXIST;<NEW_LINE>}<NEW_LINE>TopicDO topicDO = <MASK><NEW_LINE>if (ValidateUtils.isNull(topicDO)) {<NEW_LINE>return ResultStatus.TOPIC_NOT_EXIST;<NEW_LINE>}<NEW_LINE>Map<String, Object> content = new HashMap<>(2);<NEW_LINE>content.put("clusterId", clusterId);<NEW_LINE>content.put("topicName", topicName);<NEW_LINE>recordOperation(content, topicName, operator);<NEW_LINE>topicDO.setDescription(description);<NEW_LINE>if (topicDao.updateByName(topicDO) > 0) {<NEW_LINE>return ResultStatus.SUCCESS;<NEW_LINE>}<NEW_LINE>return ResultStatus.MYSQL_ERROR;<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error("modify topic failed, clusterId:{} topicName:{} description:{} operator:{} ", clusterId, topicName, description, operator, e);<NEW_LINE>}<NEW_LINE>return ResultStatus.MYSQL_ERROR;<NEW_LINE>} | topicDao.getByTopicName(clusterId, topicName); |
1,655,473 | private static NBTTagCompound migrate(ItemStack stack, NBTTagCompound nbt) {<NEW_LINE>Block block = null, blockAlt = null;<NEW_LINE>int metadata = 0, metadataAlt;<NEW_LINE>PipeWire wire = null;<NEW_LINE>if (nbt.hasKey("id"))<NEW_LINE>block = Block.REGISTRY.getObjectById(nbt.getInteger("id"));<NEW_LINE>else if (nbt.hasKey("name"))<NEW_LINE>block = Block.REGISTRY.getObject(new ResourceLocation(nbt.getString("name")));<NEW_LINE>if (nbt.hasKey("name_alt"))<NEW_LINE>blockAlt = Block.REGISTRY.getObject(new ResourceLocation(nbt.getString("name_alt")));<NEW_LINE>if (nbt.hasKey("meta"))<NEW_LINE><MASK><NEW_LINE>if (nbt.hasKey("meta_alt"))<NEW_LINE>metadataAlt = nbt.getInteger("meta_alt");<NEW_LINE>else<NEW_LINE>metadataAlt = stack.getItemDamage() & 0x0000F;<NEW_LINE>if (nbt.hasKey("wire"))<NEW_LINE>wire = PipeWire.fromOrdinal(nbt.getInteger("wire"));<NEW_LINE>if (block != null) {<NEW_LINE>FacadeState[] states;<NEW_LINE>FacadeState mainState = FacadeState.create(block.getStateFromMeta(metadata));<NEW_LINE>if (blockAlt != null && wire != null) {<NEW_LINE>FacadeState altState = FacadeState.create(blockAlt.getStateFromMeta(metadataAlt), wire);<NEW_LINE>states = new FacadeState[] { mainState, altState };<NEW_LINE>} else {<NEW_LINE>states = new FacadeState[] { mainState };<NEW_LINE>}<NEW_LINE>NBTTagCompound newNbt = getFacade(states).getTagCompound();<NEW_LINE>stack.setTagCompound(newNbt);<NEW_LINE>return newNbt;<NEW_LINE>}<NEW_LINE>return nbt;<NEW_LINE>} | metadata = nbt.getInteger("meta"); |
1,270,716 | protected void encodeListLayout(FacesContext context, DataView dataview) throws IOException {<NEW_LINE>DataViewListItem list = dataview.getListItem();<NEW_LINE>if (list != null) {<NEW_LINE>ResponseWriter writer = context.getResponseWriter();<NEW_LINE>int first = dataview.getFirst();<NEW_LINE>int rows = dataview.getRows() == 0 ? dataview.getRowCount() : dataview.getRows();<NEW_LINE>int pageSize = first + rows;<NEW_LINE>writer.startElement("ul", null);<NEW_LINE>writer.writeAttribute("class", DataView.LIST_LAYOUT_CONTAINER_CLASS, null);<NEW_LINE>for (int i = first; i < pageSize; i++) {<NEW_LINE>dataview.setRowIndex(i);<NEW_LINE>if (!dataview.isRowAvailable()) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>writer.writeAttribute("class", DataView.ROW_CLASS, null);<NEW_LINE>dataview.setRowIndex(i);<NEW_LINE>if (dataview.isRowAvailable()) {<NEW_LINE>renderChildren(context, list);<NEW_LINE>}<NEW_LINE>writer.endElement("li");<NEW_LINE>}<NEW_LINE>writer.endElement("ul");<NEW_LINE>// cleanup<NEW_LINE>dataview.setRowIndex(-1);<NEW_LINE>}<NEW_LINE>} | writer.startElement("li", null); |
982,709 | // Visible for testing<NEW_LINE>static SpanExporter configureOtlp(ConfigProperties config, MeterProvider meterProvider) {<NEW_LINE>String protocol = OtlpConfigUtil.getOtlpProtocol(DATA_TYPE_TRACES, config);<NEW_LINE>if (protocol.equals(PROTOCOL_HTTP_PROTOBUF)) {<NEW_LINE>ClasspathUtil.<MASK><NEW_LINE>OtlpHttpSpanExporterBuilder builder = OtlpHttpSpanExporter.builder();<NEW_LINE>OtlpConfigUtil.configureOtlpExporterBuilder(DATA_TYPE_TRACES, config, builder::setEndpoint, builder::addHeader, builder::setCompression, builder::setTimeout, builder::setTrustedCertificates, builder::setClientTls, retryPolicy -> RetryUtil.setRetryPolicyOnDelegate(builder, retryPolicy));<NEW_LINE>builder.setMeterProvider(meterProvider);<NEW_LINE>return builder.build();<NEW_LINE>} else if (protocol.equals(PROTOCOL_GRPC)) {<NEW_LINE>ClasspathUtil.checkClassExists("io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter", "OTLP gRPC Trace Exporter", "opentelemetry-exporter-otlp");<NEW_LINE>OtlpGrpcSpanExporterBuilder builder = OtlpGrpcSpanExporter.builder();<NEW_LINE>OtlpConfigUtil.configureOtlpExporterBuilder(DATA_TYPE_TRACES, config, builder::setEndpoint, builder::addHeader, builder::setCompression, builder::setTimeout, builder::setTrustedCertificates, builder::setClientTls, retryPolicy -> RetryUtil.setRetryPolicyOnDelegate(builder, retryPolicy));<NEW_LINE>builder.setMeterProvider(meterProvider);<NEW_LINE>return builder.build();<NEW_LINE>} else {<NEW_LINE>throw new ConfigurationException("Unsupported OTLP traces protocol: " + protocol);<NEW_LINE>}<NEW_LINE>} | checkClassExists("io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporter", "OTLP HTTP Trace Exporter", "opentelemetry-exporter-otlp-http-trace"); |
446,974 | private Instant truncateAsLocalTime(Instant instant, final ZoneRules rules) {<NEW_LINE>assert unitRoundsToMidnight == false : "truncateAsLocalTime should not be called if unitRoundsToMidnight";<NEW_LINE>LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, timeZone);<NEW_LINE>final LocalDateTime truncatedLocalDateTime = truncateLocalDateTime(localDateTime);<NEW_LINE>final List<ZoneOffset> currentOffsets = rules.getValidOffsets(truncatedLocalDateTime);<NEW_LINE>if (currentOffsets.isEmpty() == false) {<NEW_LINE>// at least one possibilities - choose the latest one that's still no later than the input time<NEW_LINE>for (int offsetIndex = currentOffsets.size() - 1; offsetIndex >= 0; offsetIndex--) {<NEW_LINE>final Instant result = truncatedLocalDateTime.atOffset(currentOffsets.get<MASK><NEW_LINE>if (result.isAfter(instant) == false) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>assert false : "rounded time not found for " + instant + " with " + this;<NEW_LINE>return null;<NEW_LINE>} else {<NEW_LINE>// The chosen local time didn't happen. This means we were given a time in an hour (or a minute) whose start<NEW_LINE>// is missing due to an offset transition, so the time cannot be truncated.<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | (offsetIndex)).toInstant(); |
1,082,873 | public static void horizontal11(Kernel1D_S32 kernel, GrayS16 input, GrayI16 output, int skip) {<NEW_LINE>final short[] dataSrc = input.data;<NEW_LINE>final short[] dataDst = output.data;<NEW_LINE>final int k1 = kernel.data[0];<NEW_LINE>final int k2 = kernel.data[1];<NEW_LINE>final int k3 = kernel.data[2];<NEW_LINE>final int k4 = kernel.data[3];<NEW_LINE>final int <MASK><NEW_LINE>final int k6 = kernel.data[5];<NEW_LINE>final int k7 = kernel.data[6];<NEW_LINE>final int k8 = kernel.data[7];<NEW_LINE>final int k9 = kernel.data[8];<NEW_LINE>final int k10 = kernel.data[9];<NEW_LINE>final int k11 = kernel.data[10];<NEW_LINE>final int radius = kernel.getRadius();<NEW_LINE>final int widthEnd = UtilDownConvolve.computeMaxSide(input.width, skip, radius);<NEW_LINE>final int height = input.getHeight();<NEW_LINE>final int offsetX = UtilDownConvolve.computeOffset(skip, radius);<NEW_LINE>for (int i = 0; i < height; i++) {<NEW_LINE>int indexDst = output.startIndex + i * output.stride + offsetX / skip;<NEW_LINE>int j = input.startIndex + i * input.stride - radius;<NEW_LINE>final int jEnd = j + widthEnd;<NEW_LINE>for (j += offsetX; j <= jEnd; j += skip) {<NEW_LINE>int indexSrc = j;<NEW_LINE>int total = (dataSrc[indexSrc++]) * k1;<NEW_LINE>total += (dataSrc[indexSrc++]) * k2;<NEW_LINE>total += (dataSrc[indexSrc++]) * k3;<NEW_LINE>total += (dataSrc[indexSrc++]) * k4;<NEW_LINE>total += (dataSrc[indexSrc++]) * k5;<NEW_LINE>total += (dataSrc[indexSrc++]) * k6;<NEW_LINE>total += (dataSrc[indexSrc++]) * k7;<NEW_LINE>total += (dataSrc[indexSrc++]) * k8;<NEW_LINE>total += (dataSrc[indexSrc++]) * k9;<NEW_LINE>total += (dataSrc[indexSrc++]) * k10;<NEW_LINE>total += (dataSrc[indexSrc]) * k11;<NEW_LINE>dataDst[indexDst++] = (short) total;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | k5 = kernel.data[4]; |
1,021,990 | public OcamlLibrary createBuildRule(BuildRuleCreationContextWithTargetGraph context, BuildTarget buildTarget, BuildRuleParams params, PrebuiltOcamlLibraryDescriptionArg args) {<NEW_LINE>boolean bytecodeOnly = args.getBytecodeOnly();<NEW_LINE>String libDir = args.getLibDir();<NEW_LINE>String nativeLib = args.getNativeLib();<NEW_LINE>String bytecodeLib = args.getBytecodeLib();<NEW_LINE>ImmutableList<String> cLibs = args.getCLibs();<NEW_LINE>ImmutableList<String> nativeCLibs = args.getNativeCLibs();<NEW_LINE>ImmutableList<String> bytecodeCLibs = args.getBytecodeCLibs();<NEW_LINE>Path libPath = buildTarget.getCellRelativeBasePath().getPath().toPath(context.getProjectFilesystem().getFileSystem()).resolve(libDir);<NEW_LINE>Path includeDir = libPath.resolve(args.getIncludeDir());<NEW_LINE>ProjectFilesystem projectFilesystem = context.getProjectFilesystem();<NEW_LINE>Optional<SourcePath> staticNativeLibraryPath = bytecodeOnly ? Optional.empty() : Optional.of(PathSourcePath.of(projectFilesystem, libPath.resolve(nativeLib)));<NEW_LINE>SourcePath staticBytecodeLibraryPath = PathSourcePath.of(projectFilesystem, libPath.resolve(bytecodeLib));<NEW_LINE>ImmutableList<SourcePath> staticCLibraryPaths = cLibs.stream().map(input -> PathSourcePath.of(projectFilesystem, libPath.resolve(input))).collect(ImmutableList.toImmutableList());<NEW_LINE>ImmutableList<SourcePath> staticNativeCLibraryPaths = nativeCLibs.stream().map(input -> PathSourcePath.of(projectFilesystem, libPath.resolve(input))).<MASK><NEW_LINE>ImmutableList<SourcePath> staticBytecodeCLibraryPaths = bytecodeCLibs.stream().map(input -> PathSourcePath.of(projectFilesystem, libPath.resolve(input))).collect(ImmutableList.toImmutableList());<NEW_LINE>SourcePath bytecodeLibraryPath = PathSourcePath.of(projectFilesystem, libPath.resolve(bytecodeLib));<NEW_LINE>CxxDeps allDeps = CxxDeps.builder().addDeps(args.getDeps()).addPlatformDeps(args.getPlatformDeps()).build();<NEW_LINE>return new PrebuiltOcamlLibrary(buildTarget, projectFilesystem, params, context.getActionGraphBuilder(), staticNativeLibraryPath, staticBytecodeLibraryPath, staticCLibraryPaths, staticNativeCLibraryPaths, staticBytecodeCLibraryPaths, bytecodeLibraryPath, libPath, includeDir, allDeps);<NEW_LINE>} | collect(ImmutableList.toImmutableList()); |
1,025,612 | public void process(double[] input, double[] output) {<NEW_LINE>decodeParameters(input, cameras, planeAtInfinity);<NEW_LINE>// Compute the Q matrix,<NEW_LINE>encodeQ(cameras.get(viewToCamera.get(0)), planeAtInfinity.x, planeAtInfinity.<MASK><NEW_LINE>int indexOutput = 0;<NEW_LINE>for (int projectiveIdx = 0; projectiveIdx < projectiveCameras.size; projectiveIdx++) {<NEW_LINE>int cameraIndex = viewToCamera.get(projectiveIdx);<NEW_LINE>encodeKK(cameras.get(cameraIndex), KK);<NEW_LINE>DMatrixRMaj P = projectiveCameras.get(projectiveIdx);<NEW_LINE>CommonOps_DDRM.mult(P, Q, PQ);<NEW_LINE>CommonOps_DDRM.multTransB(PQ, P, PQP);<NEW_LINE>// Resolve scale ambiguity by normalizing the matrices<NEW_LINE>CommonOps_DDRM.divide(PQP, NormOps_DDRM.normPInf(PQP));<NEW_LINE>CommonOps_DDRM.divide(KK, NormOps_DDRM.normPInf(KK));<NEW_LINE>// Compute residuals. off diagonal elements are multiply by two since the matrix is symmetric<NEW_LINE>// (0,0)<NEW_LINE>output[indexOutput++] = KK.data[0] - PQP.data[0];<NEW_LINE>// (0,1)<NEW_LINE>output[indexOutput++] = 2.0 * (KK.data[1] - PQP.data[1]);<NEW_LINE>// (0,2)<NEW_LINE>output[indexOutput++] = 2.0 * (KK.data[2] - PQP.data[2]);<NEW_LINE>// (1,1)<NEW_LINE>output[indexOutput++] = KK.data[4] - PQP.data[4];<NEW_LINE>// (1,2)<NEW_LINE>output[indexOutput++] = 2.0 * (KK.data[5] - PQP.data[5]);<NEW_LINE>// (2,2)<NEW_LINE>output[indexOutput++] = KK.data[8] - PQP.data[8];<NEW_LINE>}<NEW_LINE>} | y, planeAtInfinity.z, Q); |
1,133,557 | void canvassPosition(final ExclusivePublication publication, final long logLeadershipTermId, final long logPosition, final long leadershipTermId, final int followerMemberId) {<NEW_LINE>if (null == publication) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final int length = MessageHeaderEncoder.ENCODED_LENGTH + CanvassPositionEncoder.BLOCK_LENGTH;<NEW_LINE>int attempts = SEND_ATTEMPTS;<NEW_LINE>do {<NEW_LINE>final long result = publication.tryClaim(length, bufferClaim);<NEW_LINE>if (result > 0) {<NEW_LINE>canvassPositionEncoder.wrapAndApplyHeader(bufferClaim.buffer(), bufferClaim.offset(), messageHeaderEncoder).logLeadershipTermId(logLeadershipTermId).logPosition(logPosition).leadershipTermId(leadershipTermId).followerMemberId(followerMemberId);<NEW_LINE>bufferClaim.commit();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>checkResult(result);<NEW_LINE><MASK><NEW_LINE>} | } while (--attempts > 0); |
1,810,040 | public void testQuartzJobInitializesWithAppComponentContext() throws Exception {<NEW_LINE>//<NEW_LINE>JobDetail //<NEW_LINE>job = //<NEW_LINE>JobBuilder.newJob(LookupOnInitJob.class).//<NEW_LINE>withIdentity("testQuartzJobInitializesWithAppComponentContext-job").build();<NEW_LINE>//<NEW_LINE>Trigger //<NEW_LINE>onceAfter300ms = //<NEW_LINE>TriggerBuilder.newTrigger().//<NEW_LINE>startAt(//<NEW_LINE>new Date(System.currentTimeMillis() + 300)).//<NEW_LINE>withSchedule(//<NEW_LINE>SimpleScheduleBuilder.simpleSchedule().withRepeatCount(0)).//<NEW_LINE>withIdentity("testQuartzJobInitializesWithAppComponentContext-300ms-trigger").build();<NEW_LINE>JobTracker listener = new JobTracker("testQuartzJobInitializesWithAppComponentContext-listener");<NEW_LINE>scheduler.getListenerManager().addJobListener(listener, KeyMatcher.keyEquals<MASK><NEW_LINE>try {<NEW_LINE>scheduler.scheduleJob(job, onceAfter300ms);<NEW_LINE>Object[] results = (Object[]) listener.awaitResult(TIMEOUT_NS, TimeUnit.NANOSECONDS);<NEW_LINE>assertNotNull(results);<NEW_LINE>assertNotNull(results[0]);<NEW_LINE>assertNotNull(results[1]);<NEW_LINE>} finally {<NEW_LINE>scheduler.getListenerManager().removeJobListener(listener.name);<NEW_LINE>}<NEW_LINE>} | (job.getKey())); |
1,743,155 | private static void multipartUpload(String bucketName, String key) throws IOException {<NEW_LINE>int mB = 1024 * 1024;<NEW_LINE>// snippet-start:[s3.java2.s3_object_operations.upload_multi_part]<NEW_LINE>// First create a multipart upload and get the upload id<NEW_LINE>CreateMultipartUploadRequest createMultipartUploadRequest = CreateMultipartUploadRequest.builder().bucket(bucketName).key(key).build();<NEW_LINE>CreateMultipartUploadResponse <MASK><NEW_LINE>String uploadId = response.uploadId();<NEW_LINE>System.out.println(uploadId);<NEW_LINE>// Upload all the different parts of the object<NEW_LINE>UploadPartRequest uploadPartRequest1 = UploadPartRequest.builder().bucket(bucketName).key(key).uploadId(uploadId).partNumber(1).build();<NEW_LINE>String etag1 = s3.uploadPart(uploadPartRequest1, RequestBody.fromByteBuffer(getRandomByteBuffer(5 * mB))).eTag();<NEW_LINE>CompletedPart part1 = CompletedPart.builder().partNumber(1).eTag(etag1).build();<NEW_LINE>UploadPartRequest uploadPartRequest2 = UploadPartRequest.builder().bucket(bucketName).key(key).uploadId(uploadId).partNumber(2).build();<NEW_LINE>String etag2 = s3.uploadPart(uploadPartRequest2, RequestBody.fromByteBuffer(getRandomByteBuffer(3 * mB))).eTag();<NEW_LINE>CompletedPart part2 = CompletedPart.builder().partNumber(2).eTag(etag2).build();<NEW_LINE>// Finally call completeMultipartUpload operation to tell S3 to merge all uploaded<NEW_LINE>// parts and finish the multipart operation.<NEW_LINE>CompletedMultipartUpload completedMultipartUpload = CompletedMultipartUpload.builder().parts(part1, part2).build();<NEW_LINE>CompleteMultipartUploadRequest completeMultipartUploadRequest = CompleteMultipartUploadRequest.builder().bucket(bucketName).key(key).uploadId(uploadId).multipartUpload(completedMultipartUpload).build();<NEW_LINE>s3.completeMultipartUpload(completeMultipartUploadRequest);<NEW_LINE>// snippet-end:[s3.java2.s3_object_operations.upload_multi_part]<NEW_LINE>} | response = s3.createMultipartUpload(createMultipartUploadRequest); |
866,945 | private GraphObject handleCreateAction(final ActionContext actionContext, final java.util.Map<String, java.lang.Object> parameters, final EventContext eventContext) throws FrameworkException {<NEW_LINE>final SecurityContext securityContext = actionContext.getSecurityContext();<NEW_LINE>// create new object of type?<NEW_LINE>final String targetType = (String) parameters.get("structrTarget");<NEW_LINE>if (targetType == null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>// resolve target type<NEW_LINE>Class type = StructrApp.getConfiguration().getNodeEntityClass(targetType);<NEW_LINE>if (type == null) {<NEW_LINE>type = StructrApp.getConfiguration().getRelationshipEntityClass(targetType);<NEW_LINE>}<NEW_LINE>if (type == null) {<NEW_LINE>throw new FrameworkException(422, "Cannot execute create action with target type " + targetType + ", type does not exist.");<NEW_LINE>}<NEW_LINE>// remove internal keys<NEW_LINE>parameters.remove("structrTarget");<NEW_LINE>parameters.remove("htmlEvent");<NEW_LINE>// convert input<NEW_LINE>final PropertyMap properties = PropertyMap.inputTypeToJavaType(securityContext, type, parameters);<NEW_LINE>// create entity<NEW_LINE>return StructrApp.getInstance(securityContext).create(type, properties);<NEW_LINE>} | throw new FrameworkException(422, "Cannot execute create action without target type (data-structr-target attribute)."); |
1,407,966 | public TableExportResult storeResults(TableExport tableExport, Observable<String> result) {<NEW_LINE>log.debug("store TableExportResults for Download");<NEW_LINE>String extension = this.isExtensionEnabled() ? tableExport.getResultType().getFileExtensionType().getExtension() : FileExtensionType.NONE.getExtension();<NEW_LINE>TableExportResult exportResult = new TableExportResult();<NEW_LINE>try (BufferedWriter writer = getWriter(tableExport.getId(), extension)) {<NEW_LINE>result.map(record -> record.concat(System.lineSeparator())).subscribe(recordCharArray -> {<NEW_LINE>writer.write(recordCharArray);<NEW_LINE>writer.flush();<NEW_LINE>}, throwable -> {<NEW_LINE>StringBuilder message = new StringBuilder();<NEW_LINE>message.append(throwable.getClass().getCanonicalName()).append(" : ");<NEW_LINE>message.append(throwable.getMessage());<NEW_LINE>exportResult.<MASK><NEW_LINE>throw new IllegalStateException(STORE_ERROR, throwable);<NEW_LINE>}, writer::flush);<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new IllegalStateException(STORE_ERROR, e);<NEW_LINE>}<NEW_LINE>return exportResult;<NEW_LINE>} | setMessage(message.toString()); |
1,387,584 | public static void inverseN(WaveletDescription<WlCoef_I32> desc, GrayS32 input, GrayS32 output, GrayS32 storage, int numLevels, int minValue, int maxValue) {<NEW_LINE>if (numLevels == 1) {<NEW_LINE>inverse1(desc, input, output, storage, minValue, maxValue);<NEW_LINE>PixelMath.boundImage(output, minValue, maxValue);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>UtilWavelet.checkShape(desc.getForward(), output, input, numLevels);<NEW_LINE>storage = InputSanityCheck.declareOrReshape(input, storage);<NEW_LINE>// modify the shape of a temporary image not the original<NEW_LINE>storage = storage.subimage(0, 0, input.width, input.height, null);<NEW_LINE>storage.subImage = false;<NEW_LINE>int width, height;<NEW_LINE>int scale = UtilWavelet.computeScale(numLevels);<NEW_LINE>width = input.width / scale;<NEW_LINE>height = input.height / scale;<NEW_LINE>width += width % 2;<NEW_LINE>height += height % 2;<NEW_LINE>GrayS32 levelIn = input.subimage(0, 0, width, height, null);<NEW_LINE>GrayS32 levelOut = output.subimage(0, 0, width, height, null);<NEW_LINE><MASK><NEW_LINE>inverse1(desc, levelIn, levelOut, storage, Integer.MIN_VALUE, Integer.MAX_VALUE);<NEW_LINE>for (int i = numLevels - 1; i >= 1; i--) {<NEW_LINE>// copy the decoded segment into the input<NEW_LINE>levelIn.setTo(levelOut);<NEW_LINE>if (i > 1) {<NEW_LINE>scale /= 2;<NEW_LINE>width = input.width / scale;<NEW_LINE>height = input.height / scale;<NEW_LINE>width += width % 2;<NEW_LINE>height += height % 2;<NEW_LINE>storage.reshape(width, height);<NEW_LINE>levelIn = input.subimage(0, 0, width, height, null);<NEW_LINE>levelOut = output.subimage(0, 0, width, height, null);<NEW_LINE>} else {<NEW_LINE>levelIn = input;<NEW_LINE>levelOut = output;<NEW_LINE>}<NEW_LINE>storage.reshape(levelIn.width, levelIn.height);<NEW_LINE>inverse1(desc, levelIn, levelOut, storage, Integer.MIN_VALUE, Integer.MAX_VALUE);<NEW_LINE>}<NEW_LINE>if (minValue != Integer.MIN_VALUE && maxValue != Integer.MAX_VALUE)<NEW_LINE>PixelMath.boundImage(output, minValue, maxValue);<NEW_LINE>} | storage.reshape(width, height); |
1,726,390 | private void inlineArguments() {<NEW_LINE>int valueType = type.getValueType();<NEW_LINE>int l = args.length;<NEW_LINE>int count = l;<NEW_LINE>for (int i = 0; i < l; i++) {<NEW_LINE>Expression arg = args[i];<NEW_LINE>if (arg instanceof ConcatenationOperation && arg.getType().getValueType() == valueType) {<NEW_LINE>count += arg.getSubexpressionCount() - 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (count > l) {<NEW_LINE>Expression[] newArguments = new Expression[count];<NEW_LINE>for (int i = 0, offset = 0; i < l; i++) {<NEW_LINE>Expression arg = args[i];<NEW_LINE>if (arg instanceof ConcatenationOperation && arg.getType().getValueType() == valueType) {<NEW_LINE>ConcatenationOperation c = (ConcatenationOperation) arg;<NEW_LINE>Expression[] innerArgs = c.args;<NEW_LINE>int innerLength = innerArgs.length;<NEW_LINE>System.arraycopy(innerArgs, <MASK><NEW_LINE>offset += innerLength;<NEW_LINE>} else {<NEW_LINE>newArguments[offset++] = arg;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>args = newArguments;<NEW_LINE>argsCount = count;<NEW_LINE>}<NEW_LINE>} | 0, newArguments, offset, innerLength); |
46,005 | private static void refreshNavigatorInternal(IViewPart viewPart, Object element, Object selection) {<NEW_LINE>if (viewPart == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (viewPart instanceof CommonNavigator) {<NEW_LINE>CommonViewer viewer = ((CommonNavigator) viewPart).getCommonViewer();<NEW_LINE>if (element == null) {<NEW_LINE>// full refresh<NEW_LINE>// $NON-NLS-1$ // $codepro.audit.disable debuggingCode<NEW_LINE>System.err.println("FIXME: full refresh for " + viewer.<MASK><NEW_LINE>viewer.refresh();<NEW_LINE>} else {<NEW_LINE>Widget widget = viewer.testFindItem(element);<NEW_LINE>if (widget != null) {<NEW_LINE>Object data = widget.getData();<NEW_LINE>if (data != null) {<NEW_LINE>viewer.refresh(data);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (selection != null && viewPart instanceof CommonNavigator) {<NEW_LINE>// ensures the category's new content are loaded<NEW_LINE>CommonViewer viewer = ((CommonNavigator) viewPart).getCommonViewer();<NEW_LINE>viewer.expandToLevel(element, 1);<NEW_LINE>viewer.setSelection(new StructuredSelection(selection));<NEW_LINE>}<NEW_LINE>} | getClass().getSimpleName()); |
1,507,175 | final protected void configureScramSha(SecurityProtocol securityProtocol) {<NEW_LINE>if (this.getUserName() == null || this.getUserName().isEmpty()) {<NEW_LINE>throw new InvalidParameterException("User name for SCRAM-SHA is not set");<NEW_LINE>}<NEW_LINE>final String saslJaasConfigEncrypted = ResourceManager.kubeClient().getSecret(this.getNamespaceName(), this.getUserName()).<MASK><NEW_LINE>final String saslJaasConfigDecrypted = new String(Base64.getDecoder().decode(saslJaasConfigEncrypted), StandardCharsets.US_ASCII);<NEW_LINE>this.setAdditionalConfig(// scram-sha<NEW_LINE>this.getAdditionalConfig() + "ssl.endpoint.identification.algorithm=\n" + "sasl.mechanism=SCRAM-SHA-512\n" + "security.protocol=" + securityProtocol + "\n" + "sasl.jaas.config=" + saslJaasConfigDecrypted);<NEW_LINE>} | getData().get("sasl.jaas.config"); |
974,801 | private void removeLockKey() {<NEW_LINE>if (RedisLockRegistry.this.unlinkAvailable) {<NEW_LINE>try {<NEW_LINE>RedisLockRegistry.this.redisTemplate.execute(RedisLockRegistry.this.unLinkUnLockScript, Collections.singletonList(this.lockKey), RedisLockRegistry.this.unLockChannelKey);<NEW_LINE>return;<NEW_LINE>} catch (Exception ex) {<NEW_LINE>RedisLockRegistry.this.unlinkAvailable = false;<NEW_LINE>if (LOGGER.isDebugEnabled()) {<NEW_LINE>LOGGER.debug("The UNLINK command has failed (not supported on the Redis server?); " + "falling back to the regular DELETE command", ex);<NEW_LINE>} else {<NEW_LINE>LOGGER.warn("The UNLINK command has failed (not supported on the Redis server?); " + <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>RedisLockRegistry.this.redisTemplate.execute(RedisLockRegistry.this.deleteUnLockScript, Collections.singletonList(this.lockKey), RedisLockRegistry.this.unLockChannelKey);<NEW_LINE>} | "falling back to the regular DELETE command: " + ex.getMessage()); |
1,641,100 | private void applyAssumeRole(ServerSideEncryptingAmazonS3.Builder s3ClientBuilder, S3InputSourceConfig s3InputSourceConfig, AWSCredentialsProvider awsCredentialsProvider) {<NEW_LINE>String assumeRoleArn = s3InputSourceConfig.getAssumeRoleArn();<NEW_LINE>if (assumeRoleArn != null) {<NEW_LINE>String roleSessionName = StringUtils.format("druid-s3-input-source-%s", UUID.randomUUID().toString());<NEW_LINE>AWSSecurityTokenService securityTokenService = AWSSecurityTokenServiceClientBuilder.standard().withCredentials(awsCredentialsProvider).build();<NEW_LINE>STSAssumeRoleSessionCredentialsProvider.Builder roleCredentialsProviderBuilder;<NEW_LINE>roleCredentialsProviderBuilder = new STSAssumeRoleSessionCredentialsProvider.Builder(assumeRoleArn, roleSessionName).withStsClient(securityTokenService);<NEW_LINE>if (s3InputSourceConfig.getAssumeRoleExternalId() != null) {<NEW_LINE>roleCredentialsProviderBuilder.withExternalId(s3InputSourceConfig.getAssumeRoleExternalId());<NEW_LINE>}<NEW_LINE>s3ClientBuilder.getAmazonS3ClientBuilder().<MASK><NEW_LINE>}<NEW_LINE>} | withCredentials(roleCredentialsProviderBuilder.build()); |
1,615,825 | private static boolean optionMatches(BuildOptionDetails options, String optionName, Object expectedValue) {<NEW_LINE>Object actualValue = options.getOptionValue(optionName);<NEW_LINE>if (actualValue == null) {<NEW_LINE>return expectedValue == null;<NEW_LINE>// Single-value case:<NEW_LINE>} else if (!options.allowsMultipleValues(optionName)) {<NEW_LINE>return actualValue.equals(expectedValue);<NEW_LINE>}<NEW_LINE>// Multi-value case:<NEW_LINE>Preconditions.checkState(actualValue instanceof List);<NEW_LINE>Preconditions.checkState(expectedValue instanceof List);<NEW_LINE>List<?> actualList = (List<?>) actualValue;<NEW_LINE>List<?> expectedList = (List<?>) expectedValue;<NEW_LINE>if (actualList.isEmpty() || expectedList.isEmpty()) {<NEW_LINE>return actualList.isEmpty() && expectedList.isEmpty();<NEW_LINE>}<NEW_LINE>// Multi-value map:<NEW_LINE>if (actualList.get(0) instanceof Map.Entry) {<NEW_LINE>// The config_setting's expected value *must* be a single map entry (see method comments).<NEW_LINE>Object expectedListValue = Iterables.getOnlyElement(expectedList);<NEW_LINE>Map.Entry<?, ?> expectedEntry = (Map.Entry<?, ?>) expectedListValue;<NEW_LINE>for (Object elem : Lists.reverse(actualList)) {<NEW_LINE>Map.Entry<?, ?> actualEntry = (Map.<MASK><NEW_LINE>if (actualEntry.getKey().equals(expectedEntry.getKey())) {<NEW_LINE>// Found a key match!<NEW_LINE>return actualEntry.getValue().equals(expectedEntry.getValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// Multi-value list:<NEW_LINE>return actualList.containsAll(expectedList);<NEW_LINE>} | Entry<?, ?>) elem; |
1,303,542 | public void draw(Batch batch, float parentAlpha) {<NEW_LINE>validate();<NEW_LINE>drawBackground(batch, parentAlpha);<NEW_LINE>BitmapFont font = style.font;<NEW_LINE>Drawable selectedDrawable = style.selection;<NEW_LINE>Color fontColorSelected = style.fontColorSelected;<NEW_LINE>Color fontColorUnselected = style.fontColorUnselected;<NEW_LINE>Color color = getColor();<NEW_LINE>batch.setColor(color.r, color.g, color.<MASK><NEW_LINE>float x = getX(), y = getY(), width = getWidth(), height = getHeight();<NEW_LINE>float itemY = height;<NEW_LINE>Drawable background = style.background;<NEW_LINE>if (background != null) {<NEW_LINE>float leftWidth = background.getLeftWidth();<NEW_LINE>x += leftWidth;<NEW_LINE>itemY -= background.getTopHeight();<NEW_LINE>width -= leftWidth + background.getRightWidth();<NEW_LINE>}<NEW_LINE>float textOffsetX = selectedDrawable.getLeftWidth(), textWidth = width - textOffsetX - selectedDrawable.getRightWidth();<NEW_LINE>float textOffsetY = selectedDrawable.getTopHeight() - font.getDescent();<NEW_LINE>font.setColor(fontColorUnselected.r, fontColorUnselected.g, fontColorUnselected.b, fontColorUnselected.a * parentAlpha);<NEW_LINE>for (int i = 0; i < items.size; i++) {<NEW_LINE>if (cullingArea == null || (itemY - itemHeight <= cullingArea.y + cullingArea.height && itemY >= cullingArea.y)) {<NEW_LINE>T item = items.get(i);<NEW_LINE>boolean selected = selection.contains(item);<NEW_LINE>Drawable drawable = null;<NEW_LINE>if (pressedIndex == i && style.down != null)<NEW_LINE>drawable = style.down;<NEW_LINE>else if (selected) {<NEW_LINE>drawable = selectedDrawable;<NEW_LINE>font.setColor(fontColorSelected.r, fontColorSelected.g, fontColorSelected.b, fontColorSelected.a * parentAlpha);<NEW_LINE>} else if (//<NEW_LINE>overIndex == i && style.over != null)<NEW_LINE>drawable = style.over;<NEW_LINE>drawSelection(batch, drawable, x, y + itemY - itemHeight, width, itemHeight);<NEW_LINE>drawItem(batch, font, i, item, x + textOffsetX, y + itemY - textOffsetY, textWidth);<NEW_LINE>if (selected) {<NEW_LINE>font.setColor(fontColorUnselected.r, fontColorUnselected.g, fontColorUnselected.b, fontColorUnselected.a * parentAlpha);<NEW_LINE>}<NEW_LINE>} else if (itemY < cullingArea.y) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>itemY -= itemHeight;<NEW_LINE>}<NEW_LINE>} | b, color.a * parentAlpha); |
1,063,102 | private void createAccountingRecord(String tableName) throws Exception {<NEW_LINE>MTable table = MTable.get(m_ctx, tableName);<NEW_LINE>PO acct = table.getPO(0, m_trx.getTrxName());<NEW_LINE>MColumn[] cols = table.getColumns(false);<NEW_LINE>for (MColumn c : cols) {<NEW_LINE>String columnName = c.getColumnName();<NEW_LINE>if (c.isStandardColumn()) {<NEW_LINE>} else if (DisplayType.Account == c.getAD_Reference_ID()) {<NEW_LINE>acct.set_Value(columnName, getAcct(columnName));<NEW_LINE>log.info("Account: " + columnName);<NEW_LINE>} else if (DisplayType.YesNo == c.getAD_Reference_ID()) {<NEW_LINE>acct.set_Value(columnName, Boolean.TRUE);<NEW_LINE>log.info("YesNo: " + c.getColumnName());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>acct.<MASK><NEW_LINE>acct.set_Value(I_C_AcctSchema.COLUMNNAME_C_AcctSchema_ID, m_as.getC_AcctSchema_ID());<NEW_LINE>//<NEW_LINE>if (!acct.save()) {<NEW_LINE>throw new AdempiereUserError(CLogger.retrieveErrorString(table.getName() + " not created"));<NEW_LINE>}<NEW_LINE>} | setAD_Client_ID(m_client.getAD_Client_ID()); |
956,491 | final UpdateFieldLevelEncryptionConfigResult executeUpdateFieldLevelEncryptionConfig(UpdateFieldLevelEncryptionConfigRequest updateFieldLevelEncryptionConfigRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateFieldLevelEncryptionConfigRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UpdateFieldLevelEncryptionConfigRequest> request = null;<NEW_LINE>Response<UpdateFieldLevelEncryptionConfigResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdateFieldLevelEncryptionConfigRequestMarshaller().marshall(super.beforeMarshalling(updateFieldLevelEncryptionConfigRequest));<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(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "CloudFront");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateFieldLevelEncryptionConfig");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<UpdateFieldLevelEncryptionConfigResult> responseHandler = new StaxResponseHandler<UpdateFieldLevelEncryptionConfigResult>(new UpdateFieldLevelEncryptionConfigResultStaxUnmarshaller());<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.SIGNING_REGION, getSigningRegion()); |
6,533 | public Object readObject(JSONReader jsonReader, Type fieldType, Object fieldName, long features) {<NEW_LINE>if (jsonReader.readIfNull()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (jsonReader.nextIfMatch('[')) {<NEW_LINE>Integer[] values = new Integer[16];<NEW_LINE>int size = 0;<NEW_LINE>for (; ; ) {<NEW_LINE>if (jsonReader.nextIfMatch(']')) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>int minCapacity = size + 1;<NEW_LINE>if (minCapacity - values.length > 0) {<NEW_LINE>int oldCapacity = values.length;<NEW_LINE>int newCapacity = oldCapacity + (oldCapacity >> 1);<NEW_LINE>if (newCapacity - minCapacity < 0) {<NEW_LINE>newCapacity = minCapacity;<NEW_LINE>}<NEW_LINE>values = Arrays.copyOf(values, newCapacity);<NEW_LINE>}<NEW_LINE>values[size<MASK><NEW_LINE>}<NEW_LINE>jsonReader.nextIfMatch(',');<NEW_LINE>return Arrays.copyOf(values, size);<NEW_LINE>}<NEW_LINE>if (jsonReader.isString()) {<NEW_LINE>String str = jsonReader.readString();<NEW_LINE>if (str.isEmpty()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>throw new JSONException(jsonReader.info("not support input " + str));<NEW_LINE>}<NEW_LINE>throw new JSONException(jsonReader.info("TODO"));<NEW_LINE>} | ++] = jsonReader.readInt32(); |
1,422,346 | public void drawU(UGraphic ug) {<NEW_LINE>final StringBounder stringBounder = ug.getStringBounder();<NEW_LINE><MASK><NEW_LINE>final Dimension2D dim = comp.getPreferredDimension(stringBounder);<NEW_LINE>double x1 = getPoint1Value(stringBounder);<NEW_LINE>double x2 = getPoint2Value(stringBounder);<NEW_LINE>final int level = livingSpace.getLevelAt(this, EventsHistoryMode.IGNORE_FUTURE_DEACTIVATE);<NEW_LINE>if (level > 0) {<NEW_LINE>if (message.getType().isRightBorder()) {<NEW_LINE>x1 += CommunicationTile.LIVE_DELTA_SIZE * level;<NEW_LINE>} else {<NEW_LINE>x2 += CommunicationTile.LIVE_DELTA_SIZE * (level - 2);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final ArrowConfiguration arrowConfiguration = message.getArrowConfiguration();<NEW_LINE>final MessageExoType type = message.getType();<NEW_LINE>if (arrowConfiguration.getDecoration1() == ArrowDecoration.CIRCLE && type == MessageExoType.FROM_LEFT) {<NEW_LINE>x1 += ComponentRoseArrow.diamCircle / 2 + 2;<NEW_LINE>}<NEW_LINE>if (arrowConfiguration.getDecoration2() == ArrowDecoration.CIRCLE && type == MessageExoType.TO_LEFT) {<NEW_LINE>x1 += ComponentRoseArrow.diamCircle / 2 + 2;<NEW_LINE>}<NEW_LINE>if (arrowConfiguration.getDecoration2() == ArrowDecoration.CIRCLE && type == MessageExoType.TO_RIGHT) {<NEW_LINE>x2 -= ComponentRoseArrow.diamCircle / 2 + 2;<NEW_LINE>}<NEW_LINE>if (arrowConfiguration.getDecoration1() == ArrowDecoration.CIRCLE && type == MessageExoType.FROM_RIGHT) {<NEW_LINE>x2 -= ComponentRoseArrow.diamCircle / 2 + 2;<NEW_LINE>}<NEW_LINE>final Area area = Area.create(x2 - x1, dim.getHeight());<NEW_LINE>ug = ug.apply(UTranslate.dx(x1));<NEW_LINE>comp.drawU(ug, area, (Context2D) ug);<NEW_LINE>} | final Component comp = getComponent(stringBounder); |
747,273 | private CompletableFuture<? extends IntObjectMap<StreamBucket>> doFetch(FetchTask fetchTask, IntObjectMap<IntArrayList> toFetch) throws Exception {<NEW_LINE>HashMap<RelationName, TableFetchInfo> tableFetchInfos = getTableFetchInfos(fetchTask);<NEW_LINE>// RamAccounting is per doFetch call instead of per FetchTask/fetchPhase<NEW_LINE>// To be able to free up the memory count when the operation is complete<NEW_LINE>final var ramAccounting = ConcurrentRamAccounting.forCircuitBreaker("fetch-" + fetchTask.id(), circuitBreaker);<NEW_LINE>ArrayList<Supplier<StreamBucket>> collectors = new ArrayList<>(toFetch.size());<NEW_LINE>for (IntObjectCursor<IntArrayList> toFetchCursor : toFetch) {<NEW_LINE>final int readerId = toFetchCursor.key;<NEW_LINE>final IntArrayList docIds = toFetchCursor.value;<NEW_LINE>RelationName ident = fetchTask.tableIdent(readerId);<NEW_LINE>final TableFetchInfo tfi = tableFetchInfos.get(ident);<NEW_LINE>assert tfi != null : "tfi must not be null";<NEW_LINE>var collector = tfi.createCollector(readerId, new BlockBasedRamAccounting(ramAccounting::addBytes, BlockBasedRamAccounting.MAX_BLOCK_SIZE_IN_BYTES));<NEW_LINE>collectors.add(() -> collector.collect(docIds));<NEW_LINE>}<NEW_LINE>return ThreadPools.runWithAvailableThreads(executor, ThreadPools.numIdleThreads(executor, numProcessors), collectors).thenApply(buckets -> {<NEW_LINE><MASK><NEW_LINE>assert toFetch.size() == buckets.size() : "Must have a bucket per reader and they must be in the same order";<NEW_LINE>IntObjectHashMap<StreamBucket> bucketByReader = new IntObjectHashMap<>(toFetch.size());<NEW_LINE>for (var bucket : buckets) {<NEW_LINE>assert toFetchIt.hasNext() : "toFetchIt must have an element if there is one in buckets";<NEW_LINE>int readerId = toFetchIt.next().key;<NEW_LINE>bucketByReader.put(readerId, bucket);<NEW_LINE>}<NEW_LINE>return bucketByReader;<NEW_LINE>}).whenComplete((result, err) -> ramAccounting.close());<NEW_LINE>} | var toFetchIt = toFetch.iterator(); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.