idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
253,959 | public ListTargetedSentimentDetectionJobsResult listTargetedSentimentDetectionJobs(ListTargetedSentimentDetectionJobsRequest listTargetedSentimentDetectionJobsRequest) throws AmazonServiceException, AmazonClientException {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listTargetedSentimentDetectionJobsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListTargetedSentimentDetectionJobsRequest> request = null;<NEW_LINE>Response<ListTargetedSentimentDetectionJobsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListTargetedSentimentDetectionJobsRequestMarshaller().marshall(listTargetedSentimentDetectionJobsRequest);<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>Unmarshaller<ListTargetedSentimentDetectionJobsResult, <MASK><NEW_LINE>JsonResponseHandler<ListTargetedSentimentDetectionJobsResult> responseHandler = new JsonResponseHandler<ListTargetedSentimentDetectionJobsResult>(unmarshaller);<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.ClientExecuteTime);<NEW_LINE>endClientExecution(awsRequestMetrics, request, response, LOGGING_AWS_REQUEST_METRIC);<NEW_LINE>}<NEW_LINE>} | JsonUnmarshallerContext> unmarshaller = new ListTargetedSentimentDetectionJobsResultJsonUnmarshaller(); |
418,528 | public static Map<String, AttributeValue> toAttributeValueMap(Onboarding onboarding) {<NEW_LINE>Map<String, AttributeValue> item = new HashMap<>();<NEW_LINE>item.put("id", AttributeValue.builder().s(onboarding.getId().toString()).build());<NEW_LINE>if (onboarding.getCreated() != null) {<NEW_LINE>item.put("created", AttributeValue.builder().s(onboarding.getCreated().format(DateTimeFormatter.<MASK><NEW_LINE>}<NEW_LINE>if (onboarding.getModified() != null) {<NEW_LINE>item.put("modified", AttributeValue.builder().s(onboarding.getModified().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)).build());<NEW_LINE>}<NEW_LINE>if (onboarding.getStatus() != null) {<NEW_LINE>item.put("status", AttributeValue.builder().s(onboarding.getStatus().toString()).build());<NEW_LINE>}<NEW_LINE>if (onboarding.getTenantId() != null) {<NEW_LINE>item.put("tenant_id", AttributeValue.builder().s(onboarding.getTenantId().toString()).build());<NEW_LINE>}<NEW_LINE>if (Utils.isNotBlank(onboarding.getTenantName())) {<NEW_LINE>item.put("tenant_name", AttributeValue.builder().s(onboarding.getTenantName()).build());<NEW_LINE>}<NEW_LINE>if (Utils.isNotBlank(onboarding.getStackId())) {<NEW_LINE>item.put("stack_id", AttributeValue.builder().s(onboarding.getStackId()).build());<NEW_LINE>}<NEW_LINE>return item;<NEW_LINE>} | ISO_LOCAL_DATE_TIME)).build()); |
770,882 | protected String doInBackground(Void... params) {<NEW_LINE>if (!NetworkUtils.isOnline(mCtx)) {<NEW_LINE>return "No connection available!";<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>JSONObject j = new JSONObject();<NEW_LINE>try {<NEW_LINE>j.put("username", "username");<NEW_LINE>j.put("password", "pass");<NEW_LINE>j.put("buid", this.buid);<NEW_LINE>j.put("floor_number", this.floor_number);<NEW_LINE>} catch (JSONException e) {<NEW_LINE>return "Error Message: Could not create the request for the POIs!";<NEW_LINE>}<NEW_LINE>String response;<NEW_LINE>if (floor_number != null) {<NEW_LINE>// fetch the pois of this floor<NEW_LINE>response = NetworkUtils.downloadHttpClientJsonPost(AnyplaceAPI.getFetchPoisByBuidFloorUrl(), j.toString());<NEW_LINE>} else {<NEW_LINE>// fetch the pois for the whole building<NEW_LINE>response = NetworkUtils.downloadHttpClientJsonPost(AnyplaceAPI.getFetchPoisByBuidUrl(), j.toString());<NEW_LINE>}<NEW_LINE>JSONObject json_all = new JSONObject(response);<NEW_LINE>if (json_all.has("status") && json_all.getString("status").equalsIgnoreCase("error")) {<NEW_LINE>return "Error Message: " + json_all.getString("message");<NEW_LINE>}<NEW_LINE>// process the buildings received<NEW_LINE>JSONArray buids_json = new JSONArray(json_all.getString("pois"));<NEW_LINE>for (int i = 0, sz = buids_json.length(); i < sz; i++) {<NEW_LINE>JSONObject json = (JSONObject) buids_json.get(i);<NEW_LINE>// skip POIS without meaning<NEW_LINE>if (json.getString("pois_type").equals("None"))<NEW_LINE>continue;<NEW_LINE>PoisModel poi = new PoisModel();<NEW_LINE>poi.lat = json.getString("coordinates_lat");<NEW_LINE>poi.lng = json.getString("coordinates_lon");<NEW_LINE>poi.buid = json.getString("buid");<NEW_LINE>poi.floor_name = json.getString("floor_name");<NEW_LINE>poi.floor_number = json.getString("floor_number");<NEW_LINE>poi.description = json.getString("description");<NEW_LINE>poi.name = json.getString("name");<NEW_LINE>poi.<MASK><NEW_LINE>poi.puid = json.getString("puid");<NEW_LINE>if (json.has("is_building_entrance")) {<NEW_LINE>poi.is_building_entrance = json.getBoolean("is_building_entrance");<NEW_LINE>}<NEW_LINE>// add the POI to the hashmap<NEW_LINE>poisMap.put(poi.puid, poi);<NEW_LINE>}<NEW_LINE>success = true;<NEW_LINE>return "Successfully fetched Points of Interest";<NEW_LINE>} catch (ConnectTimeoutException e) {<NEW_LINE>return "Connecting to Anyplace service is taking too long!";<NEW_LINE>} catch (SocketTimeoutException e) {<NEW_LINE>return "Communication with the server is taking too long!";<NEW_LINE>} catch (JSONException e) {<NEW_LINE>return "Not valid response from the server! Contact the admin.";<NEW_LINE>} catch (Exception e) {<NEW_LINE>return "Error fetching Points of Interest. Exception[ " + e.getMessage() + " ]";<NEW_LINE>}<NEW_LINE>} | pois_type = json.getString("pois_type"); |
1,653,210 | public static void invokeConfigMethods(ObjectDef bean, Object instance, ExecutionContext context) throws InvocationTargetException, IllegalAccessException {<NEW_LINE>List<ConfigMethodDef> methodDefs = bean.getConfigMethods();<NEW_LINE>if (methodDefs == null || methodDefs.size() == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Class clazz = instance.getClass();<NEW_LINE>for (ConfigMethodDef methodDef : methodDefs) {<NEW_LINE>List<Object> args = methodDef.getArgs();<NEW_LINE>if (args == null) {<NEW_LINE>args = new ArrayList();<NEW_LINE>}<NEW_LINE>if (methodDef.hasReferences()) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>String methodName = methodDef.getName();<NEW_LINE>Method method = findCompatibleMethod(args, clazz, methodName);<NEW_LINE>if (method != null) {<NEW_LINE>Object[] methodArgs = getArgsWithListCoercian(args, method.getParameterTypes());<NEW_LINE>method.invoke(instance, methodArgs);<NEW_LINE>} else {<NEW_LINE>String msg = String.format("Unable to find configuration method '%s' in class '%s' with arguments %s.", new Object[] { methodName, clazz.getName(), args });<NEW_LINE>throw new IllegalArgumentException(msg);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | args = resolveReferences(args, context); |
267,321 | private void generateHtmlResponse(HttpServletRequest request, HttpServletResponse response) {<NEW_LINE>StringBuilder display = new StringBuilder();<NEW_LINE>display.append("<html>").append("<head><meta charset=\"UTF-8\"></head>").append("<body>").append("<h1>About</h1>");<NEW_LINE>display.append(newTable());<NEW_LINE>JSONObject aboutData = AboutInfo.gatherAbout(request.getServerName(), certificateManager);<NEW_LINE>try {<NEW_LINE>display.append(generateFromKeys(aboutData, true));<NEW_LINE>} catch (JSONException e) {<NEW_LINE>log.error("Failed to read JSON data", e);<NEW_LINE>display.append("<tr><td>Failed to write information</td></tr>");<NEW_LINE>}<NEW_LINE>display.append("</table>");<NEW_LINE>display.append("</body></html>");<NEW_LINE>try {<NEW_LINE>response.setStatus(HttpServletResponse.SC_OK);<NEW_LINE>response.setContentType("text/html");<NEW_LINE>response.getOutputStream().print(display.toString());<NEW_LINE>} catch (Exception e) {<NEW_LINE>response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);<NEW_LINE>log.warn(<MASK><NEW_LINE>}<NEW_LINE>} | "Exception occurred loading html page {}", e.getMessage()); |
669,055 | private void updateAudioManagerReference(GuildImpl guild) {<NEW_LINE>JDAImpl api = getController().getJDA();<NEW_LINE>AbstractCacheView<AudioManager> managerView = api.getAudioManagersView();<NEW_LINE>try (UnlockHook hook = managerView.writeLock()) {<NEW_LINE>TLongObjectMap<AudioManager> audioManagerMap = managerView.getMap();<NEW_LINE>AudioManagerImpl mng = (AudioManagerImpl) audioManagerMap.get(id);<NEW_LINE>if (mng == null)<NEW_LINE>return;<NEW_LINE>ConnectionListener listener = mng.getConnectionListener();<NEW_LINE>final <MASK><NEW_LINE>newMng.setSelfMuted(mng.isSelfMuted());<NEW_LINE>newMng.setSelfDeafened(mng.isSelfDeafened());<NEW_LINE>newMng.setQueueTimeout(mng.getConnectTimeout());<NEW_LINE>newMng.setSendingHandler(mng.getSendingHandler());<NEW_LINE>newMng.setReceivingHandler(mng.getReceivingHandler());<NEW_LINE>newMng.setConnectionListener(listener);<NEW_LINE>newMng.setAutoReconnect(mng.isAutoReconnect());<NEW_LINE>if (mng.isConnected()) {<NEW_LINE>final long channelId = mng.getConnectedChannel().getIdLong();<NEW_LINE>final VoiceChannel channel = api.getVoiceChannelById(channelId);<NEW_LINE>if (channel != null) {<NEW_LINE>if (mng.isConnected())<NEW_LINE>mng.closeAudioConnection(ConnectionStatus.ERROR_CANNOT_RESUME);<NEW_LINE>} else {<NEW_LINE>// The voice channel is not cached. It was probably deleted.<NEW_LINE>api.getClient().removeAudioConnection(id);<NEW_LINE>if (listener != null)<NEW_LINE>listener.onStatusChange(ConnectionStatus.DISCONNECTED_CHANNEL_DELETED);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>audioManagerMap.put(id, newMng);<NEW_LINE>}<NEW_LINE>} | AudioManagerImpl newMng = new AudioManagerImpl(guild); |
911,543 | ActionResult<Wo> execute(EffectivePerson effectivePerson, String cardid, JsonElement jsonElement) throws Exception {<NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>ActionResult<Wo> result = new ActionResult<>();<NEW_LINE>Business business = new Business(emc);<NEW_LINE>Wi wi = this.convertToWrapIn(jsonElement, Wi.class);<NEW_LINE>PermissionSetting permission = business.<MASK><NEW_LINE>if (null == permission) {<NEW_LINE>throw new ExceptionPersonCardNotExist(cardid);<NEW_LINE>}<NEW_LINE>Wi.copier.copy(wi, permission);<NEW_LINE>emc.beginTransaction(PermissionSetting.class);<NEW_LINE>PermissionSetting entityPerson = emc.find(cardid, PermissionSetting.class);<NEW_LINE>if (null == permission.getId() || StringUtils.isBlank(entityPerson.getId())) {<NEW_LINE>entityPerson.setId(cardid);<NEW_LINE>throw new ExceptionPersonCardNotExist(cardid);<NEW_LINE>}<NEW_LINE>permission.copyTo(entityPerson);<NEW_LINE>emc.check(entityPerson, CheckPersistType.all);<NEW_LINE>emc.commit();<NEW_LINE>CacheManager.notify(PermissionSetting.class);<NEW_LINE>OrgMessageFactory orgMessageFactory = new OrgMessageFactory();<NEW_LINE>orgMessageFactory.createMessageCommunicate("modfiy", "PermissionSetting", permission, effectivePerson);<NEW_LINE>Wo wo = new Wo();<NEW_LINE>wo.setId(permission.getId());<NEW_LINE>result.setData(wo);<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>} | permissionSetting().pick(cardid); |
243,593 | public void marshall(ExplainabilitySummary explainabilitySummary, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (explainabilitySummary == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(explainabilitySummary.getExplainabilityArn(), EXPLAINABILITYARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(explainabilitySummary.getExplainabilityName(), EXPLAINABILITYNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(explainabilitySummary.getExplainabilityConfig(), EXPLAINABILITYCONFIG_BINDING);<NEW_LINE>protocolMarshaller.marshall(explainabilitySummary.getStatus(), STATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(explainabilitySummary.getMessage(), MESSAGE_BINDING);<NEW_LINE>protocolMarshaller.marshall(explainabilitySummary.getCreationTime(), CREATIONTIME_BINDING);<NEW_LINE>protocolMarshaller.marshall(explainabilitySummary.getLastModificationTime(), LASTMODIFICATIONTIME_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | explainabilitySummary.getResourceArn(), RESOURCEARN_BINDING); |
1,676,272 | final DeleteApplicationOutputResult executeDeleteApplicationOutput(DeleteApplicationOutputRequest deleteApplicationOutputRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteApplicationOutputRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteApplicationOutputRequest> request = null;<NEW_LINE>Response<DeleteApplicationOutputResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteApplicationOutputRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteApplicationOutputRequest));<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, "Kinesis Analytics V2");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteApplicationOutputResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteApplicationOutputResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteApplicationOutput"); |
10,496 | void addResource(String type, String name, TypedResource value) {<NEW_LINE>ResName resName = new ResName(packageName, type, name);<NEW_LINE>// compound style names were previously registered with underscores (TextAppearance_Small)<NEW_LINE>// because they came from R.style; re-register with dots.<NEW_LINE>ResName resNameWithUnderscores = new ResName(packageName, type, underscorize(name));<NEW_LINE>Integer oldId = resourceTable.inverse().get(resNameWithUnderscores);<NEW_LINE>if (oldId != null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>Integer id = resourceTable.inverse().get(resName);<NEW_LINE>if (id == null && isAndroidPackage(resName)) {<NEW_LINE>id = androidResourceIdGenerator.generate(type, name);<NEW_LINE>ResName existing = resourceTable.put(id, resName);<NEW_LINE>if (existing != null) {<NEW_LINE>throw new IllegalStateException(resName + " assigned ID to already existing " + existing);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>resources.put(resName, value);<NEW_LINE>} | resourceTable.forcePut(oldId, resName); |
876,460 | // beforeSave<NEW_LINE>@Override<NEW_LINE>protected boolean afterSave(final boolean newRecord, final boolean success) {<NEW_LINE>if (!success || newRecord) {<NEW_LINE>return success;<NEW_LINE>}<NEW_LINE>// Propagate Description changes<NEW_LINE>if (is_ValueChanged("Description") || is_ValueChanged("POReference")) {<NEW_LINE>final String sql = DB.convertSqlToNative("UPDATE C_Invoice i" + " SET (Description,POReference)=" + "(SELECT Description,POReference " + "FROM C_Order o WHERE i.C_Order_ID=o.C_Order_ID) " + "WHERE DocStatus NOT IN ('RE','CL') AND C_Order_ID=" + getC_Order_ID());<NEW_LINE>final int no = DB.executeUpdateEx(sql, get_TrxName());<NEW_LINE>log.debug("Description -> #" + no);<NEW_LINE>}<NEW_LINE>// Propagate Changes of Payment Info to existing (not reversed/closed) invoices<NEW_LINE>if (is_ValueChanged("PaymentRule") || is_ValueChanged("C_PaymentTerm_ID") || is_ValueChanged("DateAcct") || is_ValueChanged("C_Payment_ID") || is_ValueChanged("C_CashLine_ID")) {<NEW_LINE>final String sql = DB.convertSqlToNative("UPDATE C_Invoice i " + "SET (PaymentRule,C_PaymentTerm_ID,DateAcct,C_Payment_ID,C_CashLine_ID)=" + "(SELECT PaymentRule,C_PaymentTerm_ID,DateAcct,C_Payment_ID,C_CashLine_ID " + "FROM C_Order o WHERE i.C_Order_ID=o.C_Order_ID)" + "WHERE DocStatus NOT IN ('RE','CL') AND C_Order_ID=" + getC_Order_ID());<NEW_LINE>// Don't touch Closed/Reversed entries<NEW_LINE>final int no = DB.executeUpdate(sql, get_TrxName());<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>// Sync Lines<NEW_LINE>if (// metas: tsa: 01767: don't sync bp and bplocation<NEW_LINE>is_ValueChanged("AD_Org_ID") || /*<NEW_LINE>* || is_ValueChanged(MOrder.COLUMNNAME_C_BPartner_ID)<NEW_LINE>* || is_ValueChanged(MOrder.COLUMNNAME_C_BPartner_Location_ID)<NEW_LINE>*/<NEW_LINE>is_ValueChanged(MOrder.COLUMNNAME_DateOrdered) || is_ValueChanged(MOrder.COLUMNNAME_DatePromised) || is_ValueChanged(MOrder.COLUMNNAME_M_Warehouse_ID) || is_ValueChanged(MOrder.COLUMNNAME_M_Shipper_ID) || is_ValueChanged(MOrder.COLUMNNAME_C_Currency_ID)) {<NEW_LINE>for (final MOrderLine line : getLines()) {<NEW_LINE>if (is_ValueChanged("AD_Org_ID")) {<NEW_LINE>line.setAD_Org_ID(getAD_Org_ID());<NEW_LINE>}<NEW_LINE>// metas: tsa: 01767: don't sync bp and bplocation<NEW_LINE>if (is_ValueChanged(MOrder.COLUMNNAME_DateOrdered)) {<NEW_LINE>line.setDateOrdered(getDateOrdered());<NEW_LINE>}<NEW_LINE>if (is_ValueChanged(MOrder.COLUMNNAME_DatePromised)) {<NEW_LINE>line.setDatePromised(getDatePromised());<NEW_LINE>}<NEW_LINE>if (is_ValueChanged(MOrder.COLUMNNAME_M_Warehouse_ID)) {<NEW_LINE>line.setM_Warehouse_ID(getM_Warehouse_ID());<NEW_LINE>}<NEW_LINE>if (is_ValueChanged(MOrder.COLUMNNAME_M_Shipper_ID)) {<NEW_LINE>line.setM_Shipper_ID(getM_Shipper_ID());<NEW_LINE>}<NEW_LINE>if (is_ValueChanged(MOrder.COLUMNNAME_C_Currency_ID)) {<NEW_LINE>line.setC_Currency_ID(getC_Currency_ID());<NEW_LINE>}<NEW_LINE>line.saveEx();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>//<NEW_LINE>return true;<NEW_LINE>} | log.debug("Payment -> #" + no); |
465,833 | private static void unknownValue(JsonGenerator generator, Object value, boolean ensureNoSelfReferences) throws IOException {<NEW_LINE>if (value == null) {<NEW_LINE>generator.writeNull();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Writer writer = WRITERS.<MASK><NEW_LINE>if (writer != null) {<NEW_LINE>writer.write(generator, value);<NEW_LINE>} else if (value instanceof Path) {<NEW_LINE>// Path implements Iterable<Path> and causes endless recursion and a StackOverFlow if treated as an Iterable here<NEW_LINE>value(generator, (Path) value);<NEW_LINE>} else if (value instanceof Map) {<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>final Map<String, ?> valueMap = (Map<String, ?>) value;<NEW_LINE>map(generator, valueMap, ensureNoSelfReferences, true);<NEW_LINE>} else if (value instanceof Iterable) {<NEW_LINE>iterable(generator, (Iterable<?>) value, ensureNoSelfReferences);<NEW_LINE>} else if (value instanceof Object[]) {<NEW_LINE>array(generator, (Object[]) value, ensureNoSelfReferences);<NEW_LINE>} else if (value instanceof Enum<?>) {<NEW_LINE>// Write out the Enum toString<NEW_LINE>generator.writeString(Objects.toString(value));<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("cannot write xcontent for unknown value of type " + value.getClass());<NEW_LINE>}<NEW_LINE>} | get(value.getClass()); |
1,186,933 | private AckEvent drillbitUnregistered(DrillbitEndpoint dbe) {<NEW_LINE>String key = toKey(dbe);<NEW_LINE>DrillbitTracker tracker = registry.get(key);<NEW_LINE>assert tracker != null;<NEW_LINE>if (tracker == null) {<NEW_LINE>// Something is terribly wrong.<NEW_LINE>// Have seen this when a user kills the Drillbit just after it starts. Evidently, the<NEW_LINE>// Drillbit registers with ZK just before it is killed, but before DoY hears about<NEW_LINE>// the registration.<NEW_LINE>LOG.error("Internal error - Unexpected drillbit unregistration: " + key);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (tracker.state == DrillbitTracker.State.UNMANAGED) {<NEW_LINE>// Unmanaged drillbit<NEW_LINE>assert tracker.task == null;<NEW_LINE>LOG.info("Unmanaged drillbit unregistered: " + key);<NEW_LINE>registry.remove(key);<NEW_LINE>registryHandler.<MASK><NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>LOG.info("Drillbit unregistered: " + key + ", task: " + tracker.task.toString());<NEW_LINE>tracker.becomeUnregistered();<NEW_LINE>return new AckEvent(tracker.task, dbe);<NEW_LINE>} | releaseHost(dbe.getAddress()); |
1,039,963 | final ListTopicsDetectionJobsResult executeListTopicsDetectionJobs(ListTopicsDetectionJobsRequest listTopicsDetectionJobsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listTopicsDetectionJobsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListTopicsDetectionJobsRequest> request = null;<NEW_LINE>Response<ListTopicsDetectionJobsResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new ListTopicsDetectionJobsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listTopicsDetectionJobsRequest));<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, "Comprehend");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTopicsDetectionJobs");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListTopicsDetectionJobsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListTopicsDetectionJobsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.RequestMarshallTime); |
772,571 | private static StatementSpecRaw map(EPStatementObjectModel sodaStatement, StatementSpecMapContext mapContext) {<NEW_LINE>SelectClauseStreamSelectorEnum defaultStreamSelector = StatementSpecMapper.mapFromSODA(mapContext.getConfiguration().getCompiler().getStreamSelection().getDefaultStreamSelector());<NEW_LINE>StatementSpecRaw raw = new StatementSpecRaw(defaultStreamSelector);<NEW_LINE>List<AnnotationDesc> annotations = mapAnnotations(sodaStatement.getAnnotations());<NEW_LINE>raw.setAnnotations(annotations);<NEW_LINE>mapFireAndForget(sodaStatement.getFireAndForgetClause(), raw, mapContext);<NEW_LINE>mapExpressionDeclaration(sodaStatement.getExpressionDeclarations(), raw, mapContext);<NEW_LINE>mapScriptExpressions(sodaStatement.getScriptExpressions(), raw, mapContext);<NEW_LINE>mapClassProvidedExpressions(sodaStatement.getClassProvidedExpressions(), raw, mapContext);<NEW_LINE>mapContextName(sodaStatement.getContextName(), raw, mapContext);<NEW_LINE>mapUpdateClause(sodaStatement.getUpdateClause(), raw, mapContext);<NEW_LINE>mapCreateContext(sodaStatement.getCreateContext(), raw, mapContext);<NEW_LINE>mapCreateWindow(sodaStatement.getCreateWindow(), raw, mapContext);<NEW_LINE>mapCreateIndex(sodaStatement.getCreateIndex(), raw, mapContext);<NEW_LINE>mapCreateVariable(sodaStatement.getCreateVariable(), raw, mapContext);<NEW_LINE>mapCreateTable(sodaStatement.getCreateTable(), raw, mapContext);<NEW_LINE>mapCreateSchema(sodaStatement.getCreateSchema(), raw, mapContext);<NEW_LINE>mapCreateExpression(sodaStatement.getCreateExpression(), raw, mapContext);<NEW_LINE>mapCreateClass(sodaStatement.getCreateClass(), raw, mapContext);<NEW_LINE>mapCreateGraph(sodaStatement.getCreateDataFlow(), raw, mapContext);<NEW_LINE>mapOnTrigger(sodaStatement.getOnExpr(), raw, mapContext);<NEW_LINE>InsertIntoDesc desc = mapInsertInto(sodaStatement.getInsertInto(), mapContext);<NEW_LINE>raw.setInsertIntoDesc(desc);<NEW_LINE>mapSelect(sodaStatement.getSelectClause(), raw, mapContext);<NEW_LINE>mapFrom(sodaStatement.getFromClause(), raw, mapContext);<NEW_LINE>mapWhere(sodaStatement.getWhereClause(), raw, mapContext);<NEW_LINE>mapGroupBy(sodaStatement.getGroupByClause(), raw, mapContext);<NEW_LINE>mapHaving(sodaStatement.getHavingClause(), raw, mapContext);<NEW_LINE>mapOutputLimit(sodaStatement.getOutputLimitClause(), raw, mapContext);<NEW_LINE>mapOrderBy(sodaStatement.getOrderByClause(), raw, mapContext);<NEW_LINE>mapRowLimit(sodaStatement.getRowLimitClause(), raw, mapContext);<NEW_LINE>mapMatchRecognize(sodaStatement.getMatchRecognizeClause(), raw, mapContext);<NEW_LINE>mapForClause(sodaStatement.getForClause(), raw, mapContext);<NEW_LINE>mapSQLParameters(sodaStatement.<MASK><NEW_LINE>mapIntoVariableClause(sodaStatement.getIntoTableClause(), raw);<NEW_LINE>return raw;<NEW_LINE>} | getFromClause(), raw, mapContext); |
335,571 | public static String updatePlayerResult(String ApplicationRoot, String moduleId, String userId, String extra, int before, int after, int difficulty) {<NEW_LINE>log.debug("*** Setter.updatePlayerResult ***");<NEW_LINE>String result = null;<NEW_LINE>boolean isOpen;<NEW_LINE>Boolean isRunning;<NEW_LINE>try {<NEW_LINE>isOpen = CountdownHandler.isOpen();<NEW_LINE>isRunning = CountdownHandler.isRunning();<NEW_LINE>} catch (InvalidCountdownStateException e1) {<NEW_LINE>String message = "Countdown handler is in an invalid state.";<NEW_LINE>log.error(message);<NEW_LINE>throw new RuntimeException(message);<NEW_LINE>}<NEW_LINE>if (isRunning) {<NEW_LINE>try {<NEW_LINE>Connection conn = Database.getCoreConnection(ApplicationRoot);<NEW_LINE>log.debug("Preparing userUpdateResult call");<NEW_LINE>CallableStatement callstmnt = conn.prepareCall("call userUpdateResult(?, ?, ?, ?, ?, ?, ?)");<NEW_LINE>callstmnt.setString(1, moduleId);<NEW_LINE>callstmnt.setString(2, userId);<NEW_LINE>callstmnt.setInt(3, before);<NEW_LINE>callstmnt.setInt(4, after);<NEW_LINE>callstmnt.setInt(5, difficulty);<NEW_LINE>// Only give points if CTF is open<NEW_LINE><MASK><NEW_LINE>callstmnt.setString(7, extra);<NEW_LINE>log.debug("Executing userUpdateResult");<NEW_LINE>callstmnt.execute();<NEW_LINE>// User Executed. Now Get the Level Name Langauge Key<NEW_LINE>result = Getter.getModuleNameLocaleKey(ApplicationRoot, moduleId);<NEW_LINE>Database.closeConnection(conn);<NEW_LINE>} catch (SQLException e) {<NEW_LINE>log.error("userUpdateResult Failure: " + e.toString());<NEW_LINE>result = null;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>log.error("Error: Can't allow results to be stored when CTF isn't running");<NEW_LINE>result = null;<NEW_LINE>}<NEW_LINE>log.debug("*** END updatePlayerResult ***");<NEW_LINE>return result;<NEW_LINE>} | callstmnt.setBoolean(6, isOpen); |
1,392,178 | // Finishes all terms in this field<NEW_LINE>public void finish() throws IOException {<NEW_LINE>if (numTerms > 0) {<NEW_LINE>// TODO: if pending.size() is already 1 with a non-zero prefix length<NEW_LINE>// we can save writing a "degenerate" root block, but we have to<NEW_LINE>// fix all the places that assume the root block's prefix is the empty string:<NEW_LINE>writeBlocks(0, pending.size());<NEW_LINE>// We better have one final "root" block:<NEW_LINE>assert pending.size() == 1 && !pending.get(0).isTerm : "pending.size()=" + pending.size() + " pending=" + pending;<NEW_LINE>final PendingBlock root = (PendingBlock) pending.get(0);<NEW_LINE>assert root.prefix.length == 0;<NEW_LINE>assert root.index.getEmptyOutput() != null;<NEW_LINE>// Write FST to index<NEW_LINE>indexStartFP = indexOut.getFilePointer();<NEW_LINE>root.index.save(indexOut, indexOut);<NEW_LINE>// System.out.println(" write FST " + indexStartFP + " field=" + fieldInfo.name);<NEW_LINE>// if (SAVE_DOT_FILES || DEBUG) {<NEW_LINE>// final String dotFileName = segment + "_" + fieldInfo.name + ".dot";<NEW_LINE>// Writer w = new OutputStreamWriter(new FileOutputStream(dotFileName));<NEW_LINE>// Util.toDot(root.index, w, false, false);<NEW_LINE>// System.out.println("SAVED to " + dotFileName);<NEW_LINE>// w.close();<NEW_LINE>// }<NEW_LINE>assert firstPendingTerm != null;<NEW_LINE>BytesRef minTerm <MASK><NEW_LINE>assert lastPendingTerm != null;<NEW_LINE>BytesRef maxTerm = new BytesRef(lastPendingTerm.termBytes);<NEW_LINE>fields.add(new FieldMetaData(fieldInfo, ((PendingBlock) pending.get(0)).index.getEmptyOutput(), numTerms, indexStartFP, minTerm, maxTerm));<NEW_LINE>} else {<NEW_LINE>// cannot assert this: we skip deleted docIDs in the postings:<NEW_LINE>// assert docsSeen.cardinality() == 0;<NEW_LINE>}<NEW_LINE>} | = new BytesRef(firstPendingTerm.termBytes); |
726,145 | public static void main(String[] args) {<NEW_LINE>Loader.loadNativeLibraries();<NEW_LINE>// [START solver]<NEW_LINE>MPSolver <MASK><NEW_LINE>// [END solver]<NEW_LINE>// [START variables]<NEW_LINE>double infinity = java.lang.Double.POSITIVE_INFINITY;<NEW_LINE>// x and y are continuous non-negative variables.<NEW_LINE>MPVariable x = solver.makeNumVar(0.0, infinity, "x");<NEW_LINE>MPVariable y = solver.makeNumVar(0.0, infinity, "y");<NEW_LINE>System.out.println("Number of variables = " + solver.numVariables());<NEW_LINE>// [END variables]<NEW_LINE>// [START constraints]<NEW_LINE>// x + 2*y <= 14.<NEW_LINE>MPConstraint c0 = solver.makeConstraint(-infinity, 14.0, "c0");<NEW_LINE>c0.setCoefficient(x, 1);<NEW_LINE>c0.setCoefficient(y, 2);<NEW_LINE>// 3*x - y >= 0.<NEW_LINE>MPConstraint c1 = solver.makeConstraint(0.0, infinity, "c1");<NEW_LINE>c1.setCoefficient(x, 3);<NEW_LINE>c1.setCoefficient(y, -1);<NEW_LINE>// x - y <= 2.<NEW_LINE>MPConstraint c2 = solver.makeConstraint(-infinity, 2.0, "c2");<NEW_LINE>c2.setCoefficient(x, 1);<NEW_LINE>c2.setCoefficient(y, -1);<NEW_LINE>System.out.println("Number of constraints = " + solver.numConstraints());<NEW_LINE>// [END constraints]<NEW_LINE>// [START objective]<NEW_LINE>// Maximize 3 * x + 4 * y.<NEW_LINE>MPObjective objective = solver.objective();<NEW_LINE>objective.setCoefficient(x, 3);<NEW_LINE>objective.setCoefficient(y, 4);<NEW_LINE>objective.setMaximization();<NEW_LINE>// [END objective]<NEW_LINE>// [START solve]<NEW_LINE>final MPSolver.ResultStatus resultStatus = solver.solve();<NEW_LINE>// [END solve]<NEW_LINE>// [START print_solution]<NEW_LINE>if (resultStatus == MPSolver.ResultStatus.OPTIMAL) {<NEW_LINE>System.out.println("Solution:");<NEW_LINE>System.out.println("Objective value = " + objective.value());<NEW_LINE>System.out.println("x = " + x.solutionValue());<NEW_LINE>System.out.println("y = " + y.solutionValue());<NEW_LINE>} else {<NEW_LINE>System.err.println("The problem does not have an optimal solution!");<NEW_LINE>}<NEW_LINE>// [END print_solution]<NEW_LINE>// [START advanced]<NEW_LINE>System.out.println("\nAdvanced usage:");<NEW_LINE>System.out.println("Problem solved in " + solver.wallTime() + " milliseconds");<NEW_LINE>System.out.println("Problem solved in " + solver.iterations() + " iterations");<NEW_LINE>// [END advanced]<NEW_LINE>} | solver = MPSolver.createSolver("GLOP"); |
764,095 | public ApiResponse<Object> keyInQueryWithHttpInfo() throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/query";<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, String> localVarCookieParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>final String[] localVarAccepts = { "application/json" };<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames <MASK><NEW_LINE>GenericType<Object> localVarReturnType = new GenericType<Object>() {<NEW_LINE>};<NEW_LINE>return apiClient.invokeAPI("UsageApi.keyInQuery", localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType, false);<NEW_LINE>} | = new String[] { "api_key_query" }; |
1,185,737 | Stream.Listener onPush(Stream stream, PushPromiseFrame frame) {<NEW_LINE>HttpExchange exchange = getHttpExchange();<NEW_LINE>if (exchange == null)<NEW_LINE>return null;<NEW_LINE>HttpRequest request = exchange.getRequest();<NEW_LINE>MetaData.Request metaData = frame.getMetaData();<NEW_LINE>HttpRequest pushRequest = (HttpRequest) getHttpDestination().getHttpClient().newRequest(metaData.getURIString());<NEW_LINE>// TODO: copy PUSH_PROMISE headers into pushRequest.<NEW_LINE>BiFunction<Request, Request, Response.CompleteListener> pushListener = request.getPushListener();<NEW_LINE>if (pushListener != null) {<NEW_LINE>Response.CompleteListener listener = pushListener.apply(request, pushRequest);<NEW_LINE>if (listener != null) {<NEW_LINE>HttpChannelOverHTTP2 pushChannel = getHttpChannel().getHttpConnection().acquireHttpChannel();<NEW_LINE>HttpExchange pushExchange = new HttpExchange(getHttpDestination(), pushRequest<MASK><NEW_LINE>pushChannel.associate(pushExchange);<NEW_LINE>pushChannel.setStream(stream);<NEW_LINE>// TODO: idle timeout ?<NEW_LINE>pushExchange.requestComplete(null);<NEW_LINE>pushExchange.terminateRequest();<NEW_LINE>return pushChannel.getStreamListener();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>stream.reset(new ResetFrame(stream.getId(), ErrorCode.REFUSED_STREAM_ERROR.code), Callback.NOOP);<NEW_LINE>return null;<NEW_LINE>} | , List.of(listener)); |
1,317,146 | public void marshall(AssistantAssociationData assistantAssociationData, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (assistantAssociationData == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(assistantAssociationData.getAssistantAssociationArn(), ASSISTANTASSOCIATIONARN_BINDING);<NEW_LINE>protocolMarshaller.marshall(assistantAssociationData.getAssistantAssociationId(), ASSISTANTASSOCIATIONID_BINDING);<NEW_LINE>protocolMarshaller.marshall(assistantAssociationData.getAssistantId(), ASSISTANTID_BINDING);<NEW_LINE>protocolMarshaller.marshall(assistantAssociationData.getAssociationData(), ASSOCIATIONDATA_BINDING);<NEW_LINE>protocolMarshaller.marshall(assistantAssociationData.getAssociationType(), ASSOCIATIONTYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(assistantAssociationData.getTags(), TAGS_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | assistantAssociationData.getAssistantArn(), ASSISTANTARN_BINDING); |
995,878 | private static org.jreleaser.model.Mail convertMail(Mail mail) {<NEW_LINE>org.jreleaser.model.Mail a = new org.jreleaser.model.Mail();<NEW_LINE>convertAnnouncer(mail, a);<NEW_LINE>if (mail.isAuthSet())<NEW_LINE>a.<MASK><NEW_LINE>if (null != mail.getTransport())<NEW_LINE>a.setTransport(mail.getTransport().name());<NEW_LINE>if (null != mail.getMimeType())<NEW_LINE>a.setMimeType(mail.getMimeType().name());<NEW_LINE>a.setPort(mail.getPort());<NEW_LINE>a.setUsername(tr(mail.getUsername()));<NEW_LINE>a.setPassword(tr(mail.getPassword()));<NEW_LINE>a.setFrom(tr(mail.getFrom()));<NEW_LINE>a.setTo(tr(mail.getTo()));<NEW_LINE>a.setCc(tr(mail.getCc()));<NEW_LINE>a.setBcc(tr(mail.getBcc()));<NEW_LINE>a.setSubject(tr(mail.getSubject()));<NEW_LINE>a.setMessage(tr(mail.getMessage()));<NEW_LINE>a.setMessageTemplate(tr(mail.getMessageTemplate()));<NEW_LINE>return a;<NEW_LINE>} | setAuth(mail.isAuth()); |
1,285,589 | private RefactoringStatus checkSelection(IProgressMonitor pm) throws JavaModelException {<NEW_LINE>try {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>pm.beginTask("", 8);<NEW_LINE>IExpressionFragment selectedExpression = getSelectedExpression();<NEW_LINE>if (selectedExpression == null) {<NEW_LINE>String message = RefactoringCoreMessages.ExtractTempRefactoring_select_expression;<NEW_LINE>return CodeRefactoringUtil.checkMethodSyntaxErrors(fSelectionStart, fSelectionLength, fCompilationUnitNode, message);<NEW_LINE>}<NEW_LINE>pm.worked(1);<NEW_LINE>if (isUsedInExplicitConstructorCall()) {<NEW_LINE>return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_explicit_constructor);<NEW_LINE>}<NEW_LINE>pm.worked(1);<NEW_LINE>ASTNode associatedNode = selectedExpression.getAssociatedNode();<NEW_LINE>if (getEnclosingBodyNode() == null || ASTNodes.getParent(associatedNode, Annotation.class) != null) {<NEW_LINE>return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_expr_in_method_or_initializer);<NEW_LINE>}<NEW_LINE>pm.worked(1);<NEW_LINE>if (associatedNode instanceof Name && associatedNode.getParent() instanceof ClassInstanceCreation && associatedNode.getLocationInParent() == ClassInstanceCreation.TYPE_PROPERTY) {<NEW_LINE>return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_name_in_new);<NEW_LINE>}<NEW_LINE>pm.worked(1);<NEW_LINE>RefactoringStatus result = new RefactoringStatus();<NEW_LINE>result.merge(checkExpression());<NEW_LINE>if (result.hasFatalError()) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>pm.worked(1);<NEW_LINE>result.merge(checkExpressionFragmentIsRValue());<NEW_LINE>if (result.hasFatalError()) {<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>pm.worked(1);<NEW_LINE>if (isUsedInForInitializerOrUpdater(getSelectedExpression().getAssociatedExpression())) {<NEW_LINE>return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_for_initializer_updater);<NEW_LINE>}<NEW_LINE>pm.worked(1);<NEW_LINE>if (isReferringToLocalVariableFromFor(getSelectedExpression().getAssociatedExpression())) {<NEW_LINE>return <MASK><NEW_LINE>}<NEW_LINE>pm.worked(1);<NEW_LINE>return result;<NEW_LINE>} finally {<NEW_LINE>pm.done();<NEW_LINE>}<NEW_LINE>} | RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractTempRefactoring_refers_to_for_variable); |
885,526 | public void run() {<NEW_LINE>// stop or detach from any profiling in progress<NEW_LINE>final int state = Profiler<MASK><NEW_LINE>final int mode = Profiler.getDefault().getProfilingMode();<NEW_LINE>if ((state == Profiler.PROFILING_PAUSED) || (state == Profiler.PROFILING_RUNNING)) {<NEW_LINE>if (mode == Profiler.MODE_PROFILE) {<NEW_LINE>Profiler.getDefault().stopApp();<NEW_LINE>} else {<NEW_LINE>Profiler.getDefault().detachFromApp();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// NB is performing IDE reset after uninstall anyway; no need to close the windows explicitly<NEW_LINE>// // force closing of all windows<NEW_LINE>// ProfilerControlPanel2.closeIfOpened();<NEW_LINE>// TelemetryOverviewPanel.closeIfOpened();<NEW_LINE>// LiveResultsWindow.closeIfOpened();<NEW_LINE>// TelemetryWindow.closeIfOpened();<NEW_LINE>// ThreadsWindow.closeIfOpened();<NEW_LINE>// SnapshotResultsWindow.closeAllWindows();<NEW_LINE>// ProfilingPointsWindow.closeIfOpened();<NEW_LINE>// perform any shutdown<NEW_LINE>((NetBeansProfiler) Profiler.getDefault()).shutdown();<NEW_LINE>// cleanup client data<NEW_LINE>ResetResultsAction.getInstance().actionPerformed(null);<NEW_LINE>} | .getDefault().getProfilingState(); |
420,388 | public PyObject __call__(PyObject arga, PyObject argb, PyObject argc) {<NEW_LINE>switch(index) {<NEW_LINE>case 1:<NEW_LINE>int year = ((Number) arga.__tojava__(Number.class)).intValue();<NEW_LINE>int month = ((Number) argb.__tojava__(Number.class)).intValue();<NEW_LINE>int day = ((Number) argc.__tojava__(Number.class)).intValue();<NEW_LINE>return zxJDBC.datefactory.<MASK><NEW_LINE>case 2:<NEW_LINE>int hour = ((Number) arga.__tojava__(Number.class)).intValue();<NEW_LINE>int minute = ((Number) argb.__tojava__(Number.class)).intValue();<NEW_LINE>int second = ((Number) argc.__tojava__(Number.class)).intValue();<NEW_LINE>return zxJDBC.datefactory.Time(hour, minute, second);<NEW_LINE>default:<NEW_LINE>throw info.unexpectedCall(3, false);<NEW_LINE>}<NEW_LINE>} | Date(year, month, day); |
230,040 | public static void switchBranch(final GitRepository repo, final String branchName) {<NEW_LINE>String text = MessageFormat.format(Messages.SwitchBranchAction_BranchSwitch_Msg, branchName);<NEW_LINE>IStatus switchStatus = repo.switchBranch(branchName, new NullProgressMonitor());<NEW_LINE>if (!switchStatus.isOK()) {<NEW_LINE>// If we couldn't switch, surface up the output<NEW_LINE>if (switchStatus instanceof ProcessStatus) {<NEW_LINE>text = ((ProcessStatus) switchStatus).getStdErr();<NEW_LINE>} else {<NEW_LINE>text = switchStatus.getMessage();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Now show a tooltip "toast" for 3 seconds to announce success<NEW_LINE>final Shell shell = UIUtils.getActiveShell();<NEW_LINE>DefaultToolTip toolTip = new DefaultToolTip(shell) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Point getLocation(Point size, Event event) {<NEW_LINE>final Rectangle workbenchWindowBounds = shell.getBounds();<NEW_LINE>int xCoord = workbenchWindowBounds.x + workbenchWindowBounds.width - size.x - 10;<NEW_LINE>int yCoord = workbenchWindowBounds.y + workbenchWindowBounds.height - size.y - 10;<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>};<NEW_LINE>toolTip.setHideDelay(UIUtils.DEFAULT_TOOLTIP_TIME);<NEW_LINE>toolTip.setText(text);<NEW_LINE>toolTip.show(new Point(0, 0));<NEW_LINE>} | return new Point(xCoord, yCoord); |
1,463,026 | private void processEvent(final ProcessInstanceIntent intent, final BpmnElementProcessor<ExecutableFlowElement> processor, final ExecutableFlowElement element) {<NEW_LINE>switch(intent) {<NEW_LINE>case ACTIVATE_ELEMENT:<NEW_LINE>final var activatingContext = stateTransitionBehavior.transitionToActivating(context);<NEW_LINE>stateTransitionBehavior.onElementActivating(element, activatingContext).ifRightOrLeft(ok -> processor.onActivate(element, activatingContext), failure -> incidentBehavior.createIncident(failure, activatingContext));<NEW_LINE>break;<NEW_LINE>case COMPLETE_ELEMENT:<NEW_LINE>final var completingContext = stateTransitionBehavior.transitionToCompleting(context);<NEW_LINE><MASK><NEW_LINE>break;<NEW_LINE>case TERMINATE_ELEMENT:<NEW_LINE>final var terminatingContext = stateTransitionBehavior.transitionToTerminating(context);<NEW_LINE>processor.onTerminate(element, terminatingContext);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new BpmnProcessingException(context, String.format("Expected the processor '%s' to handle the event but the intent '%s' is not supported", processor.getClass(), intent));<NEW_LINE>}<NEW_LINE>} | processor.onComplete(element, completingContext); |
89,615 | public void onBackPressed() {<NEW_LINE>if (contributionsFragment != null && activeFragment == ActiveFragment.CONTRIBUTIONS) {<NEW_LINE>// Means that contribution fragment is visible<NEW_LINE>if (!contributionsFragment.backButtonClicked()) {<NEW_LINE>// If this one does not wan't to handle<NEW_LINE>// the back press, let the activity do so<NEW_LINE>super.onBackPressed();<NEW_LINE>}<NEW_LINE>} else if (nearbyParentFragment != null && activeFragment == ActiveFragment.NEARBY) {<NEW_LINE>// Means that nearby fragment is visible<NEW_LINE>if (!nearbyParentFragment.backButtonClicked()) {<NEW_LINE>getSupportFragmentManager().beginTransaction().remove(nearbyParentFragment).commit();<NEW_LINE>setSelectedItemId(<MASK><NEW_LINE>}<NEW_LINE>} else if (exploreFragment != null && activeFragment == ActiveFragment.EXPLORE) {<NEW_LINE>// Means that explore fragment is visible<NEW_LINE>if (!exploreFragment.onBackPressed()) {<NEW_LINE>if (applicationKvStore.getBoolean("login_skipped")) {<NEW_LINE>super.onBackPressed();<NEW_LINE>} else {<NEW_LINE>setSelectedItemId(NavTab.CONTRIBUTIONS.code());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (bookmarkFragment != null && activeFragment == ActiveFragment.BOOKMARK) {<NEW_LINE>// Means that bookmark fragment is visible<NEW_LINE>bookmarkFragment.onBackPressed();<NEW_LINE>} else {<NEW_LINE>super.onBackPressed();<NEW_LINE>}<NEW_LINE>} | NavTab.CONTRIBUTIONS.code()); |
639,806 | final GetTransitGatewayMulticastDomainAssociationsResult executeGetTransitGatewayMulticastDomainAssociations(GetTransitGatewayMulticastDomainAssociationsRequest getTransitGatewayMulticastDomainAssociationsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getTransitGatewayMulticastDomainAssociationsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetTransitGatewayMulticastDomainAssociationsRequest> request = null;<NEW_LINE>Response<GetTransitGatewayMulticastDomainAssociationsResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new GetTransitGatewayMulticastDomainAssociationsRequestMarshaller().marshall(super.beforeMarshalling(getTransitGatewayMulticastDomainAssociationsRequest));<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, "GetTransitGatewayMulticastDomainAssociations");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<GetTransitGatewayMulticastDomainAssociationsResult> responseHandler = new StaxResponseHandler<GetTransitGatewayMulticastDomainAssociationsResult>(new GetTransitGatewayMulticastDomainAssociationsResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.RequestMarshallTime); |
78,721 | public void refreshNode(Component nodeComponent) {<NEW_LINE>if (nodeComponent == null) {<NEW_LINE>throw new IllegalArgumentException("refreshNode expects a non-null argument");<NEW_LINE>}<NEW_LINE>Object node = nodeComponent.getClientProperty(KEY_OBJECT);<NEW_LINE>if (node == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Object nodeParent = nodeComponent.getClientProperty(KEY_PARENT);<NEW_LINE>int depth = ((Integer) nodeComponent.getClientProperty(KEY_DEPTH)).intValue();<NEW_LINE>Container parentCnt = nodeComponent.getParent();<NEW_LINE>if (parentCnt == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>boolean expanded = isExpanded(nodeComponent);<NEW_LINE>Component newCmp = createNode(node, depth);<NEW_LINE>Object current = node;<NEW_LINE>newCmp.putClientProperty(KEY_OBJECT, current);<NEW_LINE>newCmp.putClientProperty(KEY_PARENT, nodeParent);<NEW_LINE>newCmp.putClientProperty(KEY_DEPTH, depth);<NEW_LINE>newCmp.getAllStyles().setMarginLeft(nodeComponent.getStyle().getMarginLeft(nodeComponent.isRTL()));<NEW_LINE>if (model.isLeaf(current)) {<NEW_LINE>parentCnt.replace(nodeComponent, newCmp, null);<NEW_LINE>bindNodeListener(new Handler(current), newCmp);<NEW_LINE>} else {<NEW_LINE>Container componentArea = new Container(new BorderLayout());<NEW_LINE>componentArea.addComponent(BorderLayout.NORTH, newCmp);<NEW_LINE>parentCnt.getParent().replace(parentCnt, componentArea, null);<NEW_LINE>bindNodeListener(expansionListener, newCmp);<NEW_LINE>if (expanded) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>revalidateLater();<NEW_LINE>} | expandNode(false, newCmp, false); |
554,191 | public void refresh(BeanCollection<?> bc, EntityBean parentBean) {<NEW_LINE>BeanMap<?, ?> newBeanMap = (<MASK><NEW_LINE>Map<?, ?> current = (Map<?, ?>) many.getValue(parentBean);<NEW_LINE>newBeanMap.setModifyListening(many.modifyListenMode());<NEW_LINE>if (current == null) {<NEW_LINE>// the currentMap is null? Not really expecting this...<NEW_LINE>many.setValue(parentBean, newBeanMap);<NEW_LINE>} else if (current instanceof BeanMap<?, ?>) {<NEW_LINE>// normally this case, replace just the underlying list<NEW_LINE>BeanMap<?, ?> currentBeanMap = (BeanMap<?, ?>) current;<NEW_LINE>currentBeanMap.setActualMap(newBeanMap.getActualMap());<NEW_LINE>currentBeanMap.setModifyListening(many.modifyListenMode());<NEW_LINE>} else {<NEW_LINE>// replace the entire set<NEW_LINE>many.setValue(parentBean, newBeanMap);<NEW_LINE>}<NEW_LINE>} | BeanMap<?, ?>) bc; |
291,482 | private static PaddedCell check(Formatter formatter, File file, String original, int maxLength) {<NEW_LINE>if (maxLength < 2) {<NEW_LINE>throw new IllegalArgumentException("maxLength must be at least 2");<NEW_LINE>}<NEW_LINE>String appliedOnce = formatter.compute(original, file);<NEW_LINE>if (appliedOnce.equals(original)) {<NEW_LINE>return Type.CONVERGE.create(file, Collections.singletonList(appliedOnce));<NEW_LINE>}<NEW_LINE>String appliedTwice = formatter.compute(appliedOnce, file);<NEW_LINE>if (appliedOnce.equals(appliedTwice)) {<NEW_LINE>return Type.CONVERGE.create(file, Collections.singletonList(appliedOnce));<NEW_LINE>}<NEW_LINE>List<String> appliedN = new ArrayList<>();<NEW_LINE>appliedN.add(appliedOnce);<NEW_LINE>appliedN.add(appliedTwice);<NEW_LINE>String input = appliedTwice;<NEW_LINE>while (appliedN.size() < maxLength) {<NEW_LINE>String output = formatter.compute(input, file);<NEW_LINE>if (output.equals(input)) {<NEW_LINE>return Type.CONVERGE.create(file, appliedN);<NEW_LINE>} else {<NEW_LINE>int idx = appliedN.indexOf(output);<NEW_LINE>if (idx >= 0) {<NEW_LINE>return Type.CYCLE.create(file, appliedN.subList(idx<MASK><NEW_LINE>} else {<NEW_LINE>appliedN.add(output);<NEW_LINE>input = output;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return Type.DIVERGE.create(file, appliedN);<NEW_LINE>} | , appliedN.size())); |
902,958 | private void generateComparisonTable(PanelComponent panelComponent, HiscoreResult opponentSkills) {<NEW_LINE>final String opponentName = opponentSkills.getPlayer();<NEW_LINE>panelComponent.getChildren().add(TitleComponent.builder().text(opponentName).color(HIGHLIGHT_COLOR).build());<NEW_LINE>panelComponent.getChildren().add(LineComponent.builder().left(LEFT_COLUMN_HEADER).leftColor(HIGHLIGHT_COLOR).right(RIGHT_COLUMN_HEADER).rightColor<MASK><NEW_LINE>for (int i = 0; i < COMBAT_SKILLS.length; ++i) {<NEW_LINE>final HiscoreSkill hiscoreSkill = HISCORE_COMBAT_SKILLS[i];<NEW_LINE>final Skill skill = COMBAT_SKILLS[i];<NEW_LINE>final net.runelite.client.hiscore.Skill opponentSkill = opponentSkills.getSkill(hiscoreSkill);<NEW_LINE>if (opponentSkill == null || opponentSkill.getLevel() == -1) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>final int playerSkillLevel = client.getRealSkillLevel(skill);<NEW_LINE>final int opponentSkillLevel = opponentSkill.getLevel();<NEW_LINE>panelComponent.getChildren().add(LineComponent.builder().left(hiscoreSkill.getName()).right(Integer.toString(playerSkillLevel) + "/" + Integer.toString(opponentSkillLevel)).rightColor(comparisonStatColor(playerSkillLevel, opponentSkillLevel)).build());<NEW_LINE>}<NEW_LINE>} | (HIGHLIGHT_COLOR).build()); |
1,282,969 | private static void addBasicMemoryStats(List<Component> report, MemoryMXBean memoryMXBean) {<NEW_LINE>MemoryUsage heapUsage = memoryMXBean.getHeapMemoryUsage();<NEW_LINE>report.add(text().append(text(">", DARK_GRAY, BOLD)).append(space()).append(text("Memory usage:", GOLD)).build());<NEW_LINE>report.add(text().content(" ").append(text(FormatUtil.formatBytes(heapUsage.getUsed()), WHITE)).append(space()).append(text("/", GRAY)).append(space()).append(text(FormatUtil.formatBytes(heapUsage.getMax()), WHITE)).append(text(" ")).append(text("(", GRAY)).append(text(FormatUtil.percent(heapUsage.getUsed(), heapUsage.getMax()), GREEN)).append(text(")", GRAY)).build());<NEW_LINE>report.add(text().content(" ").append(StatisticFormatter.generateMemoryUsageDiagram(heapUsage, <MASK><NEW_LINE>report.add(empty());<NEW_LINE>} | 60)).build()); |
642,310 | public static void main(String[] args) {<NEW_LINE>int n = 25;<NEW_LINE>int[] tiles = { 1, 1, 2, 4 };<NEW_LINE>BoardTilingsSolver solver = new BoardTilingsSolver(tiles);<NEW_LINE>System.out.printf("f(%d) = %d\n", n, solver.iterativeSolution(n));<NEW_LINE>System.out.printf("f(%d) = %d\n", n, solver.iterativeSolution(n));<NEW_LINE>System.out.println();<NEW_LINE>for (int i = 0; i < 10; i++) {<NEW_LINE>System.out.printf("f(%d) = %d (iterative soln)\n", i, solver.iterativeSolution(i));<NEW_LINE>System.out.printf("f(%d) = %d (recursive soln)\n", i<MASK><NEW_LINE>}<NEW_LINE>// long startTime = System.currentTimeMillis();<NEW_LINE>// int n = 60000000;<NEW_LINE>// int[] tiles = {100000, 10000000, 20000000, 30000000};<NEW_LINE>// System.out.println(f(n, tiles));<NEW_LINE>// long endTime = System.currentTimeMillis();<NEW_LINE>// System.out.println("f(n) total execution time: " + (endTime - startTime));<NEW_LINE>// startTime = System.currentTimeMillis();<NEW_LINE>// System.out.println(f2(n, tiles));<NEW_LINE>// endTime = System.currentTimeMillis();<NEW_LINE>// System.out.println("f2(n) total execution time: " + (endTime - startTime));<NEW_LINE>} | , solver.recursiveSolution(i)); |
1,739,576 | private AutoScalingGroup retrieveAutoScalingGroupCrossAccount(String asgAccount, String asgName) {<NEW_LINE>logger.debug("Getting cross account ASG for asgName: {}, asgAccount: {}", asgName, asgAccount);<NEW_LINE>Credentials credentials = stsCredentials.get(asgAccount);<NEW_LINE>if (credentials == null || credentials.getExpiration().getTime() < System.currentTimeMillis() + 1000) {<NEW_LINE>stsCredentials.put(asgAccount, initializeStsSession(asgAccount));<NEW_LINE>credentials = stsCredentials.get(asgAccount);<NEW_LINE>}<NEW_LINE>ClientConfiguration clientConfiguration = new ClientConfiguration().withConnectionTimeout(serverConfig.getASGQueryTimeoutMs());<NEW_LINE>AmazonAutoScaling autoScalingClient = new AmazonAutoScalingClient(new BasicSessionCredentials(credentials.getAccessKeyId(), credentials.getSecretAccessKey(), credentials<MASK><NEW_LINE>String region = clientConfig.getRegion();<NEW_LINE>if (!region.equals("us-east-1")) {<NEW_LINE>autoScalingClient.setEndpoint("autoscaling." + region + ".amazonaws.com");<NEW_LINE>}<NEW_LINE>DescribeAutoScalingGroupsRequest request = new DescribeAutoScalingGroupsRequest().withAutoScalingGroupNames(asgName);<NEW_LINE>DescribeAutoScalingGroupsResult result = autoScalingClient.describeAutoScalingGroups(request);<NEW_LINE>List<AutoScalingGroup> asgs = result.getAutoScalingGroups();<NEW_LINE>if (asgs.isEmpty()) {<NEW_LINE>return null;<NEW_LINE>} else {<NEW_LINE>return asgs.get(0);<NEW_LINE>}<NEW_LINE>} | .getSessionToken()), clientConfiguration); |
1,847,487 | protected void find(boolean findMore) {<NEW_LINE>BestMatchFinder bmf = new BestMatchFinder(pattern);<NEW_LINE>List<MapEntity> results = getResults();<NEW_LINE>BoundingBox bb = new BoundingBox(position, nextRadius);<NEW_LINE>if (!results.isEmpty())<NEW_LINE>bmf.checkMatchQuality(results.get(0));<NEW_LINE>if (mode.equals(Mode.ENTITY) || mode.equals(Mode.NODE)) {<NEW_LINE>for (MapNode node : getStorage().getPois(bb)) {<NEW_LINE>int match = bmf.checkMatchQuality(node);<NEW_LINE>if (match >= 0) {<NEW_LINE>if (match > 0) {<NEW_LINE>results.clear();<NEW_LINE>bmf.useAsReference(node);<NEW_LINE>}<NEW_LINE>if (position.insertInAscendingDistanceOrder(results, node))<NEW_LINE>if (results.size() > 100)<NEW_LINE>results.remove(99);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (mode.equals(Mode.ENTITY) || mode.equals(Mode.WAY)) {<NEW_LINE>for (MapWay way : getStorage().getWays(bb)) {<NEW_LINE>int match = bmf.checkMatchQuality(way);<NEW_LINE>if (match >= 0) {<NEW_LINE>if (match > 0) {<NEW_LINE>results.clear();<NEW_LINE>bmf.useAsReference(way);<NEW_LINE>}<NEW_LINE>if (position.insertInAscendingDistanceOrder(results, way))<NEW_LINE>if (results.size() > 100)<NEW_LINE>results.remove(99);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (mode.equals(Mode.ADDRESS)) {<NEW_LINE>List<MapEntity> iResults = getIntermediateResults();<NEW_LINE>StringTokenizer tokenizer = new StringTokenizer(pattern, ",");<NEW_LINE>String placeName = null;<NEW_LINE>String wayName = null;<NEW_LINE>if (tokenizer.hasMoreElements())<NEW_LINE>placeName = tokenizer.nextToken();<NEW_LINE>if (tokenizer.hasMoreElements())<NEW_LINE>wayName = tokenizer.nextToken().trim();<NEW_LINE>if (placeName != null && !findMore) {<NEW_LINE>for (MapNode place : getStorage().getPlaces(placeName)) {<NEW_LINE>position.insertInAscendingDistanceOrder(iResults, place);<NEW_LINE>if (iResults.size() > 100)<NEW_LINE>iResults.remove(99);<NEW_LINE>}<NEW_LINE>nextRadius = -1;<NEW_LINE>}<NEW_LINE>if (iResults.size() == 1 && wayName != null) {<NEW_LINE>MapNode place = (MapNode) iResults.get(0);<NEW_LINE>findWay(wayName, new Position(place.getLat(), place<MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>nextRadius *= 2;<NEW_LINE>if (results.isEmpty() && getIntermediateResults().isEmpty() && nextRadius <= getMaxRadius())<NEW_LINE>find(true);<NEW_LINE>}<NEW_LINE>} | .getLon()), null); |
447,551 | public void tickFlower() {<NEW_LINE>super.tickFlower();<NEW_LINE>if (getLevel().isClientSide) {<NEW_LINE>double particleChance = 1F - (double) getMana() / (double) getMaxMana() / 3.5F;<NEW_LINE>int color = getColor();<NEW_LINE>float red = (color <MASK><NEW_LINE>float green = (color >> 8 & 0xFF) / 255F;<NEW_LINE>float blue = (color & 0xFF) / 255F;<NEW_LINE>if (Math.random() > particleChance) {<NEW_LINE>Vec3 offset = getLevel().getBlockState(getBlockPos()).getOffset(getLevel(), getBlockPos());<NEW_LINE>double x = getBlockPos().getX() + offset.x;<NEW_LINE>double y = getBlockPos().getY() + offset.y;<NEW_LINE>double z = getBlockPos().getZ() + offset.z;<NEW_LINE>BotaniaAPI.instance().sparkleFX(getLevel(), x + 0.3 + Math.random() * 0.5, y + 0.5 + Math.random() * 0.5, z + 0.3 + Math.random() * 0.5, red, green, blue, (float) Math.random(), 5);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>emptyManaIntoCollector();<NEW_LINE>} | >> 16 & 0xFF) / 255F; |
645,366 | private File showFileChooser(final String title, final int mode, final int theSelectionMode, final Object... filters) {<NEW_LINE>final String theLast_dir = PreferencesUser.getInstance().get("LAST_OPEN_DIR", "");<NEW_LINE>Debug.log(3, "showFileChooser: %s at %s", title.split(<MASK><NEW_LINE>final Object[] result = new Object[] { null };<NEW_LINE>if (isGeneric()) {<NEW_LINE>try {<NEW_LINE>EventQueue.invokeAndWait(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>processDialog(theSelectionMode, theLast_dir, title, mode, filters, result);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} catch (Exception e) {<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>processDialog(theSelectionMode, theLast_dir, title, mode, filters, result);<NEW_LINE>}<NEW_LINE>if (null != result[0]) {<NEW_LINE>File fileChoosen = (File) result[0];<NEW_LINE>String lastDir = fileChoosen.getParent();<NEW_LINE>if (null == lastDir) {<NEW_LINE>lastDir = fileChoosen.getAbsolutePath();<NEW_LINE>}<NEW_LINE>PreferencesUser.getInstance().put("LAST_OPEN_DIR", lastDir);<NEW_LINE>return fileChoosen;<NEW_LINE>} else {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | " ")[0], theLast_dir); |
712,876 | final RetryStageExecutionResult executeRetryStageExecution(RetryStageExecutionRequest retryStageExecutionRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(retryStageExecutionRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<RetryStageExecutionRequest> request = null;<NEW_LINE>Response<RetryStageExecutionResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new RetryStageExecutionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(retryStageExecutionRequest));<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, "CodePipeline");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RetryStageExecution");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<RetryStageExecutionResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new RetryStageExecutionResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.RequestMarshallTime); |
1,766,379 | private static int[] clippedPadding(int[] padding, RCTMGLMapView mapView) {<NEW_LINE>int mapHeight = mapView.getHeight();<NEW_LINE>int mapWidth = mapView.getWidth();<NEW_LINE>int left = padding[0];<NEW_LINE>int top = padding[1];<NEW_LINE>int right = padding[2];<NEW_LINE>int bottom = padding[3];<NEW_LINE>int resultLeft = left;<NEW_LINE>int resultTop = top;<NEW_LINE>int resultRight = right;<NEW_LINE>int resultBottom = bottom;<NEW_LINE>if (top + bottom >= mapHeight) {<NEW_LINE>double totalPadding = top + bottom;<NEW_LINE>// add 1 to compensate for floating point math<NEW_LINE><MASK><NEW_LINE>resultTop -= (top * extra) / totalPadding;<NEW_LINE>resultBottom -= (bottom * extra) / totalPadding;<NEW_LINE>}<NEW_LINE>if (left + right >= mapWidth) {<NEW_LINE>double totalPadding = left + right;<NEW_LINE>// add 1 to compensate for floating point math<NEW_LINE>double extra = totalPadding - mapWidth + 1.0;<NEW_LINE>resultLeft -= (left * extra) / totalPadding;<NEW_LINE>resultRight -= (right * extra) / totalPadding;<NEW_LINE>}<NEW_LINE>return new int[] { resultLeft, resultTop, resultRight, resultBottom };<NEW_LINE>} | double extra = totalPadding - mapHeight + 1.0; |
1,624,537 | private CacheStatus collectStatus() {<NEW_LINE>final int cg = this.currentGeneration.get();<NEW_LINE>int minGeneration = cg;<NEW_LINE>int maxGeneration = 0;<NEW_LINE>ArrayList<Client> toUnregister = new ArrayList<>();<NEW_LINE>for (Client c : getClients()) {<NEW_LINE>CacheStatus clientStatus;<NEW_LINE>try {<NEW_LINE>clientStatus = c.getCacheStatus();<NEW_LINE>if (clientStatus.isEmpty()) {<NEW_LINE>// Nothing useful for this one.<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>} catch (ObjectClosedException ex) {<NEW_LINE>// This object was closed but it was not unregistered. Do it now.<NEW_LINE>log.info("{} Detected closed client {}.", TRACE_OBJECT_ID, c);<NEW_LINE>toUnregister.add(c);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (clientStatus.oldestGeneration > cg || clientStatus.newestGeneration > cg) {<NEW_LINE>log.warn("{} Client {} returned status that is out of bounds {}. CurrentGeneration = {}, OldestGeneration = {}.", TRACE_OBJECT_ID, c, <MASK><NEW_LINE>}<NEW_LINE>minGeneration = Math.min(minGeneration, clientStatus.oldestGeneration);<NEW_LINE>maxGeneration = Math.max(maxGeneration, clientStatus.newestGeneration);<NEW_LINE>}<NEW_LINE>toUnregister.forEach(this::unregister);<NEW_LINE>if (minGeneration > maxGeneration) {<NEW_LINE>// Either no clients or clients are empty.<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return new CacheStatus(minGeneration, maxGeneration);<NEW_LINE>} | clientStatus, cg, this.oldestGeneration); |
452,320 | private OrgPermissions retrieveRoleOrgPermissions(final RoleOrgPermissionsCacheKey key) {<NEW_LINE>final RoleId adRoleId = key.getRoleId();<NEW_LINE>final AdTreeId adTreeOrgId = key.getAdTreeOrgId();<NEW_LINE>final ImmutableMap<OrgId, I_AD_Org> activeOrgsById = Maps.uniqueIndex(orgDAO.getAllActiveOrgs(), org -> OrgId.ofRepoId(org.getAD_Org_ID()));<NEW_LINE>final OrgPermissions.Builder builder = OrgPermissions.builder(adTreeOrgId);<NEW_LINE>if (activeOrgsById.isEmpty()) {<NEW_LINE>return builder.build();<NEW_LINE>}<NEW_LINE>final List<I_AD_Role_OrgAccess> orgAccessesList = queryBL.createQueryBuilderOutOfTrx(I_AD_Role_OrgAccess.class).addEqualsFilter(I_AD_Role_OrgAccess.COLUMNNAME_AD_Role_ID, adRoleId).addOnlyActiveRecordsFilter().addInArrayFilter(I_AD_Role_OrgAccess.COLUMNNAME_AD_Org_ID, activeOrgsById.keySet()).create().list();<NEW_LINE>for (final I_AD_Role_OrgAccess oa : orgAccessesList) {<NEW_LINE>// NOTE: we are fetching the AD_Client_ID from OrgAccess and not from AD_Org (very important for Org=0 like) !<NEW_LINE>final ClientId clientId = ClientId.ofRepoId(oa.getAD_Client_ID());<NEW_LINE>final OrgId orgId = OrgId.ofRepoId(oa.getAD_Org_ID());<NEW_LINE>final boolean isGroupingOrg = activeOrgsById.<MASK><NEW_LINE>final OrgResource resource = OrgResource.of(clientId, orgId, isGroupingOrg);<NEW_LINE>final OrgPermission permission = OrgPermission.ofResourceAndReadOnly(resource, oa.isReadOnly());<NEW_LINE>builder.addPermissionRecursively(permission);<NEW_LINE>}<NEW_LINE>return builder.build();<NEW_LINE>} | get(orgId).isSummary(); |
879,335 | public static void formatImportStatements(final SourceFile sourceFile, final AbstractSchemaNode schemaNode, final Class baseType) {<NEW_LINE>sourceFile.importLine(baseType.getName());<NEW_LINE>sourceFile.importLine(DateArrayPropertyParser.class.getName());<NEW_LINE>sourceFile.importLine(ConfigurationProvider.class.getName());<NEW_LINE>sourceFile.importLine(PermissionPropagation.class.getName());<NEW_LINE>sourceFile.importLine(PropagationDirection.class.getName());<NEW_LINE>sourceFile.importLine(FrameworkException.class.getName());<NEW_LINE>sourceFile.importLine(DatePropertyParser.class.getName());<NEW_LINE>sourceFile.importLine(<MASK><NEW_LINE>sourceFile.importLine(PropertyConverter.class.getName());<NEW_LINE>sourceFile.importLine(ValidationHelper.class.getName());<NEW_LINE>sourceFile.importLine(PropagationMode.class.getName());<NEW_LINE>sourceFile.importLine(SecurityContext.class.getName());<NEW_LINE>sourceFile.importLine(LinkedHashSet.class.getName());<NEW_LINE>sourceFile.importLine(PropertyView.class.getName());<NEW_LINE>sourceFile.importLine(Cardinality.class.getName());<NEW_LINE>sourceFile.importLine(GraphObject.class.getName());<NEW_LINE>sourceFile.importLine(ErrorBuffer.class.getName());<NEW_LINE>sourceFile.importLine(StringUtils.class.getName());<NEW_LINE>sourceFile.importLine(Collections.class.getName());<NEW_LINE>sourceFile.importLine(StructrApp.class.getName());<NEW_LINE>sourceFile.importLine(LinkedList.class.getName());<NEW_LINE>sourceFile.importLine(Collection.class.getName());<NEW_LINE>sourceFile.importLine(Permission.class.getName());<NEW_LINE>sourceFile.importLine(Direction.class.getName());<NEW_LINE>sourceFile.importLine(Iterables.class.getName());<NEW_LINE>sourceFile.importLine(Services.class.getName());<NEW_LINE>sourceFile.importLine(Actions.class.getName());<NEW_LINE>sourceFile.importLine(HashMap.class.getName());<NEW_LINE>sourceFile.importLine(HashSet.class.getName());<NEW_LINE>sourceFile.importLine(Arrays.class.getName());<NEW_LINE>sourceFile.importLine(Export.class.getName());<NEW_LINE>sourceFile.importLine(View.class.getName());<NEW_LINE>sourceFile.importLine(List.class.getName());<NEW_LINE>sourceFile.importLine(Set.class.getName());<NEW_LINE>sourceFile.importLine(Date.class.getName());<NEW_LINE>if (hasRestClasses()) {<NEW_LINE>sourceFile.importLine("org.structr.rest.RestMethodResult");<NEW_LINE>}<NEW_LINE>sourceFile.importLine("org.structr.core.property.*");<NEW_LINE>if (hasUiClasses()) {<NEW_LINE>sourceFile.importLine("org.structr.web.property.*");<NEW_LINE>}<NEW_LINE>for (final StructrModule module : StructrApp.getConfiguration().getModules().values()) {<NEW_LINE>module.insertImportStatements(schemaNode, sourceFile);<NEW_LINE>}<NEW_LINE>sourceFile.importLine("org.structr.core.notion.*");<NEW_LINE>sourceFile.importLine("org.structr.core.entity.*");<NEW_LINE>} | ModificationQueue.class.getName()); |
1,408,599 | final TagStreamResult executeTagStream(TagStreamRequest tagStreamRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(tagStreamRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<TagStreamRequest> request = null;<NEW_LINE>Response<TagStreamResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new TagStreamRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(tagStreamRequest));<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, "Kinesis Video");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "TagStream");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<TagStreamResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(<MASK><NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | false), new TagStreamResultJsonUnmarshaller()); |
934,653 | public void rewriteServerbound(ByteBuf packet, int oldId, int newId) {<NEW_LINE>super.rewriteServerbound(packet, oldId, newId);<NEW_LINE>// Special cases<NEW_LINE>int readerIndex = packet.readerIndex();<NEW_LINE>int packetId = DefinedPacket.readVarInt(packet);<NEW_LINE>int packetIdLength = packet.readerIndex() - readerIndex;<NEW_LINE>if (packetId == 0x28 && /* Spectate : PacketPlayInSpectate */<NEW_LINE>!BungeeCord.getInstance().getConfig().isIpForward()) {<NEW_LINE>UUID uuid = DefinedPacket.readUUID(packet);<NEW_LINE>ProxiedPlayer player;<NEW_LINE>if ((player = BungeeCord.getInstance().getPlayer(uuid)) != null) {<NEW_LINE>int previous = packet.writerIndex();<NEW_LINE>packet.readerIndex(readerIndex);<NEW_LINE><MASK><NEW_LINE>DefinedPacket.writeUUID(((UserConnection) player).getPendingConnection().getOfflineId(), packet);<NEW_LINE>packet.writerIndex(previous);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>packet.readerIndex(readerIndex);<NEW_LINE>} | packet.writerIndex(readerIndex + packetIdLength); |
194,604 | public final MonthPartContext monthPart() throws RecognitionException {<NEW_LINE>MonthPartContext _localctx = new MonthPartContext(_ctx, getState());<NEW_LINE><MASK><NEW_LINE>int _la;<NEW_LINE>try {<NEW_LINE>enterOuterAlt(_localctx, 1);<NEW_LINE>{<NEW_LINE>setState(3255);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>switch(_input.LA(1)) {<NEW_LINE>case PLUS:<NEW_LINE>case MINUS:<NEW_LINE>case IntegerLiteral:<NEW_LINE>case FloatingPointLiteral:<NEW_LINE>{<NEW_LINE>setState(3252);<NEW_LINE>numberconstant();<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case IDENT:<NEW_LINE>{<NEW_LINE>setState(3253);<NEW_LINE>((MonthPartContext) _localctx).i = match(IDENT);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case QUESTION:<NEW_LINE>{<NEW_LINE>setState(3254);<NEW_LINE>substitution();<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new NoViableAltException(this);<NEW_LINE>}<NEW_LINE>setState(3257);<NEW_LINE>_la = _input.LA(1);<NEW_LINE>if (!(_la == TIMEPERIOD_MONTH || _la == TIMEPERIOD_MONTHS)) {<NEW_LINE>_errHandler.recoverInline(this);<NEW_LINE>} else {<NEW_LINE>if (_input.LA(1) == Token.EOF)<NEW_LINE>matchedEOF = true;<NEW_LINE>_errHandler.reportMatch(this);<NEW_LINE>consume();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (RecognitionException re) {<NEW_LINE>_localctx.exception = re;<NEW_LINE>_errHandler.reportError(this, re);<NEW_LINE>_errHandler.recover(this, re);<NEW_LINE>} finally {<NEW_LINE>exitRule();<NEW_LINE>}<NEW_LINE>return _localctx;<NEW_LINE>} | enterRule(_localctx, 486, RULE_monthPart); |
969,556 | public static void drawRain(float sizeMin, float sizeMax, float xspeed, float yspeed, float density, float intensity, float stroke, Color color) {<NEW_LINE>rand.setSeed(0);<NEW_LINE>float padding = sizeMax * 0.9f;<NEW_LINE>Tmp.r1.setCentered(Core.camera.position.x, Core.camera.position.y, Core.graphics.getWidth() / renderer.minScale(), Core.graphics.getHeight() / renderer.minScale());<NEW_LINE>Tmp.r1.grow(padding);<NEW_LINE>Core.camera.bounds(Tmp.r2);<NEW_LINE>int total = (int) (Tmp.r1.<MASK><NEW_LINE>Lines.stroke(stroke);<NEW_LINE>float alpha = Draw.getColor().a;<NEW_LINE>Draw.color(color);<NEW_LINE>for (int i = 0; i < total; i++) {<NEW_LINE>float scl = rand.random(0.5f, 1f);<NEW_LINE>float scl2 = rand.random(0.5f, 1f);<NEW_LINE>float size = rand.random(sizeMin, sizeMax);<NEW_LINE>float x = (rand.random(0f, world.unitWidth()) + Time.time * xspeed * scl2);<NEW_LINE>float y = (rand.random(0f, world.unitHeight()) - Time.time * yspeed * scl);<NEW_LINE>float tint = rand.random(1f) * alpha;<NEW_LINE>x -= Tmp.r1.x;<NEW_LINE>y -= Tmp.r1.y;<NEW_LINE>x = Mathf.mod(x, Tmp.r1.width);<NEW_LINE>y = Mathf.mod(y, Tmp.r1.height);<NEW_LINE>x += Tmp.r1.x;<NEW_LINE>y += Tmp.r1.y;<NEW_LINE>if (Tmp.r3.setCentered(x, y, size).overlaps(Tmp.r2)) {<NEW_LINE>Draw.alpha(tint);<NEW_LINE>Lines.lineAngle(x, y, Angles.angle(xspeed * scl2, -yspeed * scl), size / 2f);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | area() / density * intensity); |
554,835 | static <// / @Generated("This method was generated using jOOQ-tools")<NEW_LINE>T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> Seq<Tuple15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>> crossJoin(Stream<? extends T1> s1, Stream<? extends T2> s2, Stream<? extends T3> s3, Stream<? extends T4> s4, Stream<? extends T5> s5, Stream<? extends T6> s6, Stream<? extends T7> s7, Stream<? extends T8> s8, Stream<? extends T9> s9, Stream<? extends T10> s10, Stream<? extends T11> s11, Stream<? extends T12> s12, Stream<? extends T13> s13, Stream<? extends T14> s14, Stream<? extends T15> s15) {<NEW_LINE>return crossJoin(seq(s1), seq(s2), seq(s3), seq(s4), seq(s5), seq(s6), seq(s7), seq(s8), seq(s9), seq(s10), seq(s11), seq(s12), seq(s13), seq(<MASK><NEW_LINE>} | s14), seq(s15)); |
963,634 | void createAnonymousFilter() {<NEW_LINE>Element anonymousElt = DomUtils.getChildElementByTagName(<MASK><NEW_LINE>if (anonymousElt != null && "false".equals(anonymousElt.getAttribute("enabled"))) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String grantedAuthority = null;<NEW_LINE>String username = null;<NEW_LINE>String key = null;<NEW_LINE>Object source = this.pc.extractSource(this.httpElt);<NEW_LINE>if (anonymousElt != null) {<NEW_LINE>grantedAuthority = anonymousElt.getAttribute("granted-authority");<NEW_LINE>username = anonymousElt.getAttribute("username");<NEW_LINE>key = anonymousElt.getAttribute(ATT_KEY);<NEW_LINE>source = this.pc.extractSource(anonymousElt);<NEW_LINE>}<NEW_LINE>if (!StringUtils.hasText(grantedAuthority)) {<NEW_LINE>grantedAuthority = "ROLE_ANONYMOUS";<NEW_LINE>}<NEW_LINE>if (!StringUtils.hasText(username)) {<NEW_LINE>username = "anonymousUser";<NEW_LINE>}<NEW_LINE>if (!StringUtils.hasText(key)) {<NEW_LINE>// Generate a random key for the Anonymous provider<NEW_LINE>key = createKey();<NEW_LINE>}<NEW_LINE>this.anonymousFilter = new RootBeanDefinition(AnonymousAuthenticationFilter.class);<NEW_LINE>this.anonymousFilter.getConstructorArgumentValues().addIndexedArgumentValue(0, key);<NEW_LINE>this.anonymousFilter.getConstructorArgumentValues().addIndexedArgumentValue(1, username);<NEW_LINE>this.anonymousFilter.getConstructorArgumentValues().addIndexedArgumentValue(2, AuthorityUtils.commaSeparatedStringToAuthorityList(grantedAuthority));<NEW_LINE>this.anonymousFilter.setSource(source);<NEW_LINE>RootBeanDefinition anonymousProviderBean = new RootBeanDefinition(AnonymousAuthenticationProvider.class);<NEW_LINE>anonymousProviderBean.getConstructorArgumentValues().addIndexedArgumentValue(0, key);<NEW_LINE>anonymousProviderBean.setSource(this.anonymousFilter.getSource());<NEW_LINE>String id = this.pc.getReaderContext().generateBeanName(anonymousProviderBean);<NEW_LINE>this.pc.registerBeanComponent(new BeanComponentDefinition(anonymousProviderBean, id));<NEW_LINE>this.anonymousProviderRef = new RuntimeBeanReference(id);<NEW_LINE>} | this.httpElt, Elements.ANONYMOUS); |
355,020 | private static void paintArrowIcon(Graphics g, int x, int y) {<NEW_LINE>JMenuItem menu = new JMenuItem();<NEW_LINE>if (subMenuIconIsSynthIcon) {<NEW_LINE>// #181206: the subMenuIcon is a sun.swing.plaf.synth.SynthIcon, whose paintIcon method requires a SynthContext.<NEW_LINE>// see also 6635110<NEW_LINE>try {<NEW_LINE>Region region = SynthLookAndFeel.getRegion(menu);<NEW_LINE>SynthStyle style = SynthLookAndFeel.getStyle(menu, region);<NEW_LINE>SynthContext c = new SynthContext(menu, region, style, SynthConstants.ENABLED);<NEW_LINE>Method paitIcon = synthIcon.getDeclaredMethod("paintIcon", SynthContext.class, Graphics.class, int.class, int.class, <MASK><NEW_LINE>paitIcon.invoke(subMenuIcon, c, g, x, y, subMenuIcon.getIconWidth(), subMenuIcon.getIconHeight());<NEW_LINE>return;<NEW_LINE>} catch (IllegalAccessException ex) {<NEW_LINE>LOG.log(Level.FINE, null, ex);<NEW_LINE>return;<NEW_LINE>} catch (IllegalArgumentException ex) {<NEW_LINE>LOG.log(Level.FINE, null, ex);<NEW_LINE>return;<NEW_LINE>} catch (InvocationTargetException ex) {<NEW_LINE>LOG.log(Level.FINE, null, ex);<NEW_LINE>return;<NEW_LINE>} catch (NoSuchMethodException ex) {<NEW_LINE>LOG.log(Level.FINE, null, ex);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>subMenuIcon.paintIcon(menu, g, x, y);<NEW_LINE>} | int.class, int.class); |
1,539,405 | public ListEventTypesFilter unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ListEventTypesFilter listEventTypesFilter = new ListEventTypesFilter();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("Name", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listEventTypesFilter.setName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("Value", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listEventTypesFilter.setValue(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return listEventTypesFilter;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
1,504,853 | private static void logState(final MessageFrame frame, final Gas currentGasCost) {<NEW_LINE>if (LOG.isTraceEnabled()) {<NEW_LINE>final StringBuilder builder = new StringBuilder();<NEW_LINE>builder.append("Depth: ").append(frame.getMessageStackDepth()).append("\n");<NEW_LINE>builder.append("Operation: ").append(frame.getCurrentOperation().getName()).append("\n");<NEW_LINE>builder.append("PC: ").append(frame.getPC()).append("\n");<NEW_LINE>builder.append("Gas cost: ").append<MASK><NEW_LINE>builder.append("Gas Remaining: ").append(frame.getRemainingGas()).append("\n");<NEW_LINE>builder.append("Depth: ").append(frame.getMessageStackDepth()).append("\n");<NEW_LINE>builder.append("Stack:");<NEW_LINE>for (int i = 0; i < frame.stackSize(); ++i) {<NEW_LINE>builder.append("\n\t").append(i).append(" ").append(frame.getStackItem(i));<NEW_LINE>}<NEW_LINE>LOG.trace(builder.toString());<NEW_LINE>}<NEW_LINE>} | (currentGasCost).append("\n"); |
1,632,848 | public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {<NEW_LINE>if (((bitField0_ & 0x00000001) == 0x00000001)) {<NEW_LINE>output.writeInt64(1, tag_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000002) == 0x00000002)) {<NEW_LINE>output.writeEnum(2, type_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000004) == 0x00000004)) {<NEW_LINE>output.<MASK><NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000008) == 0x00000008)) {<NEW_LINE>output.writeFloat(11, radius_);<NEW_LINE>}<NEW_LINE>for (int i = 0; i < points_.size(); i++) {<NEW_LINE>output.writeMessage(20, points_.get(i));<NEW_LINE>}<NEW_LINE>for (int i = 0; i < normals_.size(); i++) {<NEW_LINE>output.writeMessage(21, normals_.get(i));<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000010) == 0x00000010)) {<NEW_LINE>output.writeMessage(22, getCentroid());<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000020) == 0x00000020)) {<NEW_LINE>output.writeMessage(30, getV0());<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000040) == 0x00000040)) {<NEW_LINE>output.writeMessage(31, getV1());<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000080) == 0x00000080)) {<NEW_LINE>output.writeMessage(32, getV2());<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000100) == 0x00000100)) {<NEW_LINE>output.writeMessage(33, getV3());<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000200) == 0x00000200)) {<NEW_LINE>output.writeBool(34, has0_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000400) == 0x00000400)) {<NEW_LINE>output.writeBool(35, has3_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000800) == 0x00000800)) {<NEW_LINE>output.writeMessage(40, getPrev());<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00001000) == 0x00001000)) {<NEW_LINE>output.writeMessage(41, getNext());<NEW_LINE>}<NEW_LINE>unknownFields.writeTo(output);<NEW_LINE>} | writeMessage(10, getCenter()); |
641,204 | private void writeAttributes(JadeModel model, MixinNode mixin, JadeTemplate template) {<NEW_LINE>// model.put("attributes", mergeInheritedAttributes(model));<NEW_LINE>// model.put("attributes", getArguments());<NEW_LINE>LinkedList<Attr> newAttributes = new LinkedList<Attr>(attributes);<NEW_LINE>if (attributeBlocks.size() > 0) {<NEW_LINE>// Todo: AttributesBlock needs to be evaluated<NEW_LINE>for (String attributeBlock : attributeBlocks) {<NEW_LINE>Object o = null;<NEW_LINE>try {<NEW_LINE>o = template.getExpressionHandler().evaluateExpression(attributeBlock, model);<NEW_LINE>} catch (ExpressionException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>if (o != null) {<NEW_LINE>if (o instanceof Map) {<NEW_LINE>for (Map.Entry<String, String> entry : ((Map<String, String>) o).entrySet()) {<NEW_LINE>Attr attr = new Attr(entry.getKey(), entry.getValue(), false);<NEW_LINE>newAttributes.add(attr);<NEW_LINE>}<NEW_LINE>} else if (o instanceof String) {<NEW_LINE>System.out.print(o);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (newAttributes.size() > 0) {<NEW_LINE>LinkedHashMap<String, String> attrs = attrs(model, template, newAttributes);<NEW_LINE>model.put("attributes", attrs);<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | model.put("attributes", null); |
476,820 | private CctopInvoice createEDIInvoiceFromXMLBean(final EDICctopInvoicVType xmlCctopInvoice, final DecimalFormat decimalFormat, final Exchange exchange) {<NEW_LINE>final CctopInvoice invoice = new CctopInvoice();<NEW_LINE>invoice.setCbPartnerLocationID(formatNumber(xmlCctopInvoice.getCBPartnerLocationID(), decimalFormat));<NEW_LINE>invoice.setcInvoiceID(formatNumber(xmlCctopInvoice.getCInvoiceID(), decimalFormat));<NEW_LINE>// set CreditMemo-related data if the C_Invoice is actually a CreditMemo<NEW_LINE>{<NEW_LINE>final CCreditMemoReasonEnum creditMemoReason = xmlCctopInvoice.getCreditMemoReason();<NEW_LINE>final String creditMemoReasonStr;<NEW_LINE>if (creditMemoReason == null) {<NEW_LINE>creditMemoReasonStr = "";<NEW_LINE>} else {<NEW_LINE>// TODO: see 05725 comments regarding this field; we might need an additional field OR make a proper message out of this 3-char string<NEW_LINE>creditMemoReasonStr = creditMemoReason.toString();<NEW_LINE>}<NEW_LINE>invoice.setCreditMemoReason(creditMemoReasonStr);<NEW_LINE>invoice.setCreditMemoReasonText(xmlCctopInvoice.getCreditMemoReasonText());<NEW_LINE>invoice.setEancomDoctype(xmlCctopInvoice.getEancomDoctype());<NEW_LINE>}<NEW_LINE>invoice.setDateInvoiced(toDate(xmlCctopInvoice.getDateInvoiced()));<NEW_LINE>invoice.setDateOrdered(toDate(xmlCctopInvoice.getDateOrdered()));<NEW_LINE>invoice.setGrandTotal(formatNumber(xmlCctopInvoice.getGrandTotal(), decimalFormat));<NEW_LINE>invoice.setInvoiceDocumentno(xmlCctopInvoice.getInvoiceDocumentno());<NEW_LINE>invoice.setIsoCode(xmlCctopInvoice.getISOCode());<NEW_LINE>invoice.setMovementDate(toDate(xmlCctopInvoice.getMovementDate()));<NEW_LINE>// 05768<NEW_LINE>if (xmlCctopInvoice.getPOReference() != null && !xmlCctopInvoice.getPOReference().isEmpty()) {<NEW_LINE>invoice.setPoReference(xmlCctopInvoice.getPOReference());<NEW_LINE>} else if (xmlCctopInvoice.getShipmentDocumentno() != null && !xmlCctopInvoice.getShipmentDocumentno().isEmpty()) {<NEW_LINE>invoice.setPoReference(Util.mkOwnOrderNumber(xmlCctopInvoice.getShipmentDocumentno()));<NEW_LINE>} else {<NEW_LINE>invoice.setPoReference(Util.mkOwnOrderNumber(xmlCctopInvoice.getInvoiceDocumentno()));<NEW_LINE>}<NEW_LINE>invoice.setReceivergln(xmlCctopInvoice.getReceivergln());<NEW_LINE>invoice.setSendergln(xmlCctopInvoice.getSendergln());<NEW_LINE>invoice.setShipmentDocumentno(xmlCctopInvoice.getShipmentDocumentno());<NEW_LINE>invoice.setVataxID(xmlCctopInvoice.getVATaxID());<NEW_LINE>// invoice.setTotalLines(formatNumber(xmlCctopInvoice.getTotalLines(), decimalFormat)); // not used<NEW_LINE>invoice.setTotaltaxbaseamt(formatNumber(xmlCctopInvoice<MASK><NEW_LINE>invoice.setTotalvat(formatNumber(xmlCctopInvoice.getTotalvat(), decimalFormat));<NEW_LINE>invoice.setCountryCode(xmlCctopInvoice.getCountryCode());<NEW_LINE>invoice.setCountryCode3Digit(xmlCctopInvoice.getCountryCode3Digit());<NEW_LINE>invoice.setCctop000V(createCctop000V(xmlCctopInvoice, decimalFormat, exchange));<NEW_LINE>invoice.setCctop111V(createCctop111V(xmlCctopInvoice, decimalFormat));<NEW_LINE>invoice.setCctop119V(createCctop119VList(xmlCctopInvoice.getEDICctop119V(), decimalFormat));<NEW_LINE>invoice.setCctop120V(createCctop120VList(xmlCctopInvoice.getEDICctop120V(), decimalFormat));<NEW_LINE>invoice.setCctop140V(createCctop140VList(xmlCctopInvoice.getEDICctop140V(), decimalFormat));<NEW_LINE>invoice.setCctop901991V(createCctop901991VList(xmlCctopInvoice.getEDICctop901991V(), decimalFormat));<NEW_LINE>// requirement, lines need to be sorted<NEW_LINE>xmlCctopInvoice.getEDICctopInvoic500V().sort(Comparator.comparing(EDICctopInvoic500VType::getLine));<NEW_LINE>invoice.setCctopInvoice500V(createCctopInvoice500VList(xmlCctopInvoice.getEDICctopInvoic500V(), decimalFormat));<NEW_LINE>invoice.setCurrentDate(SystemTime.asDate());<NEW_LINE>return invoice;<NEW_LINE>} | .getTotaltaxbaseamt(), decimalFormat)); |
1,504,800 | // for test<NEW_LINE>SpanChunkBo newSpanChunkBo(PSpanChunk pSpanChunk, Header header) {<NEW_LINE>final SpanChunkBo spanChunkBo = new SpanChunkBo();<NEW_LINE>spanChunkBo.setVersion(pSpanChunk.getVersion());<NEW_LINE>spanChunkBo.setAgentId(header.getAgentId());<NEW_LINE>spanChunkBo.setApplicationId(header.getApplicationName());<NEW_LINE>spanChunkBo.setAgentStartTime(header.getAgentStartTime());<NEW_LINE>spanChunkBo.setApplicationServiceType((short) pSpanChunk.getApplicationServiceType());<NEW_LINE>if (pSpanChunk.hasTransactionId()) {<NEW_LINE>PTransactionId pTransactionId = pSpanChunk.getTransactionId();<NEW_LINE>TransactionId transactionId = newTransactionId(<MASK><NEW_LINE>spanChunkBo.setTransactionId(transactionId);<NEW_LINE>} else {<NEW_LINE>logger.warn("PTransactionId is not set {}", pSpanChunk);<NEW_LINE>throw new IllegalStateException("PTransactionId is not set");<NEW_LINE>}<NEW_LINE>spanChunkBo.setKeyTime(pSpanChunk.getKeyTime());<NEW_LINE>spanChunkBo.setSpanId(pSpanChunk.getSpanId());<NEW_LINE>spanChunkBo.setEndPoint(pSpanChunk.getEndPoint());<NEW_LINE>return spanChunkBo;<NEW_LINE>} | pTransactionId, spanChunkBo.getAgentId()); |
1,103,581 | public JSONObject updatePluginSetting(final String pluginId, final String setting) {<NEW_LINE>final JSONObject ret = new JSONObject();<NEW_LINE>final Map<String, String> langs = langPropsService.getAll(Latkes.getLocale());<NEW_LINE>final List<AbstractPlugin> plugins = pluginManager.getPlugins();<NEW_LINE>for (final AbstractPlugin plugin : plugins) {<NEW_LINE>if (plugin.getId().equals(pluginId)) {<NEW_LINE>final Transaction transaction = pluginRepository.beginTransaction();<NEW_LINE>try {<NEW_LINE>final JSONObject pluginJson = plugin.toJSONObject();<NEW_LINE>pluginJson.put(Plugin.PLUGIN_SETTING, setting);<NEW_LINE>pluginRepository.update(pluginId, pluginJson);<NEW_LINE>transaction.commit();<NEW_LINE>ret.put(Keys.CODE, StatusCodes.SUCC);<NEW_LINE>ret.put(Keys.MSG<MASK><NEW_LINE>return ret;<NEW_LINE>} catch (final Exception e) {<NEW_LINE>if (transaction.isActive()) {<NEW_LINE>transaction.rollback();<NEW_LINE>}<NEW_LINE>LOGGER.log(Level.ERROR, "Set plugin status error", e);<NEW_LINE>ret.put(Keys.CODE, StatusCodes.ERR);<NEW_LINE>ret.put(Keys.MSG, langs.get("setFailLabel"));<NEW_LINE>return ret;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ret.put(Keys.CODE, StatusCodes.ERR);<NEW_LINE>ret.put(Keys.MSG, langs.get("refreshAndRetryLabel"));<NEW_LINE>return ret;<NEW_LINE>} | , langs.get("setSuccLabel")); |
618,661 | public ApiResponse<Void> testInlineAdditionalPropertiesWithHttpInfo(Map<String, String> param) throws ApiException {<NEW_LINE>HttpRequest<MASK><NEW_LINE>try {<NEW_LINE>HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(localVarRequestBuilder.build(), HttpResponse.BodyHandlers.ofInputStream());<NEW_LINE>if (memberVarResponseInterceptor != null) {<NEW_LINE>memberVarResponseInterceptor.accept(localVarResponse);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>if (localVarResponse.statusCode() / 100 != 2) {<NEW_LINE>throw getApiException("testInlineAdditionalProperties", localVarResponse);<NEW_LINE>}<NEW_LINE>return new ApiResponse<Void>(localVarResponse.statusCode(), localVarResponse.headers().map(), null);<NEW_LINE>} finally {<NEW_LINE>// Drain the InputStream<NEW_LINE>while (localVarResponse.body().read() != -1) {<NEW_LINE>// Ignore<NEW_LINE>}<NEW_LINE>localVarResponse.body().close();<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new ApiException(e);<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>Thread.currentThread().interrupt();<NEW_LINE>throw new ApiException(e);<NEW_LINE>}<NEW_LINE>} | .Builder localVarRequestBuilder = testInlineAdditionalPropertiesRequestBuilder(param); |
1,599,531 | protected void perform(final DefaultMutableTreeNode node, final DiagnosticsNode diagnosticsNode, final AnActionEvent e) {<NEW_LINE>final Project project = e.getProject();<NEW_LINE>if (project == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>FlutterInitializer.getAnalytics().sendEvent("inspector", id);<NEW_LINE>final XNavigatable navigatable = sourcePosition -> {<NEW_LINE>if (sourcePosition != null) {<NEW_LINE>// noinspection CodeBlock2Expr<NEW_LINE>AppUIUtil.invokeOnEdt(() -> {<NEW_LINE>sourcePosition.createNavigatable(project).navigate(true);<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>};<NEW_LINE>final XSourcePosition sourcePosition = getSourcePosition(diagnosticsNode);<NEW_LINE>if (sourcePosition != null) {<NEW_LINE>// Source position is available immediately.<NEW_LINE>navigatable.setSourcePosition(sourcePosition);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// We have to get a DartVmServiceValue to compute the source position.<NEW_LINE>final CompletableFuture<InspectorService.ObjectGroup> inspectorService = diagnosticsNode.getInspectorService();<NEW_LINE>final CompletableFuture<DartVmServiceValue> valueFuture = inspectorService.thenComposeAsync((service) -> service.toDartVmServiceValueForSourceLocation(diagnosticsNode.getValueRef()));<NEW_LINE>AsyncUtils.whenCompleteUiThread(valueFuture, (DartVmServiceValue value, Throwable throwable) -> {<NEW_LINE>if (throwable != null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>startComputingSourcePosition(value, navigatable);<NEW_LINE>});<NEW_LINE>} | }, project.getDisposed()); |
1,630,406 | public void showHomeWatchingArticles(final RequestContext context) {<NEW_LINE>final Request request = context.getRequest();<NEW_LINE>final JSONObject user = (JSONObject) context.attr(User.USER);<NEW_LINE>final AbstractFreeMarkerRenderer renderer = new SkinRenderer(context, "home/watching-articles.ftl");<NEW_LINE>final Map<String, Object> dataModel = renderer.getDataModel();<NEW_LINE>dataModelService.fillHeaderAndFooter(context, dataModel);<NEW_LINE>final int pageNum = Paginator.getPage(request);<NEW_LINE>final int pageSize = Symphonys.USER_HOME_LIST_CNT;<NEW_LINE>final int windowSize = Symphonys.USER_HOME_LIST_WIN_SIZE;<NEW_LINE>fillHomeUser(dataModel, user, roleQueryService);<NEW_LINE>final String followingId = <MASK><NEW_LINE>dataModel.put(Follow.FOLLOWING_ID, followingId);<NEW_LINE>avatarQueryService.fillUserAvatarURL(user);<NEW_LINE>final JSONObject followingArticlesResult = followQueryService.getWatchingArticles(followingId, pageNum, pageSize);<NEW_LINE>final List<JSONObject> followingArticles = (List<JSONObject>) followingArticlesResult.opt(Keys.RESULTS);<NEW_LINE>dataModel.put(Common.USER_HOME_FOLLOWING_ARTICLES, followingArticles);<NEW_LINE>final boolean isLoggedIn = (Boolean) dataModel.get(Common.IS_LOGGED_IN);<NEW_LINE>if (isLoggedIn) {<NEW_LINE>final JSONObject currentUser = Sessions.getUser();<NEW_LINE>final String followerId = currentUser.optString(Keys.OBJECT_ID);<NEW_LINE>final boolean isFollowing = followQueryService.isFollowing(followerId, followingId, Follow.FOLLOWING_TYPE_C_USER);<NEW_LINE>dataModel.put(Common.IS_FOLLOWING, isFollowing);<NEW_LINE>for (final JSONObject followingArticle : followingArticles) {<NEW_LINE>final String homeUserFollowingArticleId = followingArticle.optString(Keys.OBJECT_ID);<NEW_LINE>followingArticle.put(Common.IS_FOLLOWING, followQueryService.isFollowing(followerId, homeUserFollowingArticleId, Follow.FOLLOWING_TYPE_C_ARTICLE_WATCH));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final int followingArticleCnt = followingArticlesResult.optInt(Pagination.PAGINATION_RECORD_COUNT);<NEW_LINE>final int pageCount = (int) Math.ceil(followingArticleCnt / (double) pageSize);<NEW_LINE>final List<Integer> pageNums = Paginator.paginate(pageNum, pageSize, pageCount, windowSize);<NEW_LINE>if (!pageNums.isEmpty()) {<NEW_LINE>dataModel.put(Pagination.PAGINATION_FIRST_PAGE_NUM, pageNums.get(0));<NEW_LINE>dataModel.put(Pagination.PAGINATION_LAST_PAGE_NUM, pageNums.get(pageNums.size() - 1));<NEW_LINE>}<NEW_LINE>dataModel.put(Pagination.PAGINATION_CURRENT_PAGE_NUM, pageNum);<NEW_LINE>dataModel.put(Pagination.PAGINATION_PAGE_COUNT, pageCount);<NEW_LINE>dataModel.put(Pagination.PAGINATION_PAGE_NUMS, pageNums);<NEW_LINE>dataModel.put(Pagination.PAGINATION_RECORD_COUNT, followingArticleCnt);<NEW_LINE>dataModel.put(Common.TYPE, "watchingArticles");<NEW_LINE>} | user.optString(Keys.OBJECT_ID); |
1,657,506 | public void UIInputReceiverClosed(UIInputReceiver entryWindow) {<NEW_LINE>if (!entryWindow.hasSubmittedInput()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String sReturn = entryWindow.getSubmittedInput();<NEW_LINE>if (sReturn == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int mins = -1;<NEW_LINE>try {<NEW_LINE>mins = Integer.valueOf(sReturn).intValue();<NEW_LINE>} catch (NumberFormatException er) {<NEW_LINE>// Ignore<NEW_LINE>}<NEW_LINE>if (mins <= 0) {<NEW_LINE>MessageBox mb = new MessageBox(Utils.findAnyShell(), SWT.ICON_ERROR | SWT.OK);<NEW_LINE>mb.setText(MessageText.getString("MyTorrentsView.dialog.NumberError.title"));<NEW_LINE>mb.setMessage(MessageText.getString("MyTorrentsView.dialog.NumberError.text"));<NEW_LINE>mb.open();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>COConfigurationManager.setParameter("ban.for.period.default", mins);<NEW_LINE>IpFilter filter = IpFilterManagerFactory.getSingleton().getIPFilter();<NEW_LINE>for (PEPeer peer : peers) {<NEW_LINE>if (!peer.isMyPeer()) {<NEW_LINE>String msg = MessageText.getString("PeersView.menu.kickandbanfor.reason", new String[] { String.valueOf(mins) });<NEW_LINE>filter.ban(peer.getIp(), msg, true, mins);<NEW_LINE>peer.getManager(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ).removePeer(peer, "Peer kicked and banned"); |
1,618,889 | public com.amazonaws.services.robomaker.model.ServiceUnavailableException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.robomaker.model.ServiceUnavailableException serviceUnavailableException = new com.amazonaws.services.robomaker.model.ServiceUnavailableException(null);<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return serviceUnavailableException;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
54,565 | private Mono<Response<Flux<ByteBuffer>>> purgeWithResponseAsync(String serviceName, String location) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (serviceName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.<MASK><NEW_LINE>}<NEW_LINE>if (location == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String accept = "application/json";<NEW_LINE>return FluxUtil.withContext(context -> service.purge(this.client.getEndpoint(), serviceName, this.client.getApiVersion(), this.client.getSubscriptionId(), location, accept, context)).contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));<NEW_LINE>} | error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")); |
1,155,257 | public Tuple3<Boolean, Double, Map<String, String>>[] detect(MTable series, boolean detectLast) throws Exception {<NEW_LINE>double[] data = OutlierUtil.getNumericArray(series, selectedCol);<NEW_LINE>int length = data.length;<NEW_LINE>List<Double> listData = new ArrayList<>(length);<NEW_LINE>for (double v : data) {<NEW_LINE>if (Double.isNaN(v)) {<NEW_LINE>length -= 1;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>listData.add(v);<NEW_LINE>}<NEW_LINE>if (detectLast && length <= 4) {<NEW_LINE>return new Tuple3[] { Tuple3.of(false, null, null) };<NEW_LINE>}<NEW_LINE>if (length <= 3) {<NEW_LINE>Tuple3<Boolean, Double, Map<String, String>>[] results = new Tuple3[length];<NEW_LINE>for (int i = 0; i < length; i++) {<NEW_LINE>results[i] = Tuple3.<MASK><NEW_LINE>}<NEW_LINE>return results;<NEW_LINE>}<NEW_LINE>double[] sortedData = new double[length];<NEW_LINE>for (int i = 0; i < length; i++) {<NEW_LINE>sortedData[i] = listData.get(i);<NEW_LINE>}<NEW_LINE>Arrays.sort(sortedData);<NEW_LINE>final double Q1 = (sortedData[(int) Math.ceil(length * 0.25)] + sortedData[(int) Math.floor(length * 0.25)]) / 2;<NEW_LINE>final double Q3 = (sortedData[(int) Math.ceil(length * 0.75)] + sortedData[(int) Math.floor(length * 0.75)]) / 2;<NEW_LINE>final double IQR = Q3 - Q1;<NEW_LINE>int iStart = detectLast ? data.length - 1 : 0;<NEW_LINE>Tuple3<Boolean, Double, Map<String, String>>[] results = new Tuple3[data.length - iStart];<NEW_LINE>for (int i = iStart; i < data.length; i++) {<NEW_LINE>double outlier_score = ((data[i] < Q1) ? (data[i] - Q1) : (data[i] > Q3) ? data[i] - Q3 : 0.0) / IQR;<NEW_LINE>switch(direction) {<NEW_LINE>case BOTH:<NEW_LINE>outlier_score = Math.abs(outlier_score);<NEW_LINE>break;<NEW_LINE>case NEGATIVE:<NEW_LINE>outlier_score = -outlier_score;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (isPredDetail) {<NEW_LINE>results[i] = Tuple3.of(outlier_score > K, outlier_score, null);<NEW_LINE>} else {<NEW_LINE>results[i] = Tuple3.of(outlier_score > K, null, null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return results;<NEW_LINE>} | of(false, null, null); |
538,748 | protected String parseAttributes(Object[] args) {<NEW_LINE>Object param;<NEW_LINE>final int argsLength = ArrayUtils.getLength(args);<NEW_LINE>if (argsLength == 1) {<NEW_LINE>// only one<NEW_LINE>param = args[0];<NEW_LINE>} else if (argsLength > 1) {<NEW_LINE>// last param<NEW_LINE>param = args[argsLength - 1];<NEW_LINE>} else {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>// Put/Delete/Append/Increment<NEW_LINE>if (param instanceof Mutation) {<NEW_LINE>Mutation mutation = (Mutation) param;<NEW_LINE>return "rowKey: " + Bytes.toStringBinary(mutation.getRow());<NEW_LINE>}<NEW_LINE>if (param instanceof Get) {<NEW_LINE>Get get = (Get) param;<NEW_LINE>return "rowKey: " + Bytes.toStringBinary(get.getRow());<NEW_LINE>}<NEW_LINE>if (param instanceof Scan) {<NEW_LINE>Scan scan = (Scan) param;<NEW_LINE>String startRowKey = Bytes.<MASK><NEW_LINE>String stopRowKey = Bytes.toStringBinary(scan.getStopRow());<NEW_LINE>return "startRowKey: " + startRowKey + " stopRowKey: " + stopRowKey;<NEW_LINE>}<NEW_LINE>// if param instanceof List.<NEW_LINE>if (param instanceof List) {<NEW_LINE>List<?> list = (List<?>) param;<NEW_LINE>return "size: " + list.size();<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | toStringBinary(scan.getStartRow()); |
592,759 | public void processOpts() {<NEW_LINE>super.processOpts();<NEW_LINE>if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) {<NEW_LINE>setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME));<NEW_LINE>}<NEW_LINE>modelPackage = packageName + "." + modelPackage;<NEW_LINE>apiPackage = packageName + "." + apiPackage;<NEW_LINE>supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));<NEW_LINE>supportingFiles.add(new SupportingFile("openapi.mustache", "", "openapi.yaml"));<NEW_LINE>supportingFiles.add(new SupportingFile("main.mustache", SRC_DIR + File.separator + packageName.replace('.', File.separatorChar), "main.py"));<NEW_LINE>supportingFiles.add(new SupportingFile<MASK><NEW_LINE>supportingFiles.add(new SupportingFile("Dockerfile.mustache", "", "Dockerfile"));<NEW_LINE>supportingFiles.add(new SupportingFile("requirements.mustache", "", "requirements.txt"));<NEW_LINE>supportingFiles.add(new SupportingFile("security_api.mustache", SRC_DIR + File.separator + packageName.replace('.', File.separatorChar), "security_api.py"));<NEW_LINE>supportingFiles.add(new SupportingFile("extra_models.mustache", StringUtils.substringAfter(modelFileFolder(), outputFolder), "extra_models.py"));<NEW_LINE>// Add __init__.py to all sub-folders under namespace pkg<NEW_LINE>StringBuilder namespacePackagePath = new StringBuilder(SRC_DIR + File.separator + StringUtils.substringBefore(packageName, "."));<NEW_LINE>for (String tmp : StringUtils.split(StringUtils.substringAfter(packageName, "."), '.')) {<NEW_LINE>namespacePackagePath.append(File.separator).append(tmp);<NEW_LINE>supportingFiles.add(new SupportingFile("__init__.mustache", namespacePackagePath.toString(), "__init__.py"));<NEW_LINE>}<NEW_LINE>supportingFiles.add(new SupportingFile("__init__.mustache", StringUtils.substringAfter(modelFileFolder(), outputFolder), "__init__.py"));<NEW_LINE>supportingFiles.add(new SupportingFile("__init__.mustache", StringUtils.substringAfter(apiFileFolder(), outputFolder), "__init__.py"));<NEW_LINE>supportingFiles.add(new SupportingFile("conftest.mustache", testPackage.replace('.', File.separatorChar), "conftest.py"));<NEW_LINE>supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));<NEW_LINE>supportingFiles.add(new SupportingFile("pyproject_toml.mustache", "", "pyproject.toml"));<NEW_LINE>supportingFiles.add(new SupportingFile("setup_cfg.mustache", "", "setup.cfg"));<NEW_LINE>supportingFiles.add(new SupportingFile(".flake8.mustache", "", ".flake8"));<NEW_LINE>} | ("docker-compose.mustache", "", "docker-compose.yaml")); |
1,701,060 | protected void paintInPanel(AffineTransform tran, Graphics2D g2) {<NEW_LINE>super.paintInPanel(tran, g2);<NEW_LINE>if (img == null)<NEW_LINE>return;<NEW_LINE>BoofSwingUtil.antialiasing(g2);<NEW_LINE>if (controlPanel.translucent > 0) {<NEW_LINE>// this requires some explaining<NEW_LINE>// for some reason it was decided that the transform would apply a translation, but not a scale<NEW_LINE>// so this scale will be concatted on top of the translation in the g2<NEW_LINE>tran.setTransform(scale, 0, 0, scale, 0, 0);<NEW_LINE>Composite beforeAC = g2.getComposite();<NEW_LINE><MASK><NEW_LINE>AlphaComposite ac = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, translucent);<NEW_LINE>g2.setComposite(ac);<NEW_LINE>g2.drawImage(visualized, tran, null);<NEW_LINE>g2.setComposite(beforeAC);<NEW_LINE>}<NEW_LINE>if (controlPanel.showCorners) {<NEW_LINE>synchronized (lockCorners) {<NEW_LINE>visualizeUtils.visualizeCorners(g2, scale, controlPanel.detMinPyrLevel, controlPanel.showNumbers);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (controlPanel.showClusters) {<NEW_LINE>synchronized (lockCorners) {<NEW_LINE>visualizeUtils.visualizeClusters(g2, scale, img.getWidth(), img.getHeight());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (controlPanel.showPerpendicular) {<NEW_LINE>// Locking the algorithm will kill performance.<NEW_LINE>synchronized (lockAlgorithm) {<NEW_LINE>visualizeUtils.visualizePerpendicular(g2, scale, detector.getClusterFinder());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (controlPanel.anyGrid) {<NEW_LINE>if (controlPanel.showChessboards) {<NEW_LINE>synchronized (lockCorners) {<NEW_LINE>for (int i = 0; i < visualizeUtils.foundGrids.size; i++) {<NEW_LINE>CalibrationObservation c = visualizeUtils.foundGrids.get(i);<NEW_LINE>UtilCalibrationGui.renderOrder(g2, null, scale, (List) c.points);<NEW_LINE>if (controlPanel.showNumbers) {<NEW_LINE>UtilCalibrationGui.drawNumbers(g2, c.points, null, scale);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (success && controlPanel.showChessboards) {<NEW_LINE>synchronized (lockCorners) {<NEW_LINE>UtilCalibrationGui.renderOrder(g2, null, scale, (List) foundChessboard.toList());<NEW_LINE>if (controlPanel.showNumbers) {<NEW_LINE>UtilCalibrationGui.drawNumbers(g2, foundChessboard.toList(), null, scale);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | float translucent = controlPanel.translucent / 100.0f; |
1,715,501 | protected JComponent createCenterPanel() {<NEW_LINE>JPanel panel = new JPanel(new GridBagLayout());<NEW_LINE>final GridBagConstraints gb = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, JBUI.insets(1), 0, 0);<NEW_LINE>gb.fill = GridBagConstraints.HORIZONTAL;<NEW_LINE>gb.weightx = 1;<NEW_LINE>final JPanel border = new JPanel(new BorderLayout());<NEW_LINE>border.setBorder(JBUI.Borders.emptyTop(2));<NEW_LINE>border.<MASK><NEW_LINE>gb.fill = GridBagConstraints.BOTH;<NEW_LINE>gb.weighty = 1;<NEW_LINE>++gb.gridy;<NEW_LINE>panel.add(border, gb);<NEW_LINE>final JComponent commitLegendPanel = myCommitLegendPanel.getComponent();<NEW_LINE>commitLegendPanel.setBorder(JBUI.Borders.emptyLeft(4));<NEW_LINE>gb.fill = GridBagConstraints.NONE;<NEW_LINE>gb.weightx = 0;<NEW_LINE>gb.weighty = 0;<NEW_LINE>++gb.gridy;<NEW_LINE>panel.add(commitLegendPanel, gb);<NEW_LINE>++gb.gridy;<NEW_LINE>panel.add(myDeleteLocallyAddedFiles, gb);<NEW_LINE>return panel;<NEW_LINE>} | add(myBrowser, BorderLayout.CENTER); |
1,664,129 | public com.amazonaws.services.codecommit.model.InvalidDescriptionException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.codecommit.model.InvalidDescriptionException invalidDescriptionException = new com.amazonaws.services.codecommit.model.InvalidDescriptionException(null);<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return invalidDescriptionException;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
629,821 | // @Override<NEW_LINE>public synchronized void configure(ConfigurationContext context, Map<String, LogPatternInfo> filePaths) throws IOException {<NEW_LINE>this.filePaths = filePaths;<NEW_LINE>String homePath = System.getProperty("user.home").replace('\\', '/');<NEW_LINE>positionFilePath = context.getString(POSITION_FILE_ROOT, homePath) + DEFAULT_POSITION_FILE;<NEW_LINE>Path positionFile = Paths.get(positionFilePath);<NEW_LINE>try {<NEW_LINE>Files.createDirectories(positionFile.getParent());<NEW_LINE>if (!Files.exists(positionFile, LinkOption.NOFOLLOW_LINKS)) {<NEW_LINE>new File(positionFilePath).createNewFile();<NEW_LINE>}<NEW_LINE>;<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new IOException("Error creating positionFile parent directories", e);<NEW_LINE>}<NEW_LINE>headerTable = getTable(context, HEADERS_PREFIX);<NEW_LINE>batchSize = context.getInteger(BATCH_SIZE, DEFAULT_BATCH_SIZE);<NEW_LINE>skipToEnd = context.getBoolean(SKIP_TO_END, DEFAULT_SKIP_TO_END);<NEW_LINE>byteOffsetHeader = context.getBoolean(BYTE_OFFSET_HEADER, DEFAULT_BYTE_OFFSET_HEADER);<NEW_LINE>idleTimeout = context.getInteger(IDLE_TIMEOUT, DEFAULT_IDLE_TIMEOUT);<NEW_LINE>writePosInterval = context.getInteger(WRITE_POS_INTERVAL, DEFAULT_WRITE_POS_INTERVAL);<NEW_LINE>backoffSleepIncrement = context.getLong(<MASK><NEW_LINE>maxBackOffSleepInterval = context.getLong(TaildirSourceConfigurationConstants.MAX_BACKOFF_SLEEP, TaildirSourceConfigurationConstants.DEFAULT_MAX_BACKOFF_SLEEP);<NEW_LINE>} | TaildirSourceConfigurationConstants.BACKOFF_SLEEP_INCREMENT, TaildirSourceConfigurationConstants.DEFAULT_BACKOFF_SLEEP_INCREMENT); |
1,465,823 | public boolean rebootProxy(long proxyVmId) {<NEW_LINE>final ConsoleProxyVO <MASK><NEW_LINE>if (proxy == null || proxy.getState() == State.Destroyed) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (proxy.getState() == State.Running && proxy.getHostId() != null) {<NEW_LINE>final RebootCommand cmd = new RebootCommand(proxy.getInstanceName(), virtualMachineManager.getExecuteInSequence(proxy.getHypervisorType()));<NEW_LINE>final Answer answer = agentManager.easySend(proxy.getHostId(), cmd);<NEW_LINE>if (answer != null && answer.getResult()) {<NEW_LINE>if (s_logger.isDebugEnabled()) {<NEW_LINE>s_logger.debug("Successfully reboot console proxy " + proxy.getHostName());<NEW_LINE>}<NEW_LINE>SubscriptionMgr.getInstance().notifySubscribers(ConsoleProxyManager.ALERT_SUBJECT, this, new ConsoleProxyAlertEventArgs(ConsoleProxyAlertEventArgs.PROXY_REBOOTED, proxy.getDataCenterId(), proxy.getId(), proxy, null));<NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>if (s_logger.isDebugEnabled()) {<NEW_LINE>s_logger.debug("failed to reboot console proxy : " + proxy.getHostName());<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>return startProxy(proxyVmId, false) != null;<NEW_LINE>}<NEW_LINE>} | proxy = consoleProxyDao.findById(proxyVmId); |
1,260,407 | protected Column visitExpression(Expression node, QueryState state) {<NEW_LINE>if (node instanceof QualifiedNameReference) {<NEW_LINE>return createColumn(((QualifiedNameReference) node).getName().toString(), null, state, "select.+", ".+from");<NEW_LINE>} else if (node instanceof DereferenceExpression) {<NEW_LINE>// parse columns like 'reference.field'<NEW_LINE>String column = visitDereferenceExpression((DereferenceExpression) node);<NEW_LINE>return createColumn(column, null, state, "select.+", ".+from");<NEW_LINE>} else if (node instanceof FunctionCall) {<NEW_LINE>FunctionCall fc = (FunctionCall) node;<NEW_LINE>String operator = fc.getName().toString();<NEW_LINE>String column;<NEW_LINE>if (fc.getArguments().size() == 0)<NEW_LINE>column = "*";<NEW_LINE>else if (fc.getArguments().get(0) instanceof LongLiteral)<NEW_LINE>column = "" + ((LongLiteral) fc.getArguments().get(0)).getValue();<NEW_LINE>else if (fc.getArguments().get(0) instanceof DereferenceExpression)<NEW_LINE>column = visitDereferenceExpression((DereferenceExpression) fc.getArguments().get(0));<NEW_LINE>else {<NEW_LINE>column = ((QualifiedNameReference) fc.getArguments().get(0)).getName().toString();<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>return createColumn(column, Operation.valueOf(operator.trim().toUpperCase()), state, "select.+", ".+from");<NEW_LINE>} catch (Exception e) {<NEW_LINE>state.addException("Unable to parse function due to: " + e.getMessage());<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} else if (node instanceof ArithmeticBinaryExpression) {<NEW_LINE>// resolve expressions within select such as (sum(x)/10)%3<NEW_LINE>String colName = ((ArithmeticBinaryExpression) node).toString().trim().replaceAll("\"", "");<NEW_LINE>colName = colName.substring(1, colName.lastIndexOf(')'));<NEW_LINE>ICalculation calc = new ArithmeticParser().visitArithmeticBinary((ArithmeticBinaryExpression) node, state);<NEW_LINE>if (state.hasException())<NEW_LINE>return null;<NEW_LINE><MASK><NEW_LINE>calcCol.setCalculation(calc);<NEW_LINE>return calcCol;<NEW_LINE>} else if (node instanceof StringLiteral) {<NEW_LINE>return createColumn(((StringLiteral) node).getValue(), null, state, "select.+", ".+from");<NEW_LINE>} else if (node instanceof LongLiteral) {<NEW_LINE>return createColumn(((LongLiteral) node).getValue() + "", null, state, "select.+", ".+from");<NEW_LINE>} else<NEW_LINE>state.addException("Unable to parse type " + node.getClass() + " in Select");<NEW_LINE>return null;<NEW_LINE>} | Column calcCol = new Column(colName); |
223,739 | static public void modifyConfigMap(Map<String, Object> configMap) {<NEW_LINE>if (configMap.containsKey(WSSecurityConstants.CXF_USER_PASSWORD)) {<NEW_LINE>String pwd = changePasswordType((SerializableProtectedString) configMap.get(WSSecurityConstants.CXF_USER_PASSWORD));<NEW_LINE>configMap.put(WSSecurityConstants.CXF_USER_PASSWORD, pwd);<NEW_LINE>}<NEW_LINE>if (configMap.containsKey(WSSecurityConstants.WSS4J_KEY_PASSWORD)) {<NEW_LINE>String pwd = changePasswordType((SerializableProtectedString) configMap.get(WSSecurityConstants.WSS4J_KEY_PASSWORD));<NEW_LINE>configMap.put(WSSecurityConstants.WSS4J_KEY_PASSWORD, pwd);<NEW_LINE>}<NEW_LINE>if (configMap.containsKey(WSSecurityConstants.WSS4J_2_KEY_PASSWORD)) {<NEW_LINE>String pwd = PasswordUtil.passwordDecode((String) configMap.get(WSSecurityConstants.WSS4J_2_KEY_PASSWORD));<NEW_LINE>configMap.put(WSSecurityConstants.WSS4J_2_KEY_PASSWORD, pwd);<NEW_LINE>}<NEW_LINE>if (configMap.containsKey(WSSecurityConstants.WSS4J_KS_PASSWORD)) {<NEW_LINE>String pwd = changePasswordType((SerializableProtectedString) configMap<MASK><NEW_LINE>configMap.put(WSSecurityConstants.WSS4J_KS_PASSWORD, pwd);<NEW_LINE>}<NEW_LINE>if (configMap.containsKey(WSSecurityConstants.WSS4J_2_KS_PASSWORD)) {<NEW_LINE>String pwd = PasswordUtil.passwordDecode((String) configMap.get(WSSecurityConstants.WSS4J_2_KS_PASSWORD));<NEW_LINE>configMap.put(WSSecurityConstants.WSS4J_2_KS_PASSWORD, pwd);<NEW_LINE>}<NEW_LINE>if (configMap.containsKey(WSSecurityConstants.WSS4J_TS_PASSWORD)) {<NEW_LINE>String pwd = changePasswordType((SerializableProtectedString) configMap.get(WSSecurityConstants.WSS4J_TS_PASSWORD));<NEW_LINE>configMap.put(WSSecurityConstants.WSS4J_TS_PASSWORD, pwd);<NEW_LINE>}<NEW_LINE>if (configMap.containsKey(WSSecurityConstants.WSS4J_2_TS_PASSWORD)) {<NEW_LINE>String pwd = PasswordUtil.passwordDecode((String) configMap.get(WSSecurityConstants.WSS4J_2_TS_PASSWORD));<NEW_LINE>configMap.put(WSSecurityConstants.WSS4J_2_TS_PASSWORD, pwd);<NEW_LINE>}<NEW_LINE>} | .get(WSSecurityConstants.WSS4J_KS_PASSWORD)); |
1,682,295 | public void onWorkerEvent(LifecycleEventsProto.WorkerStatusEvent workerEvent) {<NEW_LINE>if (logger.isTraceEnabled()) {<NEW_LINE>logger.trace("onWorkerEvent " + workerEvent + " is error state " + WorkerState.isErrorState<MASK><NEW_LINE>}<NEW_LINE>if (workerEvent.getHostName().isPresent() && WorkerState.isErrorState(workerEvent.getWorkerState())) {<NEW_LINE>String hostName = workerEvent.getHostName().get();<NEW_LINE>logger.info("Registering worker error on host {}", hostName);<NEW_LINE>HostErrors hostErrors = hostErrorMap.computeIfAbsent(hostName, (hName) -> new HostErrors(hName, slaveEnabler, this.error_check_window_millis, this.error_check_window_count));<NEW_LINE>if (hostErrors.addAndGetIsTooManyErrors(workerEvent)) {<NEW_LINE>logger.warn("Host {} has too many errors in a short duration, disabling..", hostName);<NEW_LINE>this.slaveDisabler.call(hostName);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (workerEvent.getWorkerState())); |
1,745,734 | private boolean createIndex(ElasticSearchIndexType elasticSearchIndexType) {<NEW_LINE>try {<NEW_LINE>GetIndexRequest gRequest = new GetIndexRequest(elasticSearchIndexType.indexName);<NEW_LINE>gRequest.local(false);<NEW_LINE>boolean exists = client.indices().exists(gRequest, RequestOptions.DEFAULT);<NEW_LINE>if (!exists) {<NEW_LINE>String elasticSearchIndexMapping = getIndexMapping(elasticSearchIndexType);<NEW_LINE>CreateIndexRequest request = new CreateIndexRequest(elasticSearchIndexType.indexName);<NEW_LINE>request.mapping(elasticSearchIndexMapping, XContentType.JSON);<NEW_LINE>CreateIndexResponse createIndexResponse = client.indices().create(request, RequestOptions.DEFAULT);<NEW_LINE>LOG.info("{} Created {}", elasticSearchIndexType.indexName, createIndexResponse.isAcknowledged());<NEW_LINE>}<NEW_LINE>setIndexStatus(elasticSearchIndexType, ElasticSearchIndexStatus.CREATED);<NEW_LINE>} catch (Exception e) {<NEW_LINE><MASK><NEW_LINE>LOG.error("Failed to create Elastic Search indexes due to", e);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | setIndexStatus(elasticSearchIndexType, ElasticSearchIndexStatus.FAILED); |
1,048,308 | final public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {<NEW_LINE>View childView = initView(inflater, container, savedInstanceState);<NEW_LINE>FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);<NEW_LINE>InterceptorFrameLayout frameLayout = new InterceptorFrameLayout(getActivity());<NEW_LINE>frameLayout.setLayoutParams(layoutParams);<NEW_LINE>FrameLayout.LayoutParams childLayoutParams = new FrameLayout.LayoutParams((ViewGroup.MarginLayoutParams) childView.getLayoutParams());<NEW_LINE>frameLayout.addView(childView, childLayoutParams);<NEW_LINE>if (isDismissAllowed()) {<NEW_LINE>SwipeDismissTouchListener listener = new SwipeDismissTouchListener(childView, null, new SwipeDismissTouchListener.DismissCallbacks() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean canDismiss(Object token) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onDismiss(View view, Object token, boolean isSwipeRight) {<NEW_LINE>getDismissCallback().onDismiss();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>frameLayout.setOnTouchListener(listener);<NEW_LINE>frameLayout.setListener(listener);<NEW_LINE>if (getDismissCallback() == null) {<NEW_LINE>defaultDismissListener = new DefaultDismissListener(getParentView(), <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return frameLayout;<NEW_LINE>} | dashboard, getTag(), childView); |
1,661,769 | public IntersectionMatrix computeIM() {<NEW_LINE>IntersectionMatrix im = new IntersectionMatrix();<NEW_LINE>// since Geometries are finite and embedded in a 2-D space, the EE element must always be 2<NEW_LINE>im.set(Location.EXTERIOR, Location.EXTERIOR, 2);<NEW_LINE>// if the Geometries don't overlap there is nothing to do<NEW_LINE>if (!arg[0].getGeometry().getEnvelopeInternal().intersects(arg[1].getGeometry().getEnvelopeInternal())) {<NEW_LINE>computeDisjointIM(im, arg[0].getBoundaryNodeRule());<NEW_LINE>return im;<NEW_LINE>}<NEW_LINE>arg[0].computeSelfNodes(li, false);<NEW_LINE>arg[1].computeSelfNodes(li, false);<NEW_LINE>// compute intersections between edges of the two input geometries<NEW_LINE>SegmentIntersector intersector = arg[0].computeEdgeIntersections(arg[1], li, false);<NEW_LINE>// System.out.println("computeIM: # segment intersection tests: " + intersector.numTests);<NEW_LINE>computeIntersectionNodes(0);<NEW_LINE>computeIntersectionNodes(1);<NEW_LINE>copyNodesAndLabels(0);<NEW_LINE>copyNodesAndLabels(1);<NEW_LINE>// complete the labelling for any nodes which only have a label for a single geometry<NEW_LINE>// Debug.addWatch(nodes.find(new Coordinate(110, 200)));<NEW_LINE>// Debug.printWatch();<NEW_LINE>labelIsolatedNodes();<NEW_LINE>// Debug.printWatch();<NEW_LINE>// If a proper intersection was found, we can set a lower bound on the IM.<NEW_LINE>computeProperIntersectionIM(intersector, im);<NEW_LINE>// build EdgeEnds for all intersections<NEW_LINE>EdgeEndBuilder eeBuilder = new EdgeEndBuilder();<NEW_LINE>List ee0 = eeBuilder.computeEdgeEnds(arg<MASK><NEW_LINE>insertEdgeEnds(ee0);<NEW_LINE>List ee1 = eeBuilder.computeEdgeEnds(arg[1].getEdgeIterator());<NEW_LINE>insertEdgeEnds(ee1);<NEW_LINE>// Debug.println("==== NodeList ===");<NEW_LINE>// Debug.print(nodes);<NEW_LINE>labelNodeEdges();<NEW_LINE>// debugPrintln("Graph A isolated edges - ");<NEW_LINE>labelIsolatedEdges(0, 1);<NEW_LINE>// debugPrintln("Graph B isolated edges - ");<NEW_LINE>labelIsolatedEdges(1, 0);<NEW_LINE>// update the IM from all components<NEW_LINE>updateIM(im);<NEW_LINE>return im;<NEW_LINE>} | [0].getEdgeIterator()); |
185,721 | private void processAddByHostname(final List<String> requestedHostnames, List<JSONObject> foundHosts, boolean allowOneTimeHosts) {<NEW_LINE>List<String> oneTimeHostnames = findOneTimeHosts(requestedHostnames, foundHosts);<NEW_LINE>if (!allowOneTimeHosts && !oneTimeHostnames.isEmpty()) {<NEW_LINE>NotifyManager.getInstance().showError("Hosts not found: " + Utils.joinStrings(", ", oneTimeHostnames));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// deselect existing non-metahost hosts<NEW_LINE>// iterate over copy to allow modification<NEW_LINE>for (JSONObject host : new ArrayList<JSONObject>(selectedHostData.getItems())) {<NEW_LINE>if (isOneTimeHost(host)) {<NEW_LINE>selectedHostData.removeItem(host);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>availableSelection.deselectAll();<NEW_LINE>// add one-time hosts<NEW_LINE>for (String hostname : oneTimeHostnames) {<NEW_LINE>JSONObject oneTimeObject = new JSONObject();<NEW_LINE>JSONArray profiles = new JSONArray();<NEW_LINE>profiles.set(0, new JSONString("N/A"));<NEW_LINE>oneTimeObject.put("hostname", new JSONString(hostname));<NEW_LINE>oneTimeObject.put(<MASK><NEW_LINE>oneTimeObject.put("profiles", profiles);<NEW_LINE>oneTimeObject.put("other_labels", new JSONString(""));<NEW_LINE>oneTimeObject.put("status", new JSONString(""));<NEW_LINE>oneTimeObject.put("locked_text", new JSONString(""));<NEW_LINE>oneTimeObject.put("id", new JSONNumber(--META_INDEX));<NEW_LINE>selectRow(oneTimeObject);<NEW_LINE>}<NEW_LINE>// add existing hosts<NEW_LINE>// this refreshes the selection<NEW_LINE>availableSelection.selectObjects(foundHosts);<NEW_LINE>} | "platform", new JSONString(ONE_TIME)); |
1,465,376 | protected void doExecute(Task task, DeleteForecastAction.Request request, ActionListener<AcknowledgedResponse> listener) {<NEW_LINE>final String jobId = request.getJobId();<NEW_LINE>final String forecastsExpression = request.getForecastId();<NEW_LINE>final String[] forecastIds = Strings.splitStringByCommaToArray(forecastsExpression);<NEW_LINE>ActionListener<SearchResponse> forecastStatsHandler = ActionListener.wrap(searchResponse -> deleteForecasts(searchResponse, request, listener), e -> handleFailure(e, request, listener));<NEW_LINE>BoolQueryBuilder query = QueryBuilders.boolQuery().filter(QueryBuilders.termQuery(Result.RESULT_TYPE.getPreferredName(), ForecastRequestStats.RESULT_TYPE_VALUE));<NEW_LINE>QueryBuilderHelper.buildTokenFilterQuery(Forecast.FORECAST_ID.getPreferredName(), forecastIds).ifPresent(query::filter);<NEW_LINE>SearchSourceBuilder source = // We only need forecast id and status, there is no need fetching the whole source<NEW_LINE>new SearchSourceBuilder().size(MAX_FORECAST_TO_SEARCH).fetchSource(false).docValueField(ForecastRequestStats.FORECAST_ID.getPreferredName()).docValueField(ForecastRequestStats.STATUS.getPreferredName<MASK><NEW_LINE>SearchRequest searchRequest = new SearchRequest(AnomalyDetectorsIndex.jobResultsAliasedName(jobId)).source(source);<NEW_LINE>executeAsyncWithOrigin(client, ML_ORIGIN, SearchAction.INSTANCE, searchRequest, forecastStatsHandler);<NEW_LINE>} | ()).query(query); |
1,795,029 | private void statInit() {<NEW_LINE>label1.setLabelFor(textField1);<NEW_LINE>label1.setText("Label1");<NEW_LINE>label1.setHorizontalAlignment(JLabel.LEADING);<NEW_LINE>textField1.setBackground(AdempierePLAF.getInfoBackground());<NEW_LINE>label2.setLabelFor(textField2);<NEW_LINE>label2.setText("Label2");<NEW_LINE>label2.setHorizontalAlignment(JLabel.LEADING);<NEW_LINE>textField2.setBackground(AdempierePLAF.getInfoBackground());<NEW_LINE>label3.setLabelFor(textField3);<NEW_LINE>label3.setText("Label3");<NEW_LINE>label3.setHorizontalAlignment(JLabel.LEADING);<NEW_LINE>textField3.setBackground(AdempierePLAF.getInfoBackground());<NEW_LINE>label4.setLabelFor(textField4);<NEW_LINE>label4.setText("Label4");<NEW_LINE>label4.setHorizontalAlignment(JLabel.LEADING);<NEW_LINE>textField4.setBackground(AdempierePLAF.getInfoBackground());<NEW_LINE>//<NEW_LINE>p_criteriaGrid.setLayout(new ALayout());<NEW_LINE>p_criteriaGrid.add(label1, new ALayoutConstraint(0, 0));<NEW_LINE>p_criteriaGrid.add(label2, null);<NEW_LINE>p_criteriaGrid.add(label3, null);<NEW_LINE>p_criteriaGrid.add(label4, null);<NEW_LINE>//<NEW_LINE>p_criteriaGrid.add(textField1, <MASK><NEW_LINE>p_criteriaGrid.add(textField2, null);<NEW_LINE>p_criteriaGrid.add(textField3, null);<NEW_LINE>p_criteriaGrid.add(textField4, null);<NEW_LINE>} | new ALayoutConstraint(1, 0)); |
1,253,470 | final RedactChannelMessageResult executeRedactChannelMessage(RedactChannelMessageRequest redactChannelMessageRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(redactChannelMessageRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<RedactChannelMessageRequest> request = null;<NEW_LINE>Response<RedactChannelMessageResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new RedactChannelMessageRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(redactChannelMessageRequest));<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, "Chime");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RedactChannelMessage");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>URI endpointTraitHost = null;<NEW_LINE>if (!clientConfiguration.isDisableHostPrefixInjection()) {<NEW_LINE>String hostPrefix = "messaging-";<NEW_LINE>String resolvedHostPrefix = String.format("messaging-");<NEW_LINE>endpointTraitHost = UriResourcePathUtils.updateUriHost(endpoint, resolvedHostPrefix);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<RedactChannelMessageResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new RedactChannelMessageResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext, null, endpointTraitHost);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
1,788,171 | final void updateSubtreeNow(@Nonnull TreeUpdatePass pass, boolean canSmartExpand) {<NEW_LINE>maybeSetBusyAndScheduleWaiterForReady(true, getElementFor(pass.getNode()));<NEW_LINE>setHoldSize(true);<NEW_LINE>boolean consumed = initRootNodeNowIfNeeded(pass);<NEW_LINE>if (consumed)<NEW_LINE>return;<NEW_LINE>final DefaultMutableTreeNode node = pass.getNode();<NEW_LINE>NodeDescriptor descriptor = getDescriptorFrom(node);<NEW_LINE>if (descriptor == null)<NEW_LINE>return;<NEW_LINE>if (pass.isUpdateStructure()) {<NEW_LINE>setUpdaterState(new UpdaterTreeState(this)).beforeSubtreeUpdate();<NEW_LINE>boolean forceUpdate = true;<NEW_LINE>TreePath path = getPathFor(node);<NEW_LINE>boolean invisible = !myTree.isExpanded(path) && (path.getParentPath() == null || !myTree.isExpanded<MASK><NEW_LINE>if (invisible && myUnbuiltNodes.contains(node)) {<NEW_LINE>forceUpdate = false;<NEW_LINE>}<NEW_LINE>updateNodeChildren(node, pass, null, false, canSmartExpand, forceUpdate, false, pass.isUpdateChildren());<NEW_LINE>} else {<NEW_LINE>updateRow(0, pass);<NEW_LINE>}<NEW_LINE>} | (path.getParentPath())); |
1,422,410 | private static Map<String, MetadataFieldMapper.TypeParser> initBuiltInMetadataMappers() {<NEW_LINE>Map<String, MetadataFieldMapper.TypeParser> builtInMetadataMappers;<NEW_LINE>// Use a LinkedHashMap for metadataMappers because iteration order matters<NEW_LINE>builtInMetadataMappers = new LinkedHashMap<>();<NEW_LINE>// _ignored first so that we always load it, even if only _id is requested<NEW_LINE>builtInMetadataMappers.put(IgnoredFieldMapper.NAME, new IgnoredFieldMapper.TypeParser());<NEW_LINE>// UID second so it will be the first (if no ignored fields) stored field to load<NEW_LINE>// (so will benefit from "fields: []" early termination<NEW_LINE>builtInMetadataMappers.put(UidFieldMapper.NAME, new UidFieldMapper.TypeParser());<NEW_LINE>builtInMetadataMappers.put(IdFieldMapper.NAME, new IdFieldMapper.TypeParser());<NEW_LINE>builtInMetadataMappers.put(RoutingFieldMapper.NAME, new RoutingFieldMapper.TypeParser());<NEW_LINE>builtInMetadataMappers.put(IndexFieldMapper.NAME, new IndexFieldMapper.TypeParser());<NEW_LINE>builtInMetadataMappers.put(SourceFieldMapper.NAME, new SourceFieldMapper.TypeParser());<NEW_LINE>builtInMetadataMappers.put(TypeFieldMapper.NAME, new TypeFieldMapper.TypeParser());<NEW_LINE>builtInMetadataMappers.put(AllFieldMapper.NAME, new AllFieldMapper.TypeParser());<NEW_LINE>builtInMetadataMappers.put(VersionFieldMapper.NAME<MASK><NEW_LINE>builtInMetadataMappers.put(ParentFieldMapper.NAME, new ParentFieldMapper.TypeParser());<NEW_LINE>builtInMetadataMappers.put(SeqNoFieldMapper.NAME, new SeqNoFieldMapper.TypeParser());<NEW_LINE>builtInMetadataMappers.put(TokenFieldMapper.NAME, new TokenFieldMapper.TypeParser());<NEW_LINE>builtInMetadataMappers.put(HostFieldMapper.NAME, new HostFieldMapper.TypeParser());<NEW_LINE>// _field_names must be added last so that it has a chance to see all the other mappers<NEW_LINE>builtInMetadataMappers.put(FieldNamesFieldMapper.NAME, new FieldNamesFieldMapper.TypeParser());<NEW_LINE>return Collections.unmodifiableMap(builtInMetadataMappers);<NEW_LINE>} | , new VersionFieldMapper.TypeParser()); |
705,279 | public void actionPerformed(ActionEvent actionEvent) {<NEW_LINE>switch(action) {<NEW_LINE>case ACTION_ESCAPE:<NEW_LINE>if (CompletionImpl.get().hideCompletion(false)) {<NEW_LINE>// NOI18N<NEW_LINE>LogRecord r = new <MASK><NEW_LINE>CompletionImpl.uilog(r);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case ACTION_COMPLETION_UP:<NEW_LINE>view.up();<NEW_LINE>break;<NEW_LINE>case ACTION_COMPLETION_DOWN:<NEW_LINE>view.down();<NEW_LINE>break;<NEW_LINE>case ACTION_COMPLETION_PGUP:<NEW_LINE>view.pageUp();<NEW_LINE>break;<NEW_LINE>case ACTION_COMPLETION_PGDN:<NEW_LINE>view.pageDown();<NEW_LINE>break;<NEW_LINE>case ACTION_COMPLETION_BEGIN:<NEW_LINE>view.begin();<NEW_LINE>break;<NEW_LINE>case ACTION_COMPLETION_END:<NEW_LINE>view.end();<NEW_LINE>break;<NEW_LINE>case ACTION_COMPLETION_SUBITEMS_SHOW:<NEW_LINE>CompletionImpl.get().showCompletionSubItems();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} | LogRecord(Level.FINE, "COMPL_CANCEL"); |
1,316,755 | public void processRecordsCli(Dataset<Row> lines) throws ZinggClientException {<NEW_LINE>LOG.info("Processing Records for CLI updateLabelling");<NEW_LINE>getMarkedRecordsStat(lines);<NEW_LINE>printMarkedRecordsStat();<NEW_LINE>if (lines == null || lines.count() == 0) {<NEW_LINE>LOG.info("There is no marked record for updating. Please run findTrainingData/label jobs to generate training data.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<Column> displayCols = DSUtil.getFieldDefColumns(lines, args, false, args.getShowConcise());<NEW_LINE>try {<NEW_LINE>int matchFlag;<NEW_LINE>Dataset<Row> updatedRecords = null;<NEW_LINE>Dataset<Row> recordsToUpdate = lines;<NEW_LINE>int selectedOption = -1;<NEW_LINE>String postMsg;<NEW_LINE>Scanner sc = new Scanner(System.in);<NEW_LINE>do {<NEW_LINE>System.out.print("\n\tPlease enter the cluster id (or 9 to exit): ");<NEW_LINE>String cluster_id = sc.next();<NEW_LINE>if (cluster_id.equals("9")) {<NEW_LINE>LOG.info("User has exit in the middle. Updating the records.");<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>Dataset<Row> currentPair = lines.filter(lines.col(ColName.<MASK><NEW_LINE>if (currentPair.isEmpty()) {<NEW_LINE>System.out.println("\tInvalid cluster id. Enter '9' to exit");<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>matchFlag = currentPair.head().getAs(ColName.MATCH_FLAG_COL);<NEW_LINE>String preMsg = String.format("\n\tThe record pairs belonging to the input cluster id %s are:", cluster_id);<NEW_LINE>String matchType = LabelMatchType.get(matchFlag).msg;<NEW_LINE>postMsg = String.format("\tThe above pair is labeled as %s\n", matchType);<NEW_LINE>selectedOption = displayRecordsAndGetUserInput(DSUtil.select(currentPair, displayCols), preMsg, postMsg);<NEW_LINE>updateLabellerStat(selectedOption, +1);<NEW_LINE>updateLabellerStat(matchFlag, -1);<NEW_LINE>printMarkedRecordsStat();<NEW_LINE>if (selectedOption == 9) {<NEW_LINE>LOG.info("User has quit in the middle. Updating the records.");<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>recordsToUpdate = recordsToUpdate.filter(recordsToUpdate.col(ColName.CLUSTER_COLUMN).notEqual(cluster_id));<NEW_LINE>if (updatedRecords != null) {<NEW_LINE>updatedRecords = updatedRecords.filter(updatedRecords.col(ColName.CLUSTER_COLUMN).notEqual(cluster_id));<NEW_LINE>}<NEW_LINE>updatedRecords = updateRecords(selectedOption, currentPair, updatedRecords);<NEW_LINE>} while (selectedOption != 9);<NEW_LINE>if (updatedRecords != null) {<NEW_LINE>updatedRecords = updatedRecords.union(recordsToUpdate);<NEW_LINE>}<NEW_LINE>writeLabelledOutput(updatedRecords);<NEW_LINE>sc.close();<NEW_LINE>LOG.info("Processing finished.");<NEW_LINE>} catch (Exception e) {<NEW_LINE>if (LOG.isDebugEnabled()) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>LOG.warn("An error has occured while Updating Label. " + e.getMessage());<NEW_LINE>throw new ZinggClientException(e.getMessage());<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>} | CLUSTER_COLUMN).equalTo(cluster_id)); |
339,400 | public void runCommand(CommandSender sender, List<String> args) {<NEW_LINE>if (plugin.getScriptAPI() == null) {<NEW_LINE>sender.sendMessage("Buscript failed to load while the server was starting. Scripts cannot be run.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>File file = new File(plugin.getScriptAPI().getScriptFolder(), args.get(0));<NEW_LINE>if (!file.exists()) {<NEW_LINE>sender.sendMessage("That script file does not exist in the Multiverse-Core scripts directory!");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Player player = null;<NEW_LINE>if (sender instanceof Player) {<NEW_LINE>player = (Player) sender;<NEW_LINE>}<NEW_LINE>String target = null;<NEW_LINE>if (args.size() == 2) {<NEW_LINE>target = args.get(1);<NEW_LINE>}<NEW_LINE>plugin.getScriptAPI().<MASK><NEW_LINE>sender.sendMessage(String.format("Script '%s%s%s' finished!", ChatColor.GOLD, file.getName(), ChatColor.WHITE));<NEW_LINE>} | executeScript(file, target, player); |
787,250 | public static DescribeRulesResponse unmarshall(DescribeRulesResponse describeRulesResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeRulesResponse.setRequestId(_ctx.stringValue("DescribeRulesResponse.RequestId"));<NEW_LINE>List<Rule> rules = new ArrayList<Rule>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeRulesResponse.Rules.Length"); i++) {<NEW_LINE>Rule rule = new Rule();<NEW_LINE>rule.setHealthCheckHttpCode(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].HealthCheckHttpCode"));<NEW_LINE>rule.setVServerGroupId(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].VServerGroupId"));<NEW_LINE>rule.setDomain(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].Domain"));<NEW_LINE>rule.setCookie(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].Cookie"));<NEW_LINE>rule.setHealthCheckInterval(_ctx.integerValue("DescribeRulesResponse.Rules[" + i + "].HealthCheckInterval"));<NEW_LINE>rule.setUrl(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].Url"));<NEW_LINE>rule.setHealthCheckURI(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].HealthCheckURI"));<NEW_LINE>rule.setStickySessionType(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].StickySessionType"));<NEW_LINE>rule.setRuleName(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].RuleName"));<NEW_LINE>rule.setRuleId(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].RuleId"));<NEW_LINE>rule.setServiceManagedMode(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].ServiceManagedMode"));<NEW_LINE>rule.setHealthCheckConnectPort(_ctx.integerValue("DescribeRulesResponse.Rules[" + i + "].HealthCheckConnectPort"));<NEW_LINE>rule.setScheduler(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].Scheduler"));<NEW_LINE>rule.setHealthCheckTimeout(_ctx.integerValue("DescribeRulesResponse.Rules[" + i + "].HealthCheckTimeout"));<NEW_LINE>rule.setListenerSync(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].ListenerSync"));<NEW_LINE>rule.setHealthyThreshold(_ctx.integerValue("DescribeRulesResponse.Rules[" + i + "].HealthyThreshold"));<NEW_LINE>rule.setCookieTimeout(_ctx.integerValue("DescribeRulesResponse.Rules[" + i + "].CookieTimeout"));<NEW_LINE>rule.setHealthCheckDomain(_ctx.stringValue<MASK><NEW_LINE>rule.setUnhealthyThreshold(_ctx.integerValue("DescribeRulesResponse.Rules[" + i + "].UnhealthyThreshold"));<NEW_LINE>rule.setStickySession(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].StickySession"));<NEW_LINE>rule.setHealthCheck(_ctx.stringValue("DescribeRulesResponse.Rules[" + i + "].HealthCheck"));<NEW_LINE>rules.add(rule);<NEW_LINE>}<NEW_LINE>describeRulesResponse.setRules(rules);<NEW_LINE>return describeRulesResponse;<NEW_LINE>} | ("DescribeRulesResponse.Rules[" + i + "].HealthCheckDomain")); |
420,279 | static CompletableFuture<byte[]> signTypedData(JSONObject data, ECKeyPair keyPair) {<NEW_LINE>CompletableFuture<byte[]> future = new CompletableFuture<>();<NEW_LINE>try {<NEW_LINE>System.out.println(data.toString());<NEW_LINE>StructuredDataEncoder encoder = new StructuredDataEncoder(data.toString());<NEW_LINE>byte[] message = encoder.hashStructuredData();<NEW_LINE>Sign.SignatureData signed = Sign.signMessage(message, keyPair, false);<NEW_LINE>byte[] r = signed.getR();<NEW_LINE>byte[] s = signed.getS();<NEW_LINE>byte[<MASK><NEW_LINE>System.arraycopy(r, 0, result, 0, r.length);<NEW_LINE>System.arraycopy(s, 0, result, r.length, s.length);<NEW_LINE>result[64] = signed.getV()[0];<NEW_LINE>future.complete(result);<NEW_LINE>} catch (IOException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>future.completeExceptionally(e);<NEW_LINE>}<NEW_LINE>return future;<NEW_LINE>} | ] result = new byte[65]; |
1,843,405 | public ParquetEdgeSeed edgeIdToParquetObjects(final EdgeId edgeId) throws SerialisationException {<NEW_LINE>final List<Pair<String, Object>> gafferColumnsAndObjects = new ArrayList<>();<NEW_LINE>gafferColumnsAndObjects.add(new Pair<>(ParquetStore.SOURCE, edgeId.getSource()));<NEW_LINE>gafferColumnsAndObjects.add(new Pair<>(ParquetStore.DESTINATION<MASK><NEW_LINE>if (edgeId.getDirectedType().equals(DirectedType.DIRECTED)) {<NEW_LINE>gafferColumnsAndObjects.add(new Pair<>(ParquetStore.DIRECTED, true));<NEW_LINE>} else if (edgeId.getDirectedType().equals(DirectedType.UNDIRECTED)) {<NEW_LINE>gafferColumnsAndObjects.add(new Pair<>(ParquetStore.DIRECTED, false));<NEW_LINE>}<NEW_LINE>// If edgeId.getDirectedType() is DirectedType.EITHER then don't add it.<NEW_LINE>final List<Pair<String, Object>> gafferColumnsAndObjectsSource = new ArrayList<>();<NEW_LINE>gafferColumnsAndObjectsSource.add(new Pair<>(ParquetStore.SOURCE, edgeId.getSource()));<NEW_LINE>final List<Pair<String, Object>> gafferColumnsAndObjectsDestination = new ArrayList<>();<NEW_LINE>gafferColumnsAndObjectsDestination.add(new Pair<>(ParquetStore.DESTINATION, edgeId.getDestination()));<NEW_LINE>return new ParquetEdgeSeed(edgeId, gafferObjectsToParquetObjects(gafferColumnsAndObjectsSource), gafferObjectsToParquetObjects(gafferColumnsAndObjectsDestination), edgeId.getDirectedType());<NEW_LINE>} | , edgeId.getDestination())); |
823,425 | private void refreshToken() {<NEW_LINE>try {<NEW_LINE>final URI resourceURI;<NEW_LINE>final UriComponentsBuilder uriBuilder = UriComponentsBuilder.fromHttpUrl(baseUrl);<NEW_LINE>uriBuilder.pathSegment(PathSegmentsEnum.API.getValue()).pathSegment(PathSegmentsEnum.OATH.getValue()).pathSegment(PathSegmentsEnum.TOKEN.getValue());<NEW_LINE>final HttpEntity<GetBearerRequest> request = new HttpEntity<>(authToken.toGetBearerRequest(), getHttpHeaders());<NEW_LINE>resourceURI = uriBuilder.build().toUri();<NEW_LINE>final ResponseEntity<JsonOauthResponse> response = restTemplate().exchange(resourceURI, HttpMethod.POST, request, JsonOauthResponse.class);<NEW_LINE>if (response.getBody() == null) {<NEW_LINE>throw new RuntimeException("No access token returned from shopware!");<NEW_LINE>}<NEW_LINE>final JsonOauthResponse oauthResponse = response.getBody();<NEW_LINE>final Instant validUntil = Instant.now().plusSeconds(oauthResponse.getExpiresIn());<NEW_LINE>this.authToken.updateBearer(<MASK><NEW_LINE>} catch (final Exception exception) {<NEW_LINE>logger.log(Level.SEVERE, "Exception while trying to refresh the auth token: " + exception.getLocalizedMessage(), exception);<NEW_LINE>throw exception;<NEW_LINE>}<NEW_LINE>} | oauthResponse.getAccessToken(), validUntil); |
1,753,102 | private void populateReferencedFunctions() {<NEW_LINE>for (BStructureTypeSymbol structureTypeSymbol : this.structureTypes) {<NEW_LINE>if (structureTypeSymbol.type.tag == TypeTags.OBJECT) {<NEW_LINE>BObjectType objectType = (BObjectType) structureTypeSymbol.type;<NEW_LINE>for (BType ref : objectType.typeInclusions) {<NEW_LINE>BType typeRef = Types.getReferredType(ref);<NEW_LINE>if (typeRef.tsymbol == null || typeRef.tsymbol.kind != SymbolKind.OBJECT) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>List<BAttachedFunction> attachedFunctions = ((BObjectTypeSymbol) typeRef.tsymbol).attachedFuncs;<NEW_LINE>for (BAttachedFunction function : attachedFunctions) {<NEW_LINE>if (Symbols.isPrivate(function.symbol)) {<NEW_LINE>// we should not copy private functions.<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String referencedFuncName = function.funcName.value;<NEW_LINE>Name funcName = names.fromString(Symbols.getAttachedFuncSymbolName(structureTypeSymbol.name.value, referencedFuncName));<NEW_LINE>Scope.ScopeEntry matchingObjFuncSym = objectType.<MASK><NEW_LINE>if (matchingObjFuncSym == NOT_FOUND_ENTRY) {<NEW_LINE>structureTypeSymbol.attachedFuncs.add(function);<NEW_LINE>((BObjectTypeSymbol) structureTypeSymbol).referencedFunctions.add(function);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | tsymbol.scope.lookup(funcName); |
286,690 | public void PEval(IFragment<Long, Long, Long, Double> fragment, ParallelContextBase<Long, Long, Long, Double> contextBase, ParallelMessageManager parallelMessageManager) {<NEW_LINE>PageRankContext ctx = (PageRankContext) contextBase;<NEW_LINE>parallelMessageManager.initChannels(ctx.thread_num());<NEW_LINE>VertexRange<Long> innerVertices = fragment.innerVertices();<NEW_LINE>int totalVertexNum = (int) fragment.getTotalVerticesNum();<NEW_LINE>ctx.superStep = 0;<NEW_LINE>double base = 1.0 / totalVertexNum;<NEW_LINE>BiConsumer<Vertex<Long>, Integer> calc = (Vertex<Long> vertex, Integer finalTid) -> {<NEW_LINE>int edgeNum = (int) fragment.getOutgoingAdjList(vertex).size();<NEW_LINE>ctx.degree.set(vertex, edgeNum);<NEW_LINE>if (edgeNum == 0) {<NEW_LINE>ctx.pagerank.set(vertex, base);<NEW_LINE>} else {<NEW_LINE>ctx.pagerank.set(vertex, base / edgeNum);<NEW_LINE>DoubleMsg msg = FFITypeFactoryhelper.newDoubleMsg(base / edgeNum);<NEW_LINE>parallelMessageManager.sendMsgThroughOEdges(fragment, vertex, msg, finalTid, 2.0);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>forEachVertex(innerVertices, ctx.thread_num, ctx.executor, calc);<NEW_LINE>int innerVertexSize = (int) fragment.getInnerVerticesNum();<NEW_LINE>for (int i = 0; i < innerVertexSize; ++i) {<NEW_LINE>if (ctx.degree.get(i) == 0) {<NEW_LINE>ctx.danglingVNum += 1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>DoubleMsg <MASK><NEW_LINE>DoubleMsg localSumMsg = FFITypeFactoryhelper.newDoubleMsg(base * ctx.danglingVNum);<NEW_LINE>sum(localSumMsg, msgDanglingSum);<NEW_LINE>ctx.danglingSum = msgDanglingSum.getData();<NEW_LINE>parallelMessageManager.ForceContinue();<NEW_LINE>} | msgDanglingSum = FFITypeFactoryhelper.newDoubleMsg(0.0); |
501,311 | private GraphQLInputObjectType buildQueryOptionsInputType() {<NEW_LINE>String consistencyLevelsStr = System.getProperty(STARGATE_QUERY_CONSISTENCY_LEVELS, "LOCAL_ONE,LOCAL_QUORUM,ALL,SERIAL,LOCAL_SERIAL");<NEW_LINE>GraphQLEnumType consistencyEnumBuilder = getConsistencyEnum(consistencyLevelsStr, "QueryConsistency");<NEW_LINE>return GraphQLInputObjectType.newInputObject().name("QueryOptions").description("The execution options for the query.").field(GraphQLInputObjectField.newInputObjectField().name("consistency").type(consistencyEnumBuilder).defaultValue(CassandraFetcher.DEFAULT_CONSISTENCY.toString()).build()).field(GraphQLInputObjectField.newInputObjectField().name("limit").type(Scalars.GraphQLInt).build()).field(GraphQLInputObjectField.newInputObjectField().name("pageSize").type(Scalars.GraphQLInt).defaultValue(CassandraFetcher.DEFAULT_PAGE_SIZE).build()).field(GraphQLInputObjectField.newInputObjectField().name("pageState").type(Scalars.GraphQLString).<MASK><NEW_LINE>} | build()).build(); |
51,445 | public void updateState() {<NEW_LINE>ElroConnectsDeviceHandler handler = getHandler();<NEW_LINE>if (handler == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ElroDeviceStatus elroStatus = getStatus();<NEW_LINE>int batteryLevel = 0;<NEW_LINE>String deviceStatus = this.deviceStatus;<NEW_LINE>if (deviceStatus.length() >= 6) {<NEW_LINE>batteryLevel = Integer.parseInt(deviceStatus.substring(2, 4), 16);<NEW_LINE>} else {<NEW_LINE>elroStatus = ElroDeviceStatus.FAULT;<NEW_LINE>logger.debug("Could not decode device status: {}", deviceStatus);<NEW_LINE>}<NEW_LINE>switch(elroStatus) {<NEW_LINE>case UNDEF:<NEW_LINE>handler.updateState(ENTRY, UnDefType.UNDEF);<NEW_LINE>handler.<MASK><NEW_LINE>handler.updateState(LOW_BATTERY, UnDefType.UNDEF);<NEW_LINE>handler.updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Device " + deviceId + " is not syncing with K1 hub");<NEW_LINE>break;<NEW_LINE>case FAULT:<NEW_LINE>handler.updateState(ENTRY, UnDefType.UNDEF);<NEW_LINE>handler.updateState(BATTERY_LEVEL, UnDefType.UNDEF);<NEW_LINE>handler.updateState(LOW_BATTERY, UnDefType.UNDEF);<NEW_LINE>handler.updateStatus(ThingStatus.ONLINE, ThingStatusDetail.NONE, "Device " + deviceId + " has a fault");<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>handler.updateState(ENTRY, ElroDeviceStatus.OPEN.equals(elroStatus) ? OpenClosedType.OPEN : OpenClosedType.CLOSED);<NEW_LINE>handler.updateState(BATTERY_LEVEL, new DecimalType(batteryLevel));<NEW_LINE>handler.updateState(LOW_BATTERY, (batteryLevel < 15) ? OnOffType.ON : OnOffType.OFF);<NEW_LINE>handler.updateStatus(ThingStatus.ONLINE);<NEW_LINE>}<NEW_LINE>} | updateState(BATTERY_LEVEL, UnDefType.UNDEF); |
417,423 | public ParsedDeployment build() {<NEW_LINE>List<FormDefinitionEntity> <MASK><NEW_LINE>Map<FormDefinitionEntity, FormDefinitionParse> formDefinitionToParseMap = new LinkedHashMap<>();<NEW_LINE>Map<FormDefinitionEntity, FormResourceEntity> formDefinitionToResourceMap = new LinkedHashMap<>();<NEW_LINE>for (FormResourceEntity resource : deployment.getResources().values()) {<NEW_LINE>if (isFormResource(resource.getName())) {<NEW_LINE>LOGGER.debug("Processing Form definition resource {}", resource.getName());<NEW_LINE>FormDefinitionParse parse = createFormParseFromResource(resource);<NEW_LINE>for (FormDefinitionEntity formDefinition : parse.getFormDefinitions()) {<NEW_LINE>formDefinitions.add(formDefinition);<NEW_LINE>formDefinitionToParseMap.put(formDefinition, parse);<NEW_LINE>formDefinitionToResourceMap.put(formDefinition, resource);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new ParsedDeployment(deployment, formDefinitions, formDefinitionToParseMap, formDefinitionToResourceMap);<NEW_LINE>} | formDefinitions = new ArrayList<>(); |
1,683,230 | private void sortNodes(final NodeModel parent, int fromIndex) {<NEW_LINE>final int childCount = parent.getChildCount();<NEW_LINE>if (fromIndex >= childCount)<NEW_LINE>return;<NEW_LINE>final Vector<NodeModel> sortVector = new Vector<MASK><NEW_LINE>int nodeIndex = fromIndex;<NEW_LINE>while (nodeIndex < childCount) {<NEW_LINE>final NodeModel child = parent.getChildAt(nodeIndex);<NEW_LINE>nodeIndex++;<NEW_LINE>if (SummaryNode.isSummaryNode(child)) {<NEW_LINE>sortNodes(child, 0);<NEW_LINE>break;<NEW_LINE>} else if (SummaryNode.isFirstGroupNode(child)) {<NEW_LINE>break;<NEW_LINE>} else<NEW_LINE>sortVector.add(child);<NEW_LINE>}<NEW_LINE>Collections.sort(sortVector, comparator);<NEW_LINE>final MMapController mapController = (MMapController) Controller.getCurrentModeController().getMapController();<NEW_LINE>for (final NodeModel child : sortVector) {<NEW_LINE>Controller.getCurrentModeController().getExtension(FreeNode.class).undoableDeactivateHook(child);<NEW_LINE>mapController.moveNode(child, fromIndex++);<NEW_LINE>}<NEW_LINE>sortNodes(parent, nodeIndex);<NEW_LINE>} | <NodeModel>(childCount - fromIndex); |
819,352 | private Object invokeSupport(Method delegate_method, String method_name, Object[] args) throws Throwable {<NEW_LINE>if (method_name.equals("getHostByAddr")) {<NEW_LINE>// byte[] address_bytes = (byte[])args[0];<NEW_LINE>// System.out.println( method_name + ": " + ByteFormatter.encodeString( address_bytes ));<NEW_LINE>return (delegate_method.invoke(delegate, args));<NEW_LINE>} else if (method_name.equals("lookupAllHostAddr")) {<NEW_LINE>String host_name <MASK><NEW_LINE>// System.out.println( method_name + ": " + host_name );<NEW_LINE>if (host_name == null || host_name.equals("null")) {<NEW_LINE>// get quite a few of these from 3rd party libs :(<NEW_LINE>// new Exception("Bad DNS lookup: " + host_name).printStackTrace();<NEW_LINE>} else if (host_name.endsWith(".i2p")) {<NEW_LINE>// new Exception( "Prevented DNS leak for " + host_name ).printStackTrace();<NEW_LINE>checkI2PInstall(host_name);<NEW_LINE>throw (new UnknownHostException(host_name));<NEW_LINE>} else if (host_name.endsWith(".onion")) {<NEW_LINE>// new Exception( "Prevented DNS leak for " + host_name ).printStackTrace();<NEW_LINE>throw (new UnknownHostException(host_name));<NEW_LINE>}<NEW_LINE>// System.out.println( "DNS: " + host_name );<NEW_LINE>try {<NEW_LINE>return (delegate_method.invoke(delegate, args));<NEW_LINE>} catch (InvocationTargetException e) {<NEW_LINE>Throwable target = e.getTargetException();<NEW_LINE>if (target instanceof UnknownHostException) {<NEW_LINE>throw (new InvocationTargetException(new UnknownHostException(host_name)));<NEW_LINE>} else {<NEW_LINE>throw (e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>return (delegate_method.invoke(delegate, args));<NEW_LINE>}<NEW_LINE>} | = (String) args[0]; |
39,234 | protected String createQueryString() {<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>for (String key : this.parameters.keySet()) {<NEW_LINE>if (sb.length() > 0) {<NEW_LINE>sb.append("&");<NEW_LINE>}<NEW_LINE>Object value = this.parameters.get(key);<NEW_LINE>if (value != null) {<NEW_LINE>if (value instanceof Collection<?> || value.getClass().isArray()) {<NEW_LINE>Collection<?> values = value.getClass().isArray() ? Arrays.asList((Object[]) value) <MASK><NEW_LINE>boolean first = true;<NEW_LINE>for (Object v : values) {<NEW_LINE>if (!first) {<NEW_LINE>sb.append("&");<NEW_LINE>}<NEW_LINE>first = false;<NEW_LINE>sb.append(encode(key)).append("=").append(encode(v.toString()));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>sb.append(encode(key)).append("=").append(encode(this.parameters.get(key).toString()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return sb.toString();<NEW_LINE>} | : (Collection<?>) value; |
651,791 | private void consolidateEntry(final int entryIndex) {<NEW_LINE>int previousVersionIndex = getPreviousVersionIndex(entryIndex);<NEW_LINE>if (previousVersionIndex == 0)<NEW_LINE>return;<NEW_LINE>if (getPreviousVersionIndex(previousVersionIndex) != 0) {<NEW_LINE>throw new IllegalStateException("Encountered Previous Version Entry that is not itself consolidated.");<NEW_LINE>}<NEW_LINE>int previousVersionPackedSlotsIndicators = getPackedSlotIndicators(previousVersionIndex);<NEW_LINE>// Previous version exists, needs consolidation<NEW_LINE>int packedSlotsIndicators = getPackedSlotIndicators(entryIndex);<NEW_LINE>// only bit that differs<NEW_LINE>int insertedSlotMask = packedSlotsIndicators ^ previousVersionPackedSlotsIndicators;<NEW_LINE>int slotsBelowBitNumber = packedSlotsIndicators & (insertedSlotMask - 1);<NEW_LINE>int insertedSlotIndex = Integer.bitCount(slotsBelowBitNumber);<NEW_LINE>int numberOfSlotsInEntry = Integer.bitCount(packedSlotsIndicators);<NEW_LINE>// Copy the entry slots from previous version, skipping the newly inserted slot in the target:<NEW_LINE>int sourceSlot = 0;<NEW_LINE>for (int targetSlot = 0; targetSlot < numberOfSlotsInEntry; targetSlot++) {<NEW_LINE>if (targetSlot != insertedSlotIndex) {<NEW_LINE>boolean success = true;<NEW_LINE>do {<NEW_LINE>short indexAtSlot = getIndexAtEntrySlot(previousVersionIndex, sourceSlot);<NEW_LINE>if (indexAtSlot != 0) {<NEW_LINE>// Copy observed index at slot to current entry<NEW_LINE>// (only copy value in if previous value is less than new one AND is non-zero)<NEW_LINE>casIndexAtEntrySlotIfNonZeroAndLessThan(entryIndex, targetSlot, indexAtSlot);<NEW_LINE>// CAS the previous version slot to 0.<NEW_LINE>// (Succeeds only if the index in that slot has not changed. Retry if it did).<NEW_LINE>success = casIndexAtEntrySlot(previousVersionIndex, sourceSlot<MASK><NEW_LINE>}<NEW_LINE>} while (!success);<NEW_LINE>sourceSlot++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>setPreviousVersionIndex(entryIndex, (short) 0);<NEW_LINE>} | , indexAtSlot, (short) 0); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.