idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
617,651 | public void onInitFinished(@Nullable JSONObject referringParams, @Nullable BranchError error) {<NEW_LINE>Log.d(TAG, "onInitFinished: with params: " + (referringParams == null ? "null" : referringParams) + ", with error " + (error == null ? "null" : error.getMessage()));<NEW_LINE>mLoader.stop();<NEW_LINE>if (referringParams == null)<NEW_LINE>return;<NEW_LINE>String key = referringParams.optString("publishable_key");<NEW_LINE>String userId = referringParams.optString("driver_id");<NEW_LINE>if (!key.isEmpty()) {<NEW_LINE>Log.d(TAG, "Got publishable key from branch.io payload" + key);<NEW_LINE>SharedHelper sharedHelper = SharedHelper.getInstance(LaunchActivity.this);<NEW_LINE>sharedHelper.setHyperTrackPubKey(key);<NEW_LINE>sharedHelper.setLoginType(SharedHelper.LOGIN_TYPE_DEEPLINK);<NEW_LINE>if (!userId.isEmpty()) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>LaunchActivity.this.onLoginCompleted();<NEW_LINE>}<NEW_LINE>} | sharedHelper.setUserNameAndPhone(userId, null); |
1,283,344 | protected Control createPageContents(Composite parent) {<NEW_LINE>Composite propsGroup = new Composite(parent, SWT.NONE);<NEW_LINE>propsGroup.setLayout(new GridLayout(2, false));<NEW_LINE>GridData gd <MASK><NEW_LINE>propsGroup.setLayoutData(gd);<NEW_LINE>// $NON-NLS-2$<NEW_LINE>final Text nameText = UIUtils.createLabelText(propsGroup, EditorsMessages.dialog_struct_attribute_edit_page_label_text_name, attribute.getName());<NEW_LINE>nameText.selectAll();<NEW_LINE>nameText.addModifyListener(e -> {<NEW_LINE>if (attribute instanceof DBPNamedObject2) {<NEW_LINE>((DBPNamedObject2) attribute).setName(DBObjectNameCaseTransformer.transformName(attribute.getDataSource(), nameText.getText().trim()));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>UIUtils.createControlLabel(propsGroup, EditorsMessages.dialog_struct_attribute_edit_page_label_text_properties).setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));<NEW_LINE>propertyViewer = new PropertyTreeViewer(propsGroup, SWT.BORDER);<NEW_LINE>gd = new GridData(GridData.FILL_BOTH);<NEW_LINE>gd.widthHint = 400;<NEW_LINE>propertyViewer.getControl().setLayoutData(gd);<NEW_LINE>propertyViewer.addFilter(new ViewerFilter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean select(Viewer viewer, Object parentElement, Object element) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>PropertySourceAbstract pc = new PropertySourceEditable(commandContext, attribute, attribute) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void setPropertyValue(@Nullable DBRProgressMonitor monitor, Object editableValue, ObjectPropertyDescriptor prop, Object newValue) throws IllegalArgumentException {<NEW_LINE>super.setPropertyValue(monitor, editableValue, prop, newValue);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>pc.collectProperties();<NEW_LINE>for (DBPPropertyDescriptor prop : pc.getProperties()) {<NEW_LINE>if (prop instanceof ObjectPropertyDescriptor) {<NEW_LINE>if (((ObjectPropertyDescriptor) prop).isEditPossible(attribute) && !((ObjectPropertyDescriptor) prop).isNameProperty()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>pc.removeProperty(prop);<NEW_LINE>}<NEW_LINE>propertyViewer.loadProperties(pc);<NEW_LINE>return propsGroup;<NEW_LINE>} | = new GridData(GridData.FILL_HORIZONTAL); |
1,691,209 | public void removeInstance(Integer containerId, String componentName) throws PackingException {<NEW_LINE>initContainers();<NEW_LINE>Container container = containers.get(containerId);<NEW_LINE>if (container == null) {<NEW_LINE>throw new PackingException(String.format("Failed to remove component '%s' because container " + "with id %d does not exist.", componentName, containerId));<NEW_LINE>}<NEW_LINE>Optional<PackingPlan.InstancePlan> <MASK><NEW_LINE>if (instancePlan.isPresent()) {<NEW_LINE>taskIds.remove(instancePlan.get().getTaskId());<NEW_LINE>if (componentIndexes.containsKey(componentName)) {<NEW_LINE>componentIndexes.get(componentName).remove(instancePlan.get().getComponentIndex());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new PackingException(String.format("Failed to remove component '%s' because container " + "with id %d does not include that component'", componentName, containerId));<NEW_LINE>}<NEW_LINE>} | instancePlan = container.removeAnyInstanceOfComponent(componentName); |
241,861 | final DeleteReportDefinitionResult executeDeleteReportDefinition(DeleteReportDefinitionRequest deleteReportDefinitionRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteReportDefinitionRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteReportDefinitionRequest> request = null;<NEW_LINE>Response<DeleteReportDefinitionResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteReportDefinitionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteReportDefinitionRequest));<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, "Cost and Usage Report Service");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteReportDefinition");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteReportDefinitionResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteReportDefinitionResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.endEvent(Field.RequestMarshallTime); |
726,558 | final DeleteSecurityConfigurationResult executeDeleteSecurityConfiguration(DeleteSecurityConfigurationRequest deleteSecurityConfigurationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteSecurityConfigurationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteSecurityConfigurationRequest> request = null;<NEW_LINE>Response<DeleteSecurityConfigurationResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteSecurityConfigurationRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteSecurityConfigurationRequest));<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, "Glue");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteSecurityConfiguration");<NEW_LINE>request.<MASK><NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteSecurityConfigurationResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteSecurityConfigurationResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig); |
653,323 | public Pair<OperandSize, String> generate(final ITranslationEnvironment environment, final long offset, final List<ReilInstruction> instructions) throws InternalTranslationException {<NEW_LINE>Preconditions.checkNotNull(environment, "Error: Argument environment can't be null");<NEW_LINE>Preconditions.checkNotNull(instructions, "Error: Argument instructions can't be null");<NEW_LINE>Preconditions.checkArgument(offset >= 0, "Error: Argument offset can't be less than 0");<NEW_LINE>// not below: (CF == 0 AND ZF == 0)<NEW_LINE>final String negatedCarry = environment.getNextVariableString();<NEW_LINE>final String negatedZero = environment.getNextVariableString();<NEW_LINE>final String result = environment.getNextVariableString();<NEW_LINE>instructions.add(ReilHelpers.createXor(offset, OperandSize.BYTE, Helpers.CARRY_FLAG, OperandSize.BYTE, "1", OperandSize.BYTE, negatedCarry));<NEW_LINE>instructions.add(ReilHelpers.createXor(offset + 1, OperandSize.BYTE, Helpers.OVERFLOW_FLAG, OperandSize.BYTE, "1", OperandSize.BYTE, negatedZero));<NEW_LINE>instructions.add(ReilHelpers.createAnd(offset + 2, OperandSize.BYTE, negatedCarry, OperandSize.BYTE, negatedZero<MASK><NEW_LINE>return new Pair<OperandSize, String>(OperandSize.BYTE, result);<NEW_LINE>} | , OperandSize.BYTE, result)); |
1,283,373 | public String sendHttpJsonDownstreamMessage(String destination, Message message) throws IOException {<NEW_LINE>JSONObject jsonBody = new JSONObject();<NEW_LINE>try {<NEW_LINE>jsonBody.put(PARAM_TO, destination);<NEW_LINE>jsonBody.putOpt(PARAM_COLLAPSE_KEY, message.getCollapseKey());<NEW_LINE>jsonBody.putOpt(PARAM_RESTRICTED_PACKAGE_NAME, message.getRestrictedPackageName());<NEW_LINE>jsonBody.putOpt(PARAM_TIME_TO_LIVE, message.getTimeToLive());<NEW_LINE>jsonBody.putOpt(PARAM_DELAY_WHILE_IDLE, message.isDelayWhileIdle());<NEW_LINE>jsonBody.putOpt(<MASK><NEW_LINE>if (message.getData().size() > 0) {<NEW_LINE>JSONObject jsonPayload = new JSONObject(message.getData());<NEW_LINE>jsonBody.put(PARAM_JSON_PAYLOAD, jsonPayload);<NEW_LINE>}<NEW_LINE>if (message.getNotificationParams().size() > 0) {<NEW_LINE>JSONObject jsonNotificationParams = new JSONObject(message.getNotificationParams());<NEW_LINE>jsonBody.put(PARAM_JSON_NOTIFICATION_PARAMS, jsonNotificationParams);<NEW_LINE>}<NEW_LINE>} catch (JSONException e) {<NEW_LINE>logger.log(Log.ERROR, "Failed to build JSON body");<NEW_LINE>throw new IOException("Failed to build JSON body");<NEW_LINE>}<NEW_LINE>HttpRequest httpRequest = new HttpRequest();<NEW_LINE>httpRequest.setHeader(HEADER_CONTENT_TYPE, CONTENT_TYPE_JSON);<NEW_LINE>httpRequest.setHeader(HEADER_AUTHORIZATION, "key=" + key);<NEW_LINE>httpRequest.doPost(GCM_SEND_ENDPOINT, jsonBody.toString());<NEW_LINE>if (httpRequest.getResponseCode() != 200) {<NEW_LINE>throw new IOException("Invalid request." + " status: " + httpRequest.getResponseCode() + " response: " + httpRequest.getResponseBody());<NEW_LINE>}<NEW_LINE>JSONObject jsonResponse;<NEW_LINE>try {<NEW_LINE>jsonResponse = new JSONObject(httpRequest.getResponseBody());<NEW_LINE>logger.log(Log.INFO, "Send message:\n" + jsonResponse.toString(2));<NEW_LINE>} catch (JSONException e) {<NEW_LINE>logger.log(Log.ERROR, "Failed to parse server response:\n" + httpRequest.getResponseBody());<NEW_LINE>}<NEW_LINE>return httpRequest.getResponseBody();<NEW_LINE>} | PARAM_DRY_RUN, message.isDryRun()); |
22,068 | public static void addJarPath(ProtectionDomain domain) {<NEW_LINE>if (domain != null && domain.getCodeSource() != null && domain.getCodeSource().getLocation() != null) {<NEW_LINE>String path = domain.getCodeSource().getLocation().getFile();<NEW_LINE>if (!StringUtils.isEmpty(path)) {<NEW_LINE>if ((path.endsWith(".jar") || path.endsWith(".jar!") || path.endsWith(".jar!/") || path.endsWith(".jar/") || path.endsWith(".jar!" + File.separator)) && !(loadedJarPaths.size() >= MAX_DEPENDENCES_CACHE)) {<NEW_LINE>if (!path.endsWith(".jar")) {<NEW_LINE>int start = path.contains("/") ? path.indexOf("/") : path.indexOf("\\");<NEW_LINE>path = path.substring(start, path<MASK><NEW_LINE>}<NEW_LINE>loadedJarPaths.add(path);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .lastIndexOf(".jar") + 4); |
1,756,511 | final ListDelegatedAdministratorsResult executeListDelegatedAdministrators(ListDelegatedAdministratorsRequest listDelegatedAdministratorsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listDelegatedAdministratorsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListDelegatedAdministratorsRequest> request = null;<NEW_LINE>Response<ListDelegatedAdministratorsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListDelegatedAdministratorsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listDelegatedAdministratorsRequest));<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.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListDelegatedAdministrators");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListDelegatedAdministratorsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListDelegatedAdministratorsResultJsonUnmarshaller());<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.SERVICE_ID, "Organizations"); |
988,776 | public T visitRouteSubscript(RouteSubscriptContext ctx) {<NEW_LINE>RouteVariable atNode = (RouteVariable) this.instStack.pop();<NEW_LINE><MASK><NEW_LINE>TerminalNode stringNode = ctx.STRING();<NEW_LINE>ExprContext exprContext = ctx.expr();<NEW_LINE>//<NEW_LINE>BlockLocation locationInfo = code(new BlockLocation(), ctx);<NEW_LINE>CodeLocation startPos = locationInfo.getStartPosition();<NEW_LINE>CodeLocation endPos = locationInfo.getEndPosition();<NEW_LINE>if (atNode instanceof EnterRouteVariable) {<NEW_LINE>startPos = atNode.getStartPosition();<NEW_LINE>}<NEW_LINE>//<NEW_LINE>if (intNode != null) {<NEW_LINE>IntegerToken subscriptToken = code(new IntegerToken(Integer.parseInt(intNode.getText())), intNode);<NEW_LINE>this.instStack.push(code(new SubscriptRouteVariable(atNode, subscriptToken), startPos, endPos));<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (stringNode != null) {<NEW_LINE>StringToken subscriptToken = code(new StringToken(fixString(stringNode)), stringNode);<NEW_LINE>this.instStack.push(code(new SubscriptRouteVariable(atNode, subscriptToken), startPos, endPos));<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (exprContext != null) {<NEW_LINE>exprContext.accept(this);<NEW_LINE>Expression expr = (Expression) this.instStack.pop();<NEW_LINE>this.instStack.push(code(new SubscriptRouteVariable(atNode, expr), startPos, endPos));<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>throw newParseException(ctx.start, "parser failed -> visitRouteSubscript.");<NEW_LINE>} | TerminalNode intNode = ctx.INTEGER_NUM(); |
837,470 | public void generateMetatype() throws Exception {<NEW_LINE>final boolean trace = TraceComponent.isAnyTracingEnabled();<NEW_LINE>ClassLoader raClassLoader = cmInfo.getClassLoader();<NEW_LINE>this.rarFileName = cmInfo.getURI();<NEW_LINE>this.urls = cmInfo.getContainer().getURLs();<NEW_LINE>// configurationHelper<NEW_LINE>Map<String, Object> metagenConfig = metadataImpl.getMetaGenConfig();<NEW_LINE>metagenConfig.put(MetaGenConstants.KEY_RAR_CLASSLOADER, raClassLoader);<NEW_LINE>MetaTypeFactory mtpService = Utils.priv.getService(bundleContext, MetaTypeFactory.class);<NEW_LINE>metatype = <MASK><NEW_LINE>metatypeXML = metatype.toMetatypeString(true);<NEW_LINE>List<MetatypeOcd> ocds = metatype.getOcds();<NEW_LINE>factoryPids = new ArrayList<String>(ocds.size());<NEW_LINE>bootstrapContextFactoryPid = null;<NEW_LINE>for (MetatypeOcd ocd : ocds) {<NEW_LINE>String pid = ocd.getId();<NEW_LINE>factoryPids.add(pid);<NEW_LINE>if (pid.charAt(15) == 'r') {<NEW_LINE>// com.ibm.ws.jca.resourceAdapter.properties.*<NEW_LINE>bootstrapContextFactoryPid = pid;<NEW_LINE>bootstrapContextAlias = ocd.getChildAlias();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>autoStart = metadataImpl.getAutoStart();<NEW_LINE>if (autoStart == null)<NEW_LINE>// Default to auto start only if there are no resources (not the resource adapter config itself) that could trigger lazy start<NEW_LINE>autoStart = ocds.size() <= 1;<NEW_LINE>// Disallow duplicates (case insensitive)<NEW_LINE>String previousValue = bootstrapContextFactoryPids.putIfAbsent(id.toUpperCase(), bootstrapContextFactoryPid);<NEW_LINE>if (previousValue != null)<NEW_LINE>throw new StateChangeException(Tr.formatMessage(tc, "J2CA8815.duplicate.resource.adapter.id", id));<NEW_LINE>// Create the default configuration for the resource adapter config singleton<NEW_LINE>try {<NEW_LINE>defaultInstance = metadataImpl.getDefaultInstancesXML(bootstrapContextAlias);<NEW_LINE>if (defaultInstance == null) {<NEW_LINE>defaultInstance = "<server>\n <" + bootstrapContextFactoryPid + "/>\n</server>";<NEW_LINE>}<NEW_LINE>if (trace && tc.isDebugEnabled())<NEW_LINE>Tr.debug(this, tc, "[" + id + "] defaultInstance " + defaultInstance);<NEW_LINE>} catch (Exception x) {<NEW_LINE>bootstrapContextFactoryPids.remove(id.toUpperCase(), bootstrapContextFactoryPid);<NEW_LINE>throw new StateChangeException(x);<NEW_LINE>}<NEW_LINE>} | MetatypeGenerator.generateMetatype(metagenConfig, mtpService); |
1,353,461 | public static ListTransitRouterAvailableResourceResponse unmarshall(ListTransitRouterAvailableResourceResponse listTransitRouterAvailableResourceResponse, UnmarshallerContext _ctx) {<NEW_LINE>listTransitRouterAvailableResourceResponse.setRequestId(_ctx.stringValue("ListTransitRouterAvailableResourceResponse.RequestId"));<NEW_LINE>List<String> slaveZones = new ArrayList<String>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListTransitRouterAvailableResourceResponse.SlaveZones.Length"); i++) {<NEW_LINE>slaveZones.add(_ctx.stringValue("ListTransitRouterAvailableResourceResponse.SlaveZones[" + i + "]"));<NEW_LINE>}<NEW_LINE>listTransitRouterAvailableResourceResponse.setSlaveZones(slaveZones);<NEW_LINE>List<String> masterZones = new ArrayList<String>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListTransitRouterAvailableResourceResponse.MasterZones.Length"); i++) {<NEW_LINE>masterZones.add(_ctx.stringValue<MASK><NEW_LINE>}<NEW_LINE>listTransitRouterAvailableResourceResponse.setMasterZones(masterZones);<NEW_LINE>return listTransitRouterAvailableResourceResponse;<NEW_LINE>} | ("ListTransitRouterAvailableResourceResponse.MasterZones[" + i + "]")); |
21,422 | private static Schema validateOrMergeWriteSchema(Table table, StructType dsSchema, SparkWriteConf writeConf) {<NEW_LINE>Schema writeSchema;<NEW_LINE>if (writeConf.mergeSchema()) {<NEW_LINE>// convert the dataset schema and assign fresh ids for new fields<NEW_LINE>Schema newSchema = SparkSchemaUtil.convertWithFreshIds(table.schema(), dsSchema);<NEW_LINE>// update the table to get final id assignments and validate the changes<NEW_LINE>UpdateSchema update = table.updateSchema().unionByNameWith(newSchema);<NEW_LINE>Schema mergedSchema = update.apply();<NEW_LINE>// reconvert the dsSchema without assignment to use the ids assigned by UpdateSchema<NEW_LINE>writeSchema = SparkSchemaUtil.convert(mergedSchema, dsSchema);<NEW_LINE>TypeUtil.validateWriteSchema(mergedSchema, writeSchema, writeConf.checkNullability(), writeConf.checkOrdering());<NEW_LINE>// if the validation passed, update the table schema<NEW_LINE>update.commit();<NEW_LINE>} else {<NEW_LINE>writeSchema = SparkSchemaUtil.convert(table.schema(), dsSchema);<NEW_LINE>TypeUtil.validateWriteSchema(table.schema(), writeSchema, writeConf.checkNullability(<MASK><NEW_LINE>}<NEW_LINE>return writeSchema;<NEW_LINE>} | ), writeConf.checkOrdering()); |
1,293,598 | public ResponseEntity<?> countItems(DomainTypeAdministrationConfiguration domainTypeAdministrationConfiguration, RootResourceInformation repoRequest, WebRequest request, @PathVariable String scopeName) {<NEW_LINE>DynamicRepositoryInvoker repositoryInvoker = (DynamicRepositoryInvoker) repoRequest.getInvoker();<NEW_LINE>PersistentEntity<?, ?> persistentEntity = repoRequest.getPersistentEntity();<NEW_LINE>final ScopeMetadata scope = domainTypeAdministrationConfiguration.getScopes().getScope(scopeName);<NEW_LINE>final Specification filterSpecification = specificationFromRequest(request, persistentEntity);<NEW_LINE>if (isPredicateScope(scope)) {<NEW_LINE><MASK><NEW_LINE>return new ResponseEntity(countItemsBySpecificationAndPredicate(repositoryInvoker, filterSpecification, predicateScope.predicate()), HttpStatus.OK);<NEW_LINE>}<NEW_LINE>if (isSpecificationScope(scope)) {<NEW_LINE>final Specification scopeSpecification = ((ScopeMetadataUtils.SpecificationScopeMetadata) scope).specification();<NEW_LINE>return new ResponseEntity(countItemsBySpecification(repositoryInvoker, and(scopeSpecification, filterSpecification)), HttpStatus.OK);<NEW_LINE>}<NEW_LINE>return new ResponseEntity(countItemsBySpecification(repositoryInvoker, filterSpecification), HttpStatus.OK);<NEW_LINE>} | final PredicateScopeMetadata predicateScope = (PredicateScopeMetadata) scope; |
160,156 | public static void install(final ModeController modeController) {<NEW_LINE>final PresentationController presentationController = new PresentationController(modeController);<NEW_LINE>modeController.addExtension(PresentationController.class, presentationController);<NEW_LINE>presentationController.registerActions();<NEW_LINE>presentationController.addMapSelectionListener();<NEW_LINE>new PresentationBuilder().register(modeController.getMapController(), presentationController);<NEW_LINE>HighlightController highlightController = modeController.getController(<MASK><NEW_LINE>final PresentationState presentationState = presentationController.presentationState;<NEW_LINE>new PresentationPngExporter.ActionInstaller().installActions(modeController, presentationState);<NEW_LINE>final JTabbedPane tabs = UITools.getFreeplaneTabbedPanel();<NEW_LINE>tabs.add(TextUtils.getText("presentation_panel"), presentationController.createPanel());<NEW_LINE>highlightController.addNodeHighlighter(new NodeHighlighter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean isNodeHighlighted(NodeModel node, boolean isPrinting) {<NEW_LINE>return !isPrinting && presentationState.shouldHighlightNodeContainedOnSlide(node);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void configure(Graphics2D g, boolean isPrinting) {<NEW_LINE>g.setColor(NODE_HIGHLIGHTING_COLOR);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>highlightController.addNodeHighlighter(new NodeHighlighter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean isNodeHighlighted(NodeModel node, boolean isPrinting) {<NEW_LINE>return !isPrinting && presentationState.shouldHighlightNodeFoldedOnSlide(node);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void configure(Graphics2D g, boolean isPrinting) {<NEW_LINE>g.setColor(NODE_HIGHLIGHTING_COLOR);<NEW_LINE>g.setStroke(FOLDED_NODE_STROKE);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>KeyEventDispatcher navigationKeyEventDispatcher = new NavigationKeyEventDispatcher(presentationState);<NEW_LINE>KeyEventDispatcher escapeKeyEventDispatcher = new EscapeKeyEventDispatcher(presentationState);<NEW_LINE>final PresentationAutomation presentationKeyHandler = new PresentationAutomation(presentationState, PresentationKeyEventDispatcher.of(navigationKeyEventDispatcher, PROCESS_NAVIGATION_KEYS_PROPERTY), PresentationKeyEventDispatcher.of(escapeKeyEventDispatcher, PROCESS_ESCAPE_KEY_PROPERTY));<NEW_LINE>presentationState.addPresentationStateListener(presentationKeyHandler);<NEW_LINE>} | ).getExtension(HighlightController.class); |
1,170,012 | private static void colourIntelDialogRow(View row, Map<String, Integer> classifier, String key) {<NEW_LINE>if (Integer.valueOf(Classifier.LIKE).equals(classifier.get(key))) {<NEW_LINE>row.findViewById(R.id.intel_row_like).setBackgroundResource(R.drawable.ic_like_active);<NEW_LINE>row.findViewById(R.id.intel_row_dislike).setBackgroundResource(R.drawable.ic_dislike_gray55);<NEW_LINE>row.findViewById(R.id.intel_row_clear).setBackgroundResource(R.drawable.ic_clear_gray55);<NEW_LINE>} else if (Integer.valueOf(Classifier.DISLIKE).equals(classifier.get(key))) {<NEW_LINE>row.findViewById(R.id.intel_row_like).<MASK><NEW_LINE>row.findViewById(R.id.intel_row_dislike).setBackgroundResource(R.drawable.ic_dislike_active);<NEW_LINE>row.findViewById(R.id.intel_row_clear).setBackgroundResource(R.drawable.ic_clear_gray55);<NEW_LINE>} else {<NEW_LINE>row.findViewById(R.id.intel_row_like).setBackgroundResource(R.drawable.ic_like_gray55);<NEW_LINE>row.findViewById(R.id.intel_row_dislike).setBackgroundResource(R.drawable.ic_dislike_gray55);<NEW_LINE>row.findViewById(R.id.intel_row_clear).setBackgroundResource(R.drawable.ic_clear_gray55);<NEW_LINE>}<NEW_LINE>} | setBackgroundResource(R.drawable.ic_like_gray55); |
1,405,136 | private Set<String> readModifiedFilesFromURL(HttpClient client, String url) throws Exception {<NEW_LINE>Set<String> modifiedFiles = new HashSet<>();<NEW_LINE>HttpGet getRequest = new HttpGet(url);<NEW_LINE>getRequest.addHeader("Authorization", "token " + ACCESS_TOKEN);<NEW_LINE>HttpResponse firstResponse = client.execute(getRequest);<NEW_LINE>String responseStr = EntityUtils.toString(firstResponse.getEntity());<NEW_LINE>// Dump the JSON array output of the API call into an object to iteration on<NEW_LINE>JsonReader outputJsonReader = Json.createReader(new StringReader(responseStr));<NEW_LINE>JsonArray outputJsonArray = null;<NEW_LINE>try {<NEW_LINE>outputJsonArray = outputJsonReader.readArray();<NEW_LINE>} catch (Exception e) {<NEW_LINE>// This usually happens if we had a bad auth token<NEW_LINE>System.out.println(responseStr);<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>outputJsonReader.close();<NEW_LINE>// Parse through each JSON element looking for the name of the file that was changed<NEW_LINE>for (int index = 0; index < outputJsonArray.size(); index++) {<NEW_LINE>JsonObject currentJson = outputJsonArray.getJsonObject(index);<NEW_LINE>String <MASK><NEW_LINE>modifiedFiles.add(changedFile);<NEW_LINE>}<NEW_LINE>return modifiedFiles;<NEW_LINE>} | changedFile = currentJson.getString("filename"); |
244,669 | public void configure(TestElement element) {<NEW_LINE>super.configure(element);<NEW_LINE>servername.setText(element.getPropertyAsString(LDAPSampler.SERVERNAME));<NEW_LINE>port.setText(element.getPropertyAsString(LDAPSampler.PORT));<NEW_LINE>rootdn.setText(element.getPropertyAsString(LDAPSampler.ROOTDN));<NEW_LINE>CardLayout cl = <MASK><NEW_LINE>final String testType = element.getPropertyAsString(LDAPSampler.TEST);<NEW_LINE>if (testType.equals(LDAPSampler.ADD)) {<NEW_LINE>addTest.setSelected(true);<NEW_LINE>add.setText(element.getPropertyAsString(LDAPSampler.BASE_ENTRY_DN));<NEW_LINE>tableAddPanel.configure((TestElement) element.getProperty(LDAPSampler.ARGUMENTS).getObjectValue());<NEW_LINE>cl.show(cards, "Add");<NEW_LINE>} else if (testType.equals(LDAPSampler.MODIFY)) {<NEW_LINE>modifyTest.setSelected(true);<NEW_LINE>modify.setText(element.getPropertyAsString(LDAPSampler.BASE_ENTRY_DN));<NEW_LINE>tableModifyPanel.configure((TestElement) element.getProperty(LDAPSampler.ARGUMENTS).getObjectValue());<NEW_LINE>cl.show(cards, "Modify");<NEW_LINE>} else if (testType.equals(LDAPSampler.DELETE)) {<NEW_LINE>deleteTest.setSelected(true);<NEW_LINE>delete.setText(element.getPropertyAsString(LDAPSampler.DELETE));<NEW_LINE>cl.show(cards, "Delete");<NEW_LINE>} else if (testType.equals(LDAPSampler.SEARCHBASE)) {<NEW_LINE>searchTest.setSelected(true);<NEW_LINE>searchbase.setText(element.getPropertyAsString(LDAPSampler.SEARCHBASE));<NEW_LINE>searchfilter.setText(element.getPropertyAsString(LDAPSampler.SEARCHFILTER));<NEW_LINE>cl.show(cards, "Search");<NEW_LINE>}<NEW_LINE>if (element.getPropertyAsBoolean(LDAPSampler.USER_DEFINED)) {<NEW_LINE>userDefined.setSelected(true);<NEW_LINE>} else {<NEW_LINE>userDefined.setSelected(false);<NEW_LINE>// $NON-NLS-1$<NEW_LINE>cl.show(cards, "");<NEW_LINE>}<NEW_LINE>} | (CardLayout) cards.getLayout(); |
181,984 | final Cluster executeResumeCluster(ResumeClusterRequest resumeClusterRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(resumeClusterRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ResumeClusterRequest> request = null;<NEW_LINE>Response<Cluster> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ResumeClusterRequestMarshaller().marshall(super.beforeMarshalling(resumeClusterRequest));<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, "Redshift");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ResumeCluster");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<Cluster> responseHandler = new StaxResponseHandler<Cluster>(new ClusterStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | endClientExecution(awsRequestMetrics, request, response); |
1,107,994 | public void process(LArrayAccessor<TupleDesc_U8> points, DogArray_I32 assignments, FastAccess<TupleDesc_U8> clusters) {<NEW_LINE>// see if it should run the single thread version instead<NEW_LINE>if (points.size() < minimumForConcurrent) {<NEW_LINE>super.process(points, assignments, clusters);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (assignments.size != points.size())<NEW_LINE>throw new IllegalArgumentException("Points and assignments need to be the same size");<NEW_LINE>// Compute the sum of all points in each cluster<NEW_LINE>BoofConcurrency.loopBlocks(0, points.size(), threadData, (data, idx0, idx1) -> {<NEW_LINE>final TupleDesc_U8 tuple = data.point;<NEW_LINE>final DogArray<int[]> sums = data.clusterSums;<NEW_LINE>sums.resize(clusters.size);<NEW_LINE>for (int i = 0; i < sums.size; i++) {<NEW_LINE>Arrays.fill(sums.data[i], 0);<NEW_LINE>}<NEW_LINE>final DogArray_I32 counts = data.counts;<NEW_LINE>counts.resize(sums.size, 0);<NEW_LINE>for (int pointIdx = idx0; pointIdx < idx1; pointIdx++) {<NEW_LINE>points.getCopy(pointIdx, tuple);<NEW_LINE>final byte[] point = tuple.data;<NEW_LINE>int clusterIdx = assignments.get(pointIdx);<NEW_LINE>counts.data[clusterIdx]++;<NEW_LINE>int[] sum = sums.get(clusterIdx);<NEW_LINE>for (int i = 0; i < point.length; i++) {<NEW_LINE>sum[i] += point[i] & 0xFF;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// Stitch results from threads back together<NEW_LINE>counts.reset();<NEW_LINE>counts.resize(clusters.size, 0);<NEW_LINE>means.resize(clusters.size);<NEW_LINE>for (int i = 0; i < clusters.size; i++) {<NEW_LINE>Arrays.fill(means.data[i], 0);<NEW_LINE>}<NEW_LINE>for (int threadIdx = 0; threadIdx < threadData.size(); threadIdx++) {<NEW_LINE>ThreadData data = threadData.get(threadIdx);<NEW_LINE>for (int clusterIdx = 0; clusterIdx < clusters.size; clusterIdx++) {<NEW_LINE>int[] a = data.clusterSums.get(clusterIdx);<NEW_LINE>int[] b = means.get(clusterIdx);<NEW_LINE>for (int i = 0; i < b.length; i++) {<NEW_LINE>b[i] += a[i];<NEW_LINE>}<NEW_LINE>counts.data[clusterIdx] += <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Divide to get the average value in each cluster<NEW_LINE>for (int clusterIdx = 0; clusterIdx < clusters.size; clusterIdx++) {<NEW_LINE>int[] sum = means.get(clusterIdx);<NEW_LINE>byte[] cluster = clusters.get(clusterIdx).data;<NEW_LINE>double divisor = counts.get(clusterIdx);<NEW_LINE>for (int i = 0; i < cluster.length; i++) {<NEW_LINE>cluster[i] = (byte) (sum[i] / divisor);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | data.counts.data[clusterIdx]; |
1,512,779 | public static void parse(String text, JTextPane pane) {<NEW_LINE>try {<NEW_LINE>Matcher match = TEXT_PATTERN.matcher(text);<NEW_LINE>Document doc = pane.getDocument();<NEW_LINE>// Start of current text area<NEW_LINE>int textStart = 0;<NEW_LINE>// Style for next set of text<NEW_LINE>Style style = null;<NEW_LINE>while (match.find()) {<NEW_LINE>// Save the current text first<NEW_LINE>String styledText = text.substring(textStart, match.start());<NEW_LINE>textStart <MASK><NEW_LINE>if (style != null) {<NEW_LINE>doc.insertString(doc.getLength(), styledText, style);<NEW_LINE>}<NEW_LINE>// endif<NEW_LINE>// Get the next style<NEW_LINE>style = pane.getStyle(match.group(1));<NEW_LINE>if (style == null)<NEW_LINE>throw new IllegalArgumentException("Unknown style: '" + match.group(1));<NEW_LINE>}<NEW_LINE>// endwhile<NEW_LINE>// Add the last of the text<NEW_LINE>doc.insertString(doc.getLength(), text.substring(textStart), null);<NEW_LINE>} catch (BadLocationException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>throw new IllegalStateException("This should not happen since I always use the document to " + "determine the location to write. It might be due to synchronization problems though", e);<NEW_LINE>}<NEW_LINE>} | = match.end() + 1; |
40,395 | // IFlowItems<NEW_LINE>@Override<NEW_LINE>public int tryExtractItems(int count, EnumFacing from, EnumDyeColor colour, IStackFilter filter, boolean simulate) {<NEW_LINE>if (pipe.getHolder().getPipeWorld().isRemote) {<NEW_LINE>throw new IllegalStateException("Cannot extract items on the client side!");<NEW_LINE>}<NEW_LINE>if (from == null) {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>TileEntity tile = pipe.getConnectedTile(from);<NEW_LINE>IItemTransactor trans = ItemTransactorHelper.getTransactor(tile, from.getOpposite());<NEW_LINE>ItemStack possible = trans.extract(filter, 1, count, true);<NEW_LINE>if (possible.isEmpty()) {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>if (possible.getCount() > possible.getMaxStackSize()) {<NEW_LINE>possible.setCount(possible.getMaxStackSize());<NEW_LINE>count = possible.getMaxStackSize();<NEW_LINE>}<NEW_LINE>IPipeHolder holder = pipe.getHolder();<NEW_LINE>PipeEventItem.TryInsert tryInsert = new PipeEventItem.TryInsert(holder, this, colour, from, possible);<NEW_LINE>holder.fireEvent(tryInsert);<NEW_LINE>if (tryInsert.isCanceled() || tryInsert.accepted <= 0) {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>count = Math.min(count, tryInsert.accepted);<NEW_LINE>ItemStack stack = trans.extract(<MASK><NEW_LINE>if (stack.isEmpty()) {<NEW_LINE>throw new IllegalStateException("The transactor " + trans + " returned an empty itemstack from a known good request!");<NEW_LINE>}<NEW_LINE>if (!simulate) {<NEW_LINE>insertItemEvents(stack, colour, EXTRACT_SPEED, from);<NEW_LINE>}<NEW_LINE>return count;<NEW_LINE>} | filter, count, count, simulate); |
693,916 | public AmazonWebServiceResponse<S3Object> handle(HttpResponse response) throws Exception {<NEW_LINE><MASK><NEW_LINE>final AmazonWebServiceResponse<S3Object> awsResponse = parseResponseMetadata(response);<NEW_LINE>if (response.getHeaders().get(Headers.REDIRECT_LOCATION) != null) {<NEW_LINE>object.setRedirectLocation(response.getHeaders().get(Headers.REDIRECT_LOCATION));<NEW_LINE>}<NEW_LINE>// If the requester is charged when downloading a object from an<NEW_LINE>// Requester Pays bucket, then this header is set.<NEW_LINE>if (response.getHeaders().get(Headers.REQUESTER_CHARGED_HEADER) != null) {<NEW_LINE>object.setRequesterCharged(true);<NEW_LINE>}<NEW_LINE>if (response.getHeaders().get(Headers.S3_TAGGING_COUNT) != null) {<NEW_LINE>object.setTaggingCount(Integer.parseInt(response.getHeaders().get(Headers.S3_TAGGING_COUNT)));<NEW_LINE>}<NEW_LINE>final ObjectMetadata metadata = object.getObjectMetadata();<NEW_LINE>populateObjectMetadata(response, metadata);<NEW_LINE>object.setObjectContent(new S3ObjectInputStream(response.getContent()));<NEW_LINE>awsResponse.setResult(object);<NEW_LINE>return awsResponse;<NEW_LINE>} | final S3Object object = new S3Object(); |
826,307 | private int computeDurationDivisor() {<NEW_LINE>try {<NEW_LINE>final SortedSet<Rational> durations = new TreeSet<>();<NEW_LINE>// Collect duration values for each standard chord in this page<NEW_LINE>for (SystemInfo system : getSystems()) {<NEW_LINE>for (MeasureStack stack : system.getStacks()) {<NEW_LINE>for (AbstractChordInter chord : stack.getStandardChords()) {<NEW_LINE>try {<NEW_LINE>final Rational duration = chord.isMeasureRest() ? stack.getExpectedDuration() : chord.getDuration();<NEW_LINE>if (duration != null) {<NEW_LINE>durations.add(duration);<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>logger.warn(getClass().getSimpleName(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Compute greatest duration divisor for the page<NEW_LINE>Rational[] durationArray = durations.toArray(new Rational[durations.size()]);<NEW_LINE>Rational divisor = Rational.gcd(durationArray);<NEW_LINE>logger.debug("durations={} divisor={}", Arrays.deepToString(durationArray), divisor);<NEW_LINE>return divisor.den;<NEW_LINE>} catch (Exception ex) {<NEW_LINE>logger.warn(getClass().getSimpleName() + " Error visiting " + this, ex);<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>} | ) + " Error visiting " + chord, ex); |
943,381 | public MappingStore match(Tree src, Tree dst, MappingStore mappings) {<NEW_LINE>RtedAlgorithm a = new RtedAlgorithm(1D, 1D, 1D);<NEW_LINE>a.init(src, dst);<NEW_LINE>a.computeOptimalStrategy();<NEW_LINE>a.nonNormalizedTreeDist();<NEW_LINE>ArrayDeque<int[]> arrayMappings = a.computeEditMapping();<NEW_LINE>List<Tree> srcs = TreeUtils.postOrder(src);<NEW_LINE>List<Tree> dsts = TreeUtils.postOrder(dst);<NEW_LINE>for (int[] m : arrayMappings) {<NEW_LINE>if (m[0] != 0 && m[1] != 0) {<NEW_LINE>Tree srcg = srcs.get(m[0] - 1);<NEW_LINE>Tree dstg = dsts.get(m[1] - 1);<NEW_LINE>if (mappings.isMappingAllowed(srcg, dstg))<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return mappings;<NEW_LINE>} | mappings.addMapping(srcg, dstg); |
1,142,919 | public void commitMigration(final NicProfile nic, final Network network, final VirtualMachineProfile vm, final ReservationContext src, final ReservationContext dst) {<NEW_LINE>if (nic.getBroadcastType() != Networks.BroadcastDomainType.Pvlan) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (vm.getType() == VirtualMachine.Type.DomainRouter) {<NEW_LINE>assert vm instanceof DomainRouterVO;<NEW_LINE>final DomainRouterVO router = (DomainRouterVO) vm.getVirtualMachine();<NEW_LINE>final DataCenterVO dcVO = _dcDao.findById(network.getDataCenterId());<NEW_LINE>final NetworkTopology networkTopology = networkTopologyContext.retrieveNetworkTopology(dcVO);<NEW_LINE>try {<NEW_LINE>networkTopology.setupDhcpForPvlan(true, router, router.getHostId(), nic);<NEW_LINE>} catch (final ResourceUnavailableException e) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} else if (vm.getType() == VirtualMachine.Type.User) {<NEW_LINE>assert vm instanceof UserVmVO;<NEW_LINE>_userVmMgr.setupVmForPvlan(true, vm.getVirtualMachine().getHostId(), nic);<NEW_LINE>}<NEW_LINE>} | s_logger.warn("Timed Out", e); |
1,570,620 | private void createMBeans(HazelcastInstanceImpl hazelcastInstance, ManagementService managementService, Node node, ExecutionService executionService) {<NEW_LINE>this.nodeMBean = new NodeMBean(hazelcastInstance, node, managementService);<NEW_LINE>this.partitionServiceMBean = new PartitionServiceMBean(<MASK><NEW_LINE>this.systemExecutorMBean = new ManagedExecutorServiceMBean(hazelcastInstance, executionService.getExecutor(ExecutionService.SYSTEM_EXECUTOR), service);<NEW_LINE>this.asyncExecutorMBean = new ManagedExecutorServiceMBean(hazelcastInstance, executionService.getExecutor(ExecutionService.ASYNC_EXECUTOR), service);<NEW_LINE>this.scheduledExecutorMBean = new ManagedExecutorServiceMBean(hazelcastInstance, executionService.getExecutor(ExecutionService.SCHEDULED_EXECUTOR), service);<NEW_LINE>this.clientExecutorMBean = new ManagedExecutorServiceMBean(hazelcastInstance, executionService.getExecutor(ExecutionService.CLIENT_EXECUTOR), service);<NEW_LINE>this.clientQueryExecutorMBean = new ManagedExecutorServiceMBean(hazelcastInstance, executionService.getExecutor(ExecutionService.CLIENT_QUERY_EXECUTOR), service);<NEW_LINE>this.clientBlockingExecutorMBean = new ManagedExecutorServiceMBean(hazelcastInstance, executionService.getExecutor(ExecutionService.CLIENT_BLOCKING_EXECUTOR), service);<NEW_LINE>this.queryExecutorMBean = new ManagedExecutorServiceMBean(hazelcastInstance, executionService.getExecutor(ExecutionService.QUERY_EXECUTOR), service);<NEW_LINE>this.ioExecutorMBean = new ManagedExecutorServiceMBean(hazelcastInstance, executionService.getExecutor(ExecutionService.IO_EXECUTOR), service);<NEW_LINE>this.offloadableExecutorMBean = new ManagedExecutorServiceMBean(hazelcastInstance, executionService.getExecutor(ExecutionService.OFFLOADABLE_EXECUTOR), service);<NEW_LINE>this.loggingServiceMBean = new LoggingServiceMBean(hazelcastInstance, service);<NEW_LINE>} | hazelcastInstance, node.partitionService, service); |
1,800,231 | public com.squareup.okhttp.Call scopesGetCall(String xWSO2Tenant, String scopeKey, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/scopes";<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();<NEW_LINE>if (scopeKey != null)<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPair("scopeKey", scopeKey));<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>if (xWSO2Tenant != null)<NEW_LINE>localVarHeaderParams.put("xWSO2Tenant", apiClient.parameterToString(xWSO2Tenant));<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>if (localVarAccept != null)<NEW_LINE>localVarHeaderParams.put("Accept", localVarAccept);<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>localVarHeaderParams.put("Content-Type", localVarContentType);<NEW_LINE>if (progressListener != null) {<NEW_LINE>apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {<NEW_LINE>com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());<NEW_LINE>return originalResponse.newBuilder().body(new ProgressResponseBody(originalResponse.body(), progressListener)).build();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>String[] localVarAuthNames = new String[] {};<NEW_LINE>return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, <MASK><NEW_LINE>} | localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); |
1,827,680 | private void onGroupsChanged(List<Group> result) {<NEW_LINE>Timber.i(">> Groups changed ! Size=%s", result.size());<NEW_LINE>if (!enabled)<NEW_LINE>return;<NEW_LINE>boolean isEmpty = (result.isEmpty());<NEW_LINE>emptyText.setVisibility(isEmpty ? View.VISIBLE : View.GONE);<NEW_LINE>activity.get().updateTitle(result.size(), totalContentCount);<NEW_LINE>@GroupDisplayItem.ViewType<NEW_LINE>final int viewType = activity.get().isEditMode() ? GroupDisplayItem.ViewType.LIBRARY_EDIT : (Preferences.Constant.LIBRARY_DISPLAY_LIST == Preferences.getLibraryDisplay()) ? GroupDisplayItem.ViewType.LIBRARY : GroupDisplayItem.ViewType.LIBRARY_GRID;<NEW_LINE>List<GroupDisplayItem> groups = Stream.of(result).map(g -> new GroupDisplayItem(g, touchHelper, viewType)).withoutNulls()<MASK><NEW_LINE>FastAdapterDiffUtil.INSTANCE.set(itemAdapter, groups, GROUPITEM_DIFF_CALLBACK);<NEW_LINE>// Update visibility of search bar<NEW_LINE>activity.get().updateSearchBarOnResults(!result.isEmpty());<NEW_LINE>// Reset library load indicator<NEW_LINE>firstLibraryLoad = true;<NEW_LINE>} | .distinct().toList(); |
390,814 | public static void main(String[] args) {<NEW_LINE>Exercise32_8Puzzle puzzle = new Exercise32_8Puzzle();<NEW_LINE>int[][] grid = puzzle.generateRandom8PuzzleGrid();<NEW_LINE>// Heuristic 1 - Tiles in wrong position<NEW_LINE>List<String> solutionHeuristic1 = puzzle.solve8Puzzle(grid, Heuristic.TILES_IN_WRONG_POSITION);<NEW_LINE>if (solutionHeuristic1 != null) {<NEW_LINE>StdOut.println("Using tiles in wrong position as heuristic:");<NEW_LINE>puzzle.printSolution(solutionHeuristic1);<NEW_LINE>} else {<NEW_LINE>String <MASK><NEW_LINE>StdOut.println("There is no possible solution for the initial state " + initialState);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Heuristic 2 - Manhattan distance<NEW_LINE>StdOut.println("Using manhattan distance as heuristic:");<NEW_LINE>List<String> solutionHeuristic2 = puzzle.solve8Puzzle(grid, Heuristic.MANHATTAN_DISTANCE);<NEW_LINE>puzzle.printSolution(solutionHeuristic2);<NEW_LINE>// Heuristic 3 - Sum of the squares of the tiles in wrong position distance and manhattan distance<NEW_LINE>StdOut.println("Using sum of the squares of the tiles in wrong position distance and manhattan distance as heuristic:");<NEW_LINE>List<String> solutionHeuristic3 = puzzle.solve8Puzzle(grid, Heuristic.SUM_SQUARE_DISTANCES);<NEW_LINE>puzzle.printSolution(solutionHeuristic3);<NEW_LINE>// Compare heuristics<NEW_LINE>StdOut.println("Number of states evaluated before solving the puzzle:");<NEW_LINE>StdOut.println("Tiles in wrong position as heuristic: " + statesEvaluated.get(Heuristic.TILES_IN_WRONG_POSITION));<NEW_LINE>StdOut.println("Manhattan distance as heuristic: " + statesEvaluated.get(Heuristic.MANHATTAN_DISTANCE));<NEW_LINE>StdOut.println("Sum of squares of tiles in wrong position and manhattan distance as heuristic: " + statesEvaluated.get(Heuristic.SUM_SQUARE_DISTANCES));<NEW_LINE>StdOut.println("\nNumber of moves to solve the puzzle:");<NEW_LINE>StdOut.println("Tiles in wrong position as heuristic: " + numberOfMoves.get(Heuristic.TILES_IN_WRONG_POSITION));<NEW_LINE>StdOut.println("Manhattan distance as heuristic: " + numberOfMoves.get(Heuristic.MANHATTAN_DISTANCE));<NEW_LINE>StdOut.println("Sum of squares of tiles in wrong position and manhattan distance as heuristic: " + numberOfMoves.get(Heuristic.SUM_SQUARE_DISTANCES));<NEW_LINE>} | initialState = puzzle.getState(grid); |
1,839,786 | public void process(ImagePyramid<GrayF32> image1, ImagePyramid<GrayF32> image2) {<NEW_LINE>// Process the pyramid from low resolution to high resolution<NEW_LINE>boolean first = true;<NEW_LINE>for (int i = image1.getNumLayers() - 1; i >= 0; i--) {<NEW_LINE>GrayF32 layer1 = image1.getLayer(i);<NEW_LINE>GrayF32 layer2 = image2.getLayer(i);<NEW_LINE>resizeForLayer(layer1.width, layer2.height);<NEW_LINE>// compute image derivatives<NEW_LINE>gradient.process(layer1, deriv1X, deriv1Y);<NEW_LINE>gradient.process(layer2, deriv2X, deriv2Y);<NEW_LINE>hessian.process(deriv2X, deriv2Y, deriv2XX, deriv2YY, deriv2XY);<NEW_LINE>if (!first) {<NEW_LINE>// interpolate initial flow from previous layer<NEW_LINE>interpolateFlowScale(layer1.width, layer1.height);<NEW_LINE>} else {<NEW_LINE>// for the very first layer there is no information on flow so set everything to 0<NEW_LINE>first = false;<NEW_LINE>flowU.reshape(layer1.width, layer1.height);<NEW_LINE>flowV.reshape(<MASK><NEW_LINE>ImageMiscOps.fill(flowU, 0);<NEW_LINE>ImageMiscOps.fill(flowV, 0);<NEW_LINE>}<NEW_LINE>// compute flow for this layer<NEW_LINE>processLayer(layer1, layer2, deriv1X, deriv1Y, deriv2X, deriv2Y, deriv2XX, deriv2YY, deriv2XY);<NEW_LINE>}<NEW_LINE>} | layer1.width, layer1.height); |
1,315,561 | private static ArrayList<NodeDesc> mergeNodes(NodeDesc parentNode, List<NodeDesc> nodes, HashMap<String, NodeDesc> layoutNodes, HashMap<String, HashMap<String, NodeDesc>> parentSceneNodeMap, String layout, boolean applyDefaultLayout) {<NEW_LINE>ArrayList<NodeDesc> newNodes = new ArrayList<NodeDesc>(nodes.size());<NEW_LINE>for (NodeDesc n : nodes) {<NEW_LINE>// pick default node if no layout version exist<NEW_LINE>NodeDesc node = (layoutNodes == null) ? n : (layoutNodes.containsKey(n.getId()) ? layoutNodes.get(n.getId()) : n);<NEW_LINE>NodeDesc.Builder b = node.toBuilder();<NEW_LINE>// insert parentNode as prefix to parent and node id<NEW_LINE>if (b.getParent().isEmpty()) {<NEW_LINE>b.setParent(parentNode.getId());<NEW_LINE>} else {<NEW_LINE>b.setParent(parentNode.getId() + "/" + b.getParent());<NEW_LINE>}<NEW_LINE>b.setId(parentNode.getId() + "/" + b.getId());<NEW_LINE>// apply overridden fields from super-node to node, if there are any<NEW_LINE>// For defaut layout first<NEW_LINE>if (applyDefaultLayout) {<NEW_LINE>HashMap<String, NodeDesc> nodeMapDefault = parentSceneNodeMap.get("");<NEW_LINE>ApplyLayoutOverrides(b, nodeMapDefault, nodeMapDefault);<NEW_LINE>}<NEW_LINE>// For custom layout<NEW_LINE>if (layoutNodes != null) {<NEW_LINE>ApplyLayoutOverrides(b, layoutNodes, parentSceneNodeMap.get(layout));<NEW_LINE>}<NEW_LINE>newNodes.<MASK><NEW_LINE>}<NEW_LINE>return newNodes;<NEW_LINE>} | add(b.build()); |
290,465 | public void create(final JSONArray args, final CallbackContext callbackContext) throws JSONException {<NEW_LINE>JSONObject params = args.getJSONObject(1);<NEW_LINE>String hashCode = args.getString(2);<NEW_LINE>JSONArray positionList = params.getJSONArray("positionList");<NEW_LINE>JSONArray geocellList = new JSONArray();<NEW_LINE>JSONObject position;<NEW_LINE>for (int i = 0; i < positionList.length(); i++) {<NEW_LINE>position = positionList.getJSONObject(i);<NEW_LINE>geocellList.put(getGeocell(position.getDouble("lat"), position.getDouble("lng"), 12));<NEW_LINE>}<NEW_LINE>String id = "markercluster_" + hashCode;<NEW_LINE>debugFlags.put(id, params.getBoolean("debug"));<NEW_LINE>final JSONObject result = new JSONObject();<NEW_LINE>try {<NEW_LINE>result.put("geocellList", geocellList);<NEW_LINE>result.put("hashCode", hashCode);<NEW_LINE><MASK><NEW_LINE>} catch (JSONException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>callbackContext.success(result);<NEW_LINE>} | result.put("__pgmId", id); |
1,475,869 | public void addToASI(@NonNull final IAttributeSetInstanceAware asiAware, final List<IPricingAttribute> pricingAttributes) {<NEW_LINE>if (asiAware.getM_AttributeSetInstance_ID() <= 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (pricingAttributes == null || pricingAttributes.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final IAttributeSetInstanceBL attributeSetInstanceBL = Services.get(IAttributeSetInstanceBL.class);<NEW_LINE>final I_M_AttributeSetInstance asi = asiAware.getM_AttributeSetInstance();<NEW_LINE>for (final IPricingAttribute pricingAttribute : pricingAttributes) {<NEW_LINE>if (pricingAttribute.getAttributeValue() != null) {<NEW_LINE>final AttributeSetInstanceId asiId = AttributeSetInstanceId.ofRepoId(asiAware.getM_AttributeSetInstance_ID());<NEW_LINE>attributeSetInstanceBL.getCreateAttributeInstance(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>attributeSetInstanceBL.setDescription(asi);<NEW_LINE>InterfaceWrapperHelper.save(asi);<NEW_LINE>} | asiId, pricingAttribute.getAttributeValue()); |
1,061,296 | protected Sheet createSheet() {<NEW_LINE>BlackboardArtifact artifact = messageNode.getArtifact();<NEW_LINE>if (artifact == null) {<NEW_LINE>return messageNode.createSheet();<NEW_LINE>}<NEW_LINE>Sheet sheet = messageNode.createSheet();<NEW_LINE>BlackboardArtifact.ARTIFACT_TYPE artifactTypeID = BlackboardArtifact.ARTIFACT_TYPE.<MASK><NEW_LINE>// If its a text message, replace the subject node which is probably<NEW_LINE>// an empty string with the firest 120 characters of the text message<NEW_LINE>if (artifactTypeID != null && artifactTypeID == TSK_MESSAGE) {<NEW_LINE>try {<NEW_LINE>BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.fromID(TSK_TEXT.getTypeID())));<NEW_LINE>if (attribute != null) {<NEW_LINE>Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);<NEW_LINE>sheetSet.remove("Subject");<NEW_LINE>String msg = attribute.getDisplayString();<NEW_LINE>if (msg != null && msg.length() > MAX_SUBJECT_LENGTH) {<NEW_LINE>msg = msg.substring(0, MAX_SUBJECT_LENGTH) + "...";<NEW_LINE>}<NEW_LINE>// NON-NLS<NEW_LINE>sheetSet.put(new NodeProperty<>("Subject", Bundle.MessageNode_Node_Property_Subject(), "", msg));<NEW_LINE>}<NEW_LINE>} catch (TskCoreException ex) {<NEW_LINE>logger.log(Level.WARNING, String.format("Unable to get the text message from message artifact %d", artifact.getId()), ex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return sheet;<NEW_LINE>} | fromID(artifact.getArtifactTypeID()); |
1,563,206 | protected Context makeContext() {<NEW_LINE>final TimeoutContext cx = new TimeoutContext(this);<NEW_LINE>cx.setLanguageVersion(Context.VERSION_ES6);<NEW_LINE>cx.setLocale(browserVersion_.getBrowserLocale());<NEW_LINE>// make sure no java classes are usable from js<NEW_LINE>cx.setClassShutter(fullClassName -> {<NEW_LINE>final Map<String, String> activeXObjectMap = webClient_.getActiveXObjectMap();<NEW_LINE>if (activeXObjectMap != null) {<NEW_LINE>for (final String mappedClass : activeXObjectMap.values()) {<NEW_LINE>if (fullClassName.equals(mappedClass)) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>});<NEW_LINE>// Use pure interpreter mode to get observeInstructionCount() callbacks.<NEW_LINE>cx.setOptimizationLevel(-1);<NEW_LINE>// Set threshold on how often we want to receive the callbacks<NEW_LINE>cx.setInstructionObserverThreshold(INSTRUCTION_COUNT_THRESHOLD);<NEW_LINE>cx.setErrorReporter(new HtmlUnitErrorReporter(webClient_.getJavaScriptErrorListener()));<NEW_LINE>cx.setWrapFactory(wrapFactory_);<NEW_LINE>if (debugger_ != null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>// register custom RegExp processing<NEW_LINE>ScriptRuntime.setRegExpProxy(cx, new HtmlUnitRegExpProxy(ScriptRuntime.getRegExpProxy(cx), browserVersion_));<NEW_LINE>cx.setMaximumInterpreterStackDepth(10_000);<NEW_LINE>return cx;<NEW_LINE>} | cx.setDebugger(debugger_, null); |
53,382 | public static void main(String[] args) {<NEW_LINE>JcsegServerConfig config = new JcsegServerConfig();<NEW_LINE>String proFile = null;<NEW_LINE>if (args.length > 0) {<NEW_LINE>proFile = args[0];<NEW_LINE>}<NEW_LINE>if (proFile == null) {<NEW_LINE>String[] rPaths = { "jcseg-server.properties", "classes/jcseg-server.properties" };<NEW_LINE>String jarHome = Util.getJarHome(config);<NEW_LINE>for (String path : rPaths) {<NEW_LINE>File pFile = new File(jarHome + "/" + path);<NEW_LINE>if (pFile.exists()) {<NEW_LINE>proFile = pFile.getAbsolutePath();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// still not found, print an error and stop it right here<NEW_LINE>if (proFile == null) {<NEW_LINE>System.out.println("Usage: java -jar jcseg-server-{version}.jar " + "\"path of file jcseg-server properties\"");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// disable the logging<NEW_LINE>org.eclipse.jetty.util.log.Log<MASK><NEW_LINE>try {<NEW_LINE>System.out.println("+-Try to load and parse server property file \"" + proFile + "\"");<NEW_LINE>config.resetFromFile(proFile);<NEW_LINE>JcsegServer server = new JcsegServer(config);<NEW_LINE>System.out.print("+-[Info]: initializing ... ");<NEW_LINE>server.initFromGlobalConfig(config.getGlobalConfig());<NEW_LINE>System.out.println(" --[Ok]");<NEW_LINE>System.out.print("+-[Info]: Register handler ... ");<NEW_LINE>server.registerHandler();<NEW_LINE>System.out.println(" --[Ok]");<NEW_LINE>server.start();<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>} | .setLog(new JettyEmptyLogger()); |
251,389 | private NoOperacaoAtribuicao criaIncrementoUnario(TerminalNode ID, IndiceArrayContext contextoLinhas, IndiceArrayContext contextoColunas) {<NEW_LINE>String nomeMatriz = ID.getText();<NEW_LINE>NoExpressao linhas = (NoExpressao) contextoLinhas.expressao().accept(this);<NEW_LINE>NoExpressao colunas = (NoExpressao) contextoColunas.<MASK><NEW_LINE>NoReferenciaMatriz referenciaMatriz = new NoReferenciaMatriz(null, nomeMatriz, linhas, colunas);<NEW_LINE>referenciaMatriz.setTrechoCodigoFonteNome(getTrechoCodigoFonte(ID));<NEW_LINE>return new NoOperacaoAtribuicao(referenciaMatriz, new NoOperacaoSoma(referenciaMatriz, new NoInteiro(1)));<NEW_LINE>} | expressao().accept(this); |
1,464,637 | public void onRun() throws RetryLaterException {<NEW_LINE>List<Job> jobs = new LinkedList<>();<NEW_LINE>DecryptionResult result = <MASK><NEW_LINE>if (result.getContent() != null) {<NEW_LINE>if (result.getContent().getSenderKeyDistributionMessage().isPresent()) {<NEW_LINE>handleSenderKeyDistributionMessage(result.getContent().getSender(), result.getContent().getSenderDevice(), result.getContent().getSenderKeyDistributionMessage().get());<NEW_LINE>}<NEW_LINE>jobs.add(new PushProcessMessageJob(result.getContent(), smsMessageId, envelope.getTimestamp()));<NEW_LINE>} else if (result.getException() != null && result.getState() != MessageState.NOOP) {<NEW_LINE>jobs.add(new PushProcessMessageJob(result.getState(), result.getException(), smsMessageId, envelope.getTimestamp()));<NEW_LINE>}<NEW_LINE>jobs.addAll(result.getJobs());<NEW_LINE>for (Job job : jobs) {<NEW_LINE>ApplicationDependencies.getJobManager().add(job);<NEW_LINE>}<NEW_LINE>} | MessageDecryptionUtil.decrypt(context, envelope); |
314,377 | public static void main(String[] args) {<NEW_LINE>ThreadLocalDirectoryBenchmark benchmark = new ThreadLocalDirectoryBenchmark();<NEW_LINE>long end;<NEW_LINE>System.out.println("ThreadLocalDirectory<Integer, Integer>");<NEW_LINE><MASK><NEW_LINE>benchmark.sumFromMultipleThreads();<NEW_LINE>end = System.currentTimeMillis();<NEW_LINE>System.out.println("Elapsed using threadlocals: " + (end - start) + " ms.");<NEW_LINE>System.out.println("AtomicInteger");<NEW_LINE>start = System.currentTimeMillis();<NEW_LINE>benchmark.sumAtomicFromMultipleThreads();<NEW_LINE>end = System.currentTimeMillis();<NEW_LINE>System.out.println("Elapsed using atomic integer: " + (end - start) + " ms.");<NEW_LINE>System.out.println("volatile int += volatile int");<NEW_LINE>start = System.currentTimeMillis();<NEW_LINE>benchmark.overwriteVolatileFromMultipleThreads();<NEW_LINE>end = System.currentTimeMillis();<NEW_LINE>System.out.println("Elapsed using single shared volatile: " + (end - start) + " ms.");<NEW_LINE>System.out.println("int += int");<NEW_LINE>start = System.currentTimeMillis();<NEW_LINE>benchmark.overwriteIntegerFromMultipleThreads();<NEW_LINE>end = System.currentTimeMillis();<NEW_LINE>System.out.println("Checksum: " + benchmark.naiveCounter);<NEW_LINE>System.out.println("Elapsed using shared int: " + (end - start) + " ms.");<NEW_LINE>System.out.println("ThreadLocalDirectory<IntWrapper, IntWrapper>");<NEW_LINE>start = System.currentTimeMillis();<NEW_LINE>benchmark.sumMutableFromMultipleThreads();<NEW_LINE>end = System.currentTimeMillis();<NEW_LINE>System.out.println("Elapsed using threadlocal with mutable int wrapper: " + (end - start) + " ms.");<NEW_LINE>} | long start = System.currentTimeMillis(); |
937,854 | protected void parse(final ProtocolFactory protocols, final Local file) throws AccessDeniedException {<NEW_LINE>final NSDictionary serialized = NSDictionary.dictionaryWithContentsOfFile(file.getAbsolute());<NEW_LINE>if (null == serialized) {<NEW_LINE>throw new LocalAccessDeniedException(String.format("Invalid bookmark file %s", file));<NEW_LINE>}<NEW_LINE>// Adds a class translation mapping to NSKeyedUnarchiver whereby objects encoded with a given class name<NEW_LINE>// are decoded as instances of a given class instead.<NEW_LINE>final TransmitFavoriteCollection c = Rococoa.createClass("TransmitFavoriteCollection", TransmitFavoriteCollection.class);<NEW_LINE>final TransmitFavorite f = Rococoa.createClass("TransmitFavorite", TransmitFavorite.class);<NEW_LINE>final NSData collectionsData = Rococoa.cast(serialized.objectForKey("FavoriteCollections"), NSData.class);<NEW_LINE>if (null == collectionsData) {<NEW_LINE>throw new LocalAccessDeniedException(String.format("Error unarchiving bookmark file %s", file));<NEW_LINE>}<NEW_LINE>final NSKeyedUnarchiver reader = NSKeyedUnarchiver.createForReadingWithData(collectionsData);<NEW_LINE>reader.setClass_forClassName(c, "FavoriteCollection");<NEW_LINE>reader.setClass_forClassName(c, "HistoryCollection");<NEW_LINE>reader.setClass_forClassName(f, "Favorite");<NEW_LINE>reader.setClass_forClassName(f, "DotMacFavorite");<NEW_LINE>if (!reader.containsValueForKey("FavoriteCollection")) {<NEW_LINE>log.warn("Missing key FavoriteCollection");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final TransmitFavoriteCollection rootCollection = Rococoa.cast(reader.decodeObjectForKey("FavoriteCollection"), TransmitFavoriteCollection.class);<NEW_LINE>reader.finishDecoding();<NEW_LINE>if (null == rootCollection) {<NEW_LINE>throw new LocalAccessDeniedException(String.format("Error unarchiving bookmark file %s", file));<NEW_LINE>}<NEW_LINE>// The root has collections<NEW_LINE>final <MASK><NEW_LINE>final NSEnumerator collectionsEnumerator = collections.objectEnumerator();<NEW_LINE>NSObject next;<NEW_LINE>while ((next = collectionsEnumerator.nextObject()) != null) {<NEW_LINE>final TransmitFavoriteCollection collection = Rococoa.cast(next, TransmitFavoriteCollection.class);<NEW_LINE>if ("History".equals(collection.name())) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>NSArray favorites = collection.favorites();<NEW_LINE>NSEnumerator favoritesEnumerator = favorites.objectEnumerator();<NEW_LINE>NSObject favorite;<NEW_LINE>while ((favorite = favoritesEnumerator.nextObject()) != null) {<NEW_LINE>this.parse(protocols, Rococoa.cast(favorite, TransmitFavorite.class));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | NSArray collections = rootCollection.favorites(); |
1,038,451 | public void put(int index, Object value) {<NEW_LINE>int orgType = this.parameterTypeList[index];<NEW_LINE>int actuallyType;<NEW_LINE>Class<?<MASK><NEW_LINE>if (aClass == Long.class) {<NEW_LINE>actuallyType = MySQLFieldsType.FIELD_TYPE_LONG;<NEW_LINE>} else if (aClass == Byte.class) {<NEW_LINE>actuallyType = MySQLFieldsType.FIELD_TYPE_TINY;<NEW_LINE>} else if (aClass == Short.class) {<NEW_LINE>actuallyType = MySQLFieldsType.FIELD_TYPE_SHORT;<NEW_LINE>} else if (aClass == String.class) {<NEW_LINE>actuallyType = MySQLFieldsType.FIELD_TYPE_STRING;<NEW_LINE>} else if (aClass == Double.class) {<NEW_LINE>actuallyType = MySQLFieldsType.FIELD_TYPE_DOUBLE;<NEW_LINE>} else if (aClass == Float.class) {<NEW_LINE>actuallyType = MySQLFieldsType.FIELD_TYPE_FLOAT;<NEW_LINE>} else if (aClass == byte[].class) {<NEW_LINE>preparedStatement.putLongDataForBuildLongData(index, (byte[]) value);<NEW_LINE>actuallyType = MySQLFieldsType.FIELD_TYPE_BLOB;<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("unsupport!");<NEW_LINE>}<NEW_LINE>if (actuallyType != orgType) {<NEW_LINE>preparedStatement.setNewParameterBoundFlag(true);<NEW_LINE>this.parameterTypeList[index] = actuallyType;<NEW_LINE>}<NEW_LINE>if (aClass != byte[].class) {<NEW_LINE>valueList[index] = value;<NEW_LINE>}<NEW_LINE>} | > aClass = value.getClass(); |
611,634 | public void deleteScheme(final WorkflowScheme scheme) throws DotDataException, DotSecurityException {<NEW_LINE>DotConnect dc = new DotConnect();<NEW_LINE>try {<NEW_LINE>// delete association of content types with the scheme<NEW_LINE>dc.setSQL(sql.DELETE_STRUCTS_FOR_SCHEME);<NEW_LINE>dc.addParam(scheme.getId());<NEW_LINE>dc.loadResult();<NEW_LINE>// delete the scheme<NEW_LINE>dc.setSQL(sql.DELETE_SCHEME);<NEW_LINE>dc.<MASK><NEW_LINE>dc.loadResult();<NEW_LINE>final List<WorkflowAction> actions = this.cache.getActions(scheme);<NEW_LINE>if (null != actions) {<NEW_LINE>actions.stream().forEach(action -> this.cache.remove(action));<NEW_LINE>}<NEW_LINE>this.deleteSystemActionsByScheme(scheme);<NEW_LINE>this.cache.remove(scheme);<NEW_LINE>} catch (DotDataException e) {<NEW_LINE>Logger.error(WorkFlowFactory.class, e.getMessage(), e);<NEW_LINE>throw new DotDataException(e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | addParam(scheme.getId()); |
1,136,790 | public static void montecarlo(final int size) {<NEW_LINE>float[] output = new float[size];<NEW_LINE>float[] seq = new float[size];<NEW_LINE>TaskSchedule t0 = new TaskSchedule("s0").task("t0", Montecarlo::computeMontecarlo, output, size).streamOut(output);<NEW_LINE>long start = System.nanoTime();<NEW_LINE>t0.execute();<NEW_LINE>long end = System.nanoTime();<NEW_LINE><MASK><NEW_LINE>float sum = 0;<NEW_LINE>for (int j = 0; j < size; j++) {<NEW_LINE>sum += output[j];<NEW_LINE>}<NEW_LINE>sum *= 4;<NEW_LINE>System.out.println("Total time (Tornado) : " + (tornadoTime));<NEW_LINE>System.out.println("Pi value(Tornado) : " + (sum / size));<NEW_LINE>start = System.nanoTime();<NEW_LINE>computeMontecarlo(seq, size);<NEW_LINE>end = System.nanoTime();<NEW_LINE>long sequentialTime = (end - start);<NEW_LINE>sum = 0;<NEW_LINE>for (int j = 0; j < size; j++) {<NEW_LINE>sum += seq[j];<NEW_LINE>}<NEW_LINE>sum *= 4;<NEW_LINE>System.out.println("Total time (Sequential): " + (sequentialTime));<NEW_LINE>System.out.println("Pi value(seq) : " + (sum / size));<NEW_LINE>double speedup = (double) sequentialTime / (double) tornadoTime;<NEW_LINE>System.out.println("Speedup: " + speedup);<NEW_LINE>} | long tornadoTime = (end - start); |
1,488,556 | public void loadBuildings(boolean devMode) {<NEW_LINE>try {<NEW_LINE>Connections connections;<NEW_LINE>this.buildings = Api.getAllBuildings(devMode);<NEW_LINE>for (Building build : this.buildings.getBuildings()) {<NEW_LINE>// Get the building<NEW_LINE>if (build.getBuid().equals(BUILDING_ID)) {<NEW_LINE>System.out.println("Found BUILDING: " + BUILDING_ID);<NEW_LINE>connections = (Api.getBuildingConnections(devMode, build.getBuid()));<NEW_LINE>this.floors = Api.getBuildingFloor(devMode, build.getBuid());<NEW_LINE>Pois pois = Api.getPOIsByBuilding(devMode, build.getBuid());<NEW_LINE>this.selectedBuilding = new CleanBuilding(build.getBuid(), build.getName(), build.getCoordinatesLat(), build.getCoordinatesLon(), pois, connections);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Floor f : floors.getFloors()) {<NEW_LINE>Api.getRadiomapFloor(selectedBuilding.getBuid(), f.getFloorNumber());<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>System.out.println(e.getMessage());<NEW_LINE>}<NEW_LINE>} | System.out.println("Reading fingerprints"); |
857,282 | public <C2, T, R> Higher<C2, Higher<Higher<Higher<Higher<rws, R1>, W>, S>, R>> traverseA(Applicative<C2> applicative, Function<? super T, ? extends Higher<C2, R>> fn, Higher<Higher<Higher<Higher<rws, R1>, W>, S>, T> ds) {<NEW_LINE>ReaderWriterState<R1, W, S, T> rws = narrowK(ds);<NEW_LINE>Higher<C2, R> x = rws.run(val1, val2).transform((a, b, t) <MASK><NEW_LINE>return applicative.map_(x, i -> rws((ra, rb) -> tuple(monoid.zero(), rb, i), monoid));<NEW_LINE>} | -> fn.apply(t)); |
1,313,760 | public void drawU(UGraphic ug) {<NEW_LINE>ug = ug.apply(UTranslate.dx(x));<NEW_LINE>final FtileGeometry geo1 = getFtile1(<MASK><NEW_LINE>if (geo1.hasPointOut() == false)<NEW_LINE>return;<NEW_LINE>Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToDown());<NEW_LINE>if (Display.isNull(label) == false)<NEW_LINE>snake = snake.withLabel(getTextBlock(label), arrowHorizontalAlignment());<NEW_LINE>final Point2D p1 = new Point2D.Double(geo1.getLeft(), barHeight + geo1.getOutY());<NEW_LINE>final Point2D p2 = new Point2D.Double(geo1.getLeft(), justBeforeBar2);<NEW_LINE>snake.addPoint(p1);<NEW_LINE>snake.addPoint(p2);<NEW_LINE>ug.draw(snake);<NEW_LINE>} | ).calculateDimension(getStringBounder()); |
1,249,299 | public void fire(ActionEvent event, ImageData<BufferedImage> imageData, DensityMapBuilder builder, String densityMapName) {<NEW_LINE>if (imageData == null || builder == null) {<NEW_LINE>Dialogs.showErrorMessage(title, "No density map is available!");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>var densityMapServer = builder.buildServer(imageData);<NEW_LINE>var dialog = new Dialog<ButtonType>();<NEW_LINE>dialog.setTitle(title);<NEW_LINE>dialog.setHeaderText("How do you want to export the density map?");<NEW_LINE>dialog.setContentText("Choose 'Raw values' of 'Send to ImageJ' if you need the original counts, or 'Color overlay' if you want to keep the same visual appearance.");<NEW_LINE>var btOrig = new ButtonType("Raw values");<NEW_LINE>var btColor = new ButtonType("Color overlay");<NEW_LINE>var btImageJ = new ButtonType("Send to ImageJ");<NEW_LINE>dialog.getDialogPane().getButtonTypes().setAll(btOrig, btColor, btImageJ, ButtonType.CANCEL);<NEW_LINE>var response = dialog.showAndWait().orElse(ButtonType.CANCEL);<NEW_LINE>try {<NEW_LINE>if (btOrig.equals(response)) {<NEW_LINE><MASK><NEW_LINE>} else if (btColor.equals(response)) {<NEW_LINE>// Counting on color model being set!<NEW_LINE>promptToSaveColorImage(densityMapServer, null);<NEW_LINE>} else if (btImageJ.equals(response)) {<NEW_LINE>sendToImageJ(densityMapServer);<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>Dialogs.showErrorNotification(title, e);<NEW_LINE>}<NEW_LINE>} | promptToSaveRawImage(imageData, densityMapServer, densityMapName); |
1,683,132 | private Table batchGetRow(String tableName, PrimaryKey[] pks, String[] colNames, Expression exp, Context ctx, String opt) {<NEW_LINE>MultiRowQueryCriteria criteria = new MultiRowQueryCriteria(tableName);<NEW_LINE>criteria.setMaxVersions(1);<NEW_LINE>for (PrimaryKey pk : pks) {<NEW_LINE>criteria.addRow(pk);<NEW_LINE>}<NEW_LINE>ColumnValueFilter filter = toFilter(exp, ctx);<NEW_LINE>if (filter != null) {<NEW_LINE>criteria.setFilter(filter);<NEW_LINE>}<NEW_LINE>if (colNames != null) {<NEW_LINE>criteria.addColumnsToGet(colNames);<NEW_LINE>}<NEW_LINE>BatchGetRowRequest request = new BatchGetRowRequest();<NEW_LINE>request.addMultiRowQueryCriteria(criteria);<NEW_LINE>BatchGetRowResponse <MASK><NEW_LINE>List<BatchGetRowResponse.RowResult> rowList = reponse.getSucceedRows();<NEW_LINE>if (rowList == null || rowList.size() == 0) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>int size = rowList.size();<NEW_LINE>Row[] rows = new Row[size];<NEW_LINE>for (int i = 0; i < size; ++i) {<NEW_LINE>rows[i] = rowList.get(i).getRow();<NEW_LINE>}<NEW_LINE>if (opt != null && opt.indexOf('x') != -1) {<NEW_LINE>close();<NEW_LINE>}<NEW_LINE>return toTable(rows, colNames);<NEW_LINE>} | reponse = client.batchGetRow(request); |
1,848,404 | public static int maxRectangleSubmatrix(List<List<Boolean>> A) {<NEW_LINE>// DP table stores (h, w) for each (i, j).<NEW_LINE>MaxHW[][] table = new MaxHW[A.size()][A.get<MASK><NEW_LINE>for (int i = A.size() - 1; i >= 0; --i) {<NEW_LINE>for (int j = A.get(i).size() - 1; j >= 0; --j) {<NEW_LINE>// Find the largest h such that (i, j) to (i + h - 1, j) are feasible.<NEW_LINE>// Find the largest w such that (i, j) to (i, j + w - 1) are feasible.<NEW_LINE>table[i][j] = A.get(i).get(j) ? new MaxHW(i + 1 < A.size() ? table[i + 1][j].h + 1 : 1, j + 1 < A.get(i).size() ? table[i][j + 1].w + 1 : 1) : new MaxHW(0, 0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int maxRectangleArea = 0;<NEW_LINE>for (int i = 0; i < A.size(); ++i) {<NEW_LINE>for (int j = 0; j < A.get(i).size(); ++j) {<NEW_LINE>// Process (i, j) if it is feasible and is possible to update<NEW_LINE>// maxRectangleArea.<NEW_LINE>if (A.get(i).get(j) && table[i][j].w * table[i][j].h > maxRectangleArea) {<NEW_LINE>int minWidth = Integer.MAX_VALUE;<NEW_LINE>for (int a = 0; a < table[i][j].h; ++a) {<NEW_LINE>minWidth = Math.min(minWidth, table[i + a][j].w);<NEW_LINE>maxRectangleArea = Math.max(maxRectangleArea, minWidth * (a + 1));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return maxRectangleArea;<NEW_LINE>} | (0).size()]; |
1,247,091 | /*<NEW_LINE>* Compare lines in two steps:<NEW_LINE>* - compare ignoring "unimportant" lines<NEW_LINE>* - correct changes (compare all lines gaps between matched chunks)<NEW_LINE>*/<NEW_LINE>@Nonnull<NEW_LINE>private static FairDiffIterable compareSmart(@Nonnull List<Line> lines1, @Nonnull List<Line> lines2, @Nonnull ProgressIndicator indicator) {<NEW_LINE>int threshold = Registry.intValue("diff.unimportant.line.char.count");<NEW_LINE>if (threshold == 0)<NEW_LINE>return diff(lines1, lines2, indicator);<NEW_LINE>Pair<List<Line>, IntList> <MASK><NEW_LINE>Pair<List<Line>, IntList> bigLines2 = getBigLines(lines2, threshold);<NEW_LINE>FairDiffIterable changes = diff(bigLines1.first, bigLines2.first, indicator);<NEW_LINE>return new ChangeCorrector.SmartLineChangeCorrector(bigLines1.second, bigLines2.second, lines1, lines2, changes, indicator).build();<NEW_LINE>} | bigLines1 = getBigLines(lines1, threshold); |
259,730 | protected void executeSPARQLForHandler(String baseURI, TupleQueryResultHandler tqrh, String query, Dataset dataset, boolean includeInferred, BindingSet bindings, int maxQueryTime) throws QueryEvaluationException, TupleQueryResultHandlerException {<NEW_LINE>LinkedList<String> names = new LinkedList<String>();<NEW_LINE>try {<NEW_LINE>PreparedStatement stmt = executeSPARQL(baseURI, query, dataset, <MASK><NEW_LINE>ResultSet rs = stmt.executeQuery();<NEW_LINE>ResultSetMetaData rsmd = rs.getMetaData();<NEW_LINE>// begin at onset one<NEW_LINE>for (int i = 1; i <= rsmd.getColumnCount(); i++) names.add(rsmd.getColumnName(i));<NEW_LINE>tqrh.startQueryResult(names);<NEW_LINE>// begin at onset one<NEW_LINE>while (rs.next()) {<NEW_LINE>QueryBindingSet qbs = new QueryBindingSet();<NEW_LINE>for (int i = 1; i <= rsmd.getColumnCount(); i++) {<NEW_LINE>// TODO need to parse these into appropriate resource values<NEW_LINE>String col = rsmd.getColumnName(i);<NEW_LINE>Object val = rs.getObject(i);<NEW_LINE>if (val != null) {<NEW_LINE>Value v = castValue(val);<NEW_LINE>qbs.addBinding(col, v);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>tqrh.handleSolution(qbs);<NEW_LINE>}<NEW_LINE>tqrh.endQueryResult();<NEW_LINE>stmt.close();<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new QueryEvaluationException(": SPARQL execute failed:[" + query + "] \n Exception:" + e);<NEW_LINE>}<NEW_LINE>} | includeInferred, bindings, maxQueryTime, false); |
1,362,262 | private void updateSlidingViews(SlidingAccessor[] slidingModeAccessors) {<NEW_LINE>Map<SlidingView, SlidingAccessor> newViews = new <MASK><NEW_LINE>for (int i = 0; i < slidingModeAccessors.length; i++) {<NEW_LINE>SlidingAccessor sa = slidingModeAccessors[i];<NEW_LINE>SlidingView sv = (SlidingView) updateViewForAccessor(sa);<NEW_LINE>newViews.put(sv, sa);<NEW_LINE>}<NEW_LINE>Set<SlidingView> oldViews = new HashSet<SlidingView>(slidingModeViews.keySet());<NEW_LINE>oldViews.removeAll(newViews.keySet());<NEW_LINE>Set<SlidingView> addedViews = new HashSet<SlidingView>(newViews.keySet());<NEW_LINE>addedViews.removeAll(slidingModeViews.keySet());<NEW_LINE>slidingModeViews.clear();<NEW_LINE>slidingModeViews.putAll(newViews);<NEW_LINE>// remove old views.<NEW_LINE>for (SlidingView curSv : oldViews) {<NEW_LINE>getDesktop().removeSlidingView(curSv);<NEW_LINE>}<NEW_LINE>// add all new views.<NEW_LINE>for (SlidingView curSv : addedViews) {<NEW_LINE>getDesktop().addSlidingView(curSv);<NEW_LINE>}<NEW_LINE>getDesktop().updateCorners();<NEW_LINE>} | HashMap<SlidingView, SlidingAccessor>(); |
1,491,572 | protected CaseDefinition findNewLatestCaseDefinitionAfterRemovalOf(CaseDefinition caseDefinitionToBeRemoved) {<NEW_LINE>// The case definition is not necessarily the one with 'version -1' (some versions could have been deleted)<NEW_LINE>// Hence, the following logic<NEW_LINE>CaseDefinitionQuery query <MASK><NEW_LINE>query.caseDefinitionKey(caseDefinitionToBeRemoved.getKey());<NEW_LINE>if (caseDefinitionToBeRemoved.getTenantId() != null && !CmmnEngineConfiguration.NO_TENANT_ID.equals(caseDefinitionToBeRemoved.getTenantId())) {<NEW_LINE>query.caseDefinitionTenantId(caseDefinitionToBeRemoved.getTenantId());<NEW_LINE>} else {<NEW_LINE>query.caseDefinitionWithoutTenantId();<NEW_LINE>}<NEW_LINE>if (caseDefinitionToBeRemoved.getVersion() > 0) {<NEW_LINE>query.caseDefinitionVersionLowerThan(caseDefinitionToBeRemoved.getVersion());<NEW_LINE>}<NEW_LINE>query.orderByCaseDefinitionVersion().desc();<NEW_LINE>List<CaseDefinition> caseDefinitions = query.listPage(0, 1);<NEW_LINE>if (caseDefinitions != null && caseDefinitions.size() > 0) {<NEW_LINE>return caseDefinitions.get(0);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | = getCaseDefinitionEntityManager().createCaseDefinitionQuery(); |
1,584,004 | public static int checkAndGetNewPrefixPartColCnt(int fullPartColCnt, int actualPartColCnt, int lastPartValColSize, int valPartColSize, String partName) {<NEW_LINE>int newPrefixPartColCnt = PartitionInfoUtil.FULL_PART_COL_COUNT;<NEW_LINE>// if (valPartColSize < actualPartColCnt) {<NEW_LINE>// throw new TddlRuntimeException(ErrorCode.ERR_PARTITION_MANAGEMENT,<NEW_LINE>// String.format(<NEW_LINE>// "the column count[%s] of bound values of partition %s must match actual partition columns count[%s]",<NEW_LINE>// valPartColSize, partName == null ? "" : partName, actualPartColCnt));<NEW_LINE>// }<NEW_LINE>if (valPartColSize != lastPartValColSize && lastPartValColSize != -1) {<NEW_LINE>throw new TddlRuntimeException(ErrorCode.ERR_PARTITION_MANAGEMENT, String.format<MASK><NEW_LINE>}<NEW_LINE>if (valPartColSize > fullPartColCnt) {<NEW_LINE>throw new TddlRuntimeException(ErrorCode.ERR_PARTITION_MANAGEMENT, String.format("the column count[%s] of bound values of partition %s is more than the full partition columns count[%s]", valPartColSize, partName == null ? "" : partName, fullPartColCnt));<NEW_LINE>}<NEW_LINE>if (newPrefixPartColCnt == PartitionInfoUtil.FULL_PART_COL_COUNT) {<NEW_LINE>newPrefixPartColCnt = valPartColSize;<NEW_LINE>} else {<NEW_LINE>if (newPrefixPartColCnt != valPartColSize) {<NEW_LINE>throw new TddlRuntimeException(ErrorCode.ERR_PARTITION_MANAGEMENT, String.format("the column count[%s] of bound values is not allowed to be different", valPartColSize));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return newPrefixPartColCnt;<NEW_LINE>} | ("the column count[%s] of bound values of partition %s is not allowed to be different", valPartColSize, partName)); |
397,857 | public void handleUnmatchedCloseElementEnd(final char[] buffer, final int nameOffset, final int nameLen, final int line, final int col) throws ParseException {<NEW_LINE>final String elementCompleteName = new String(buffer, nameOffset, nameLen);<NEW_LINE>final ElementDefinition elementDefinition = this.elementDefinitions.forName(this.templateMode, elementCompleteName);<NEW_LINE>final String trailingWhiteSpace;<NEW_LINE>if (this.currentElementInnerWhiteSpaces.isEmpty()) {<NEW_LINE>trailingWhiteSpace = null;<NEW_LINE>} else {<NEW_LINE>trailingWhiteSpace = <MASK><NEW_LINE>}<NEW_LINE>this.templateHandler.handleCloseElement(new CloseElementTag(this.templateMode, elementDefinition, elementCompleteName, trailingWhiteSpace, false, true, this.templateName, this.lineOffset + this.currentElementLine, (this.currentElementLine == 1 ? this.colOffset : 0) + this.currentElementCol));<NEW_LINE>} | this.currentElementInnerWhiteSpaces.get(0); |
406,927 | public static NamesrvController createAndStartNamesrv() {<NEW_LINE>String baseDir = createTempDir();<NEW_LINE>Path kvConfigPath = Paths.get(baseDir, "namesrv", "kvConfig.json");<NEW_LINE>Path namesrvPath = Paths.get(baseDir, "namesrv", "namesrv.properties");<NEW_LINE>NamesrvConfig namesrvConfig = new NamesrvConfig();<NEW_LINE>NettyServerConfig nameServerNettyServerConfig = new NettyServerConfig();<NEW_LINE>namesrvConfig.setKvConfigPath(kvConfigPath.toString());<NEW_LINE>namesrvConfig.setConfigStorePath(namesrvPath.toString());<NEW_LINE>// find 3 consecutive open ports and use the last one of them<NEW_LINE>// rocketmq will also bind to given port - 2<NEW_LINE>nameServerNettyServerConfig.setListenPort(PortUtils.findOpenPorts(3) + 2);<NEW_LINE>NamesrvController namesrvController = new NamesrvController(namesrvConfig, nameServerNettyServerConfig);<NEW_LINE>try {<NEW_LINE>Assert.<MASK><NEW_LINE>logger.info("Name Server Start:{}", nameServerNettyServerConfig.getListenPort());<NEW_LINE>namesrvController.start();<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.info("Name Server start failed", e);<NEW_LINE>}<NEW_LINE>NAMESRV_CONTROLLERS.add(namesrvController);<NEW_LINE>return namesrvController;<NEW_LINE>} | assertTrue(namesrvController.initialize()); |
1,209,739 | protected void doOKAction() {<NEW_LINE>if (myBlockTreeBuilder != null) {<NEW_LINE>Disposer.dispose(myBlockTreeBuilder);<NEW_LINE>}<NEW_LINE>final String text = myEditor.getDocument().getText();<NEW_LINE>myEditor.getSelectionModel().removeSelection();<NEW_LINE>myLastParsedText = text;<NEW_LINE>myLastParsedTextHashCode = text.hashCode();<NEW_LINE>myNewDocumentHashCode = myLastParsedTextHashCode;<NEW_LINE>PsiElement rootElement = parseText(text);<NEW_LINE>focusTree();<NEW_LINE>ViewerTreeStructure structure = (ViewerTreeStructure) myPsiTreeBuilder.getTreeStructure();<NEW_LINE>structure.setRootPsiElement(rootElement);<NEW_LINE>myPsiTreeBuilder.queueUpdate();<NEW_LINE>myPsiTree.setRootVisible(true);<NEW_LINE>myPsiTree.expandRow(0);<NEW_LINE>myPsiTree.setRootVisible(false);<NEW_LINE>if (!myShowBlocksCheckBox.isSelected()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Block rootBlock = rootElement == null ? null : buildBlocks(rootElement);<NEW_LINE>if (rootBlock == null) {<NEW_LINE>myBlockTreeBuilder = null;<NEW_LINE>myBlockTree.setRootVisible(false);<NEW_LINE>myBlockTree.setVisible(false);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>myBlockTree.setVisible(true);<NEW_LINE>BlockTreeStructure blockTreeStructure = new BlockTreeStructure();<NEW_LINE>BlockTreeNode rootNode = new BlockTreeNode(rootBlock, null);<NEW_LINE>blockTreeStructure.setRoot(rootNode);<NEW_LINE>myBlockTreeBuilder = new BlockTreeBuilder(myBlockTree, blockTreeStructure);<NEW_LINE>myPsiToBlockMap = new HashMap<PsiElement, BlockTreeNode>();<NEW_LINE>final PsiElement psiFile = ((ViewerTreeStructure) myPsiTreeBuilder.getTreeStructure()).getRootPsiElement();<NEW_LINE>initMap(rootNode, psiFile);<NEW_LINE>PsiElement rootPsi = (rootNode.getBlock() instanceof ASTBlock) ? ((ASTBlock) rootNode.getBlock()).getNode().getPsi() : rootElement;<NEW_LINE>BlockTreeNode <MASK><NEW_LINE>if (blockNode == null) {<NEW_LINE>// LOG.error(LogMessageEx<NEW_LINE>// .createEvent("PsiViewer: rootNode not found", "Current language: " + rootElement.getContainingFile().getLanguage(),<NEW_LINE>// AttachmentFactory.createAttachment(rootElement.getContainingFile().getOriginalFile().getVirtualFile())));<NEW_LINE>blockNode = findBlockNode(rootPsi);<NEW_LINE>}<NEW_LINE>blockTreeStructure.setRoot(blockNode);<NEW_LINE>myBlockTree.addTreeSelectionListener(new MyBlockTreeSelectionListener());<NEW_LINE>myBlockTree.setRootVisible(true);<NEW_LINE>myBlockTree.expandRow(0);<NEW_LINE>myBlockTreeBuilder.queueUpdate();<NEW_LINE>} | blockNode = myPsiToBlockMap.get(rootPsi); |
981,135 | protected Condition parseConditionExpression(Element conditionExprElement, String ancestorElementId) {<NEW_LINE>String expression = conditionExprElement.getText().trim();<NEW_LINE>String type = conditionExprElement.attributeNS(XSI_NS, TYPE);<NEW_LINE>String language = conditionExprElement.attribute(PROPERTYNAME_LANGUAGE);<NEW_LINE>String resource = conditionExprElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, PROPERTYNAME_RESOURCE);<NEW_LINE>if (type != null) {<NEW_LINE>String value = type.contains(":") ? resolveName(type) <MASK><NEW_LINE>if (!value.equals(ATTRIBUTEVALUE_T_FORMAL_EXPRESSION)) {<NEW_LINE>addError("Invalid type, only tFormalExpression is currently supported", conditionExprElement, ancestorElementId);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Condition condition = null;<NEW_LINE>if (language == null) {<NEW_LINE>condition = new UelExpressionCondition(expressionManager.createExpression(expression));<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>ExecutableScript script = ScriptUtil.getScript(language, expression, resource, expressionManager);<NEW_LINE>condition = new ScriptCondition(script);<NEW_LINE>} catch (ProcessEngineException e) {<NEW_LINE>addError("Unable to process condition expression:" + e.getMessage(), conditionExprElement, ancestorElementId);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return condition;<NEW_LINE>} | : BpmnParser.BPMN20_NS + ":" + type; |
266,637 | public static List<String> dumpListens(final Repo repo, Path path) throws InterruptedException {<NEW_LINE>final List<PersistentConnection> conns = new ArrayList<PersistentConnection>(1);<NEW_LINE>final Semaphore semaphore = new Semaphore(0);<NEW_LINE>// we need to run this through our work queue to make the ordering work out.<NEW_LINE>repo.scheduleNow(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>conns.add(CoreTestHelpers.getRepoConnection(repo));<NEW_LINE>semaphore.release(1);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>IntegrationTestHelpers.waitFor(semaphore);<NEW_LINE>conns.get(0);<NEW_LINE>List<List<String>> pathList = new ArrayList<>();<NEW_LINE>List<Map<String, Object>> queryParamList = new ArrayList<>();<NEW_LINE>// TODO: Find a way to actually get listens, or not test against internal state?<NEW_LINE>// conn.getListens(pathList, queryParamList);<NEW_LINE>Map<String, List<String>> pathToQueryParamStrings = new HashMap<String, List<String>>();<NEW_LINE>for (int i = 0; i < pathList.size(); i++) {<NEW_LINE>Path queryPath = new Path(pathList.get(i));<NEW_LINE>QueryParams queryParams = QueryParams.fromQueryObject<MASK><NEW_LINE>if (path.contains(queryPath)) {<NEW_LINE>List<String> allParamsStrings = pathToQueryParamStrings.get(queryPath.toString());<NEW_LINE>if (allParamsStrings == null) {<NEW_LINE>allParamsStrings = new ArrayList<String>();<NEW_LINE>}<NEW_LINE>String paramsString = queryParams.isDefault() ? "default" : queryParams.getWireProtocolParams().toString();<NEW_LINE>allParamsStrings.add(paramsString);<NEW_LINE>pathToQueryParamStrings.put(queryPath.toString(), allParamsStrings);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List<String> paths = new ArrayList<String>(pathToQueryParamStrings.keySet());<NEW_LINE>Collections.sort(paths);<NEW_LINE>// +1 for '/'<NEW_LINE>int prefixLength = path.getFront().asString().length() + 1;<NEW_LINE>List<String> results = new ArrayList<String>(paths.size());<NEW_LINE>for (String listenPath : paths) {<NEW_LINE>List<String> allParamsStrings = pathToQueryParamStrings.get(listenPath);<NEW_LINE>Collections.sort(allParamsStrings);<NEW_LINE>String listen = listenPath.substring(prefixLength) + ":" + allParamsStrings.toString();<NEW_LINE>results.add(listen);<NEW_LINE>}<NEW_LINE>return results;<NEW_LINE>} | (queryParamList.get(i)); |
1,156,924 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player controller = game.getPlayer(source.getControllerId());<NEW_LINE>if (controller == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>int amount = 0;<NEW_LINE>TargetControlledPermanent sacrificeLand = new TargetControlledPermanent(0, Integer.MAX_VALUE, new FilterControlledLandPermanent("lands you control"), true);<NEW_LINE>if (controller.chooseTarget(Outcome.Sacrifice, sacrificeLand, source, game)) {<NEW_LINE>for (UUID uuid : sacrificeLand.getTargets()) {<NEW_LINE>Permanent land = game.getPermanent(uuid);<NEW_LINE>if (land != null) {<NEW_LINE>land.sacrifice(source, game);<NEW_LINE>amount++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>TargetCardInLibrary target = new TargetCardInLibrary(amount, new FilterLandCard("lands"));<NEW_LINE>if (controller.searchLibrary(target, source, game)) {<NEW_LINE>controller.moveCards(new CardsImpl(target.getTargets()).getCards(game), Zone.BATTLEFIELD, source, game, true, false, false, null);<NEW_LINE><MASK><NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>controller.shuffleLibrary(source, game);<NEW_LINE>return false;<NEW_LINE>} | controller.shuffleLibrary(source, game); |
924,361 | private void expand(@Nullable NavigationButton button) {<NEW_LINE>if (button == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final <MASK><NEW_LINE>if (panel == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!sidebarOpen) {<NEW_LINE>toggleSidebar();<NEW_LINE>}<NEW_LINE>int width = panel.getWrappedPanel().getPreferredSize().width;<NEW_LINE>int expandBy = pluginPanel != null ? pluginPanel.getWrappedPanel().getPreferredSize().width - width : width;<NEW_LINE>// Deactivate previously active panel<NEW_LINE>if (pluginPanel != null) {<NEW_LINE>pluginPanel.onDeactivate();<NEW_LINE>}<NEW_LINE>pluginPanel = panel;<NEW_LINE>// Expand sidebar<NEW_LINE>navContainer.setMinimumSize(new Dimension(width, 0));<NEW_LINE>navContainer.setMaximumSize(new Dimension(width, Integer.MAX_VALUE));<NEW_LINE>navContainer.setPreferredSize(new Dimension(width, 0));<NEW_LINE>navContainer.revalidate();<NEW_LINE>cardLayout.show(navContainer, button.getTooltip());<NEW_LINE>// panel.onActivate has to go after giveClientFocus so it can get focus if it needs.<NEW_LINE>giveClientFocus();<NEW_LINE>panel.onActivate();<NEW_LINE>// Check if frame was really expanded or contracted<NEW_LINE>if (expandBy > 0) {<NEW_LINE>frame.expandBy(expandBy);<NEW_LINE>} else if (expandBy < 0) {<NEW_LINE>frame.contractBy(expandBy);<NEW_LINE>}<NEW_LINE>} | PluginPanel panel = button.getPanel(); |
1,234,979 | public CompletableFuture<InetSocketAddress> resolveAddr() {<NEW_LINE>if (resolvedAddrFuture.get() != null) {<NEW_LINE>return resolvedAddrFuture.get();<NEW_LINE>}<NEW_LINE>CompletableFuture<InetSocketAddress> promise = new CompletableFuture<>();<NEW_LINE>if (!resolvedAddrFuture.compareAndSet(null, promise)) {<NEW_LINE>return resolvedAddrFuture.get();<NEW_LINE>}<NEW_LINE>byte[] addr = NetUtil.createByteArrayFromIpAddressString(uri.getHost());<NEW_LINE>if (addr != null) {<NEW_LINE>try {<NEW_LINE>resolvedAddr = new InetSocketAddress(InetAddress.getByAddress(uri.getHost(), addr), uri.getPort());<NEW_LINE>} catch (UnknownHostException e) {<NEW_LINE>// skip<NEW_LINE>}<NEW_LINE>promise.complete(resolvedAddr);<NEW_LINE>return promise;<NEW_LINE>}<NEW_LINE>AddressResolver<InetSocketAddress> resolver = (AddressResolver<InetSocketAddress>) bootstrap.config().resolver().getResolver(bootstrap.config().group().next());<NEW_LINE>Future<InetSocketAddress> resolveFuture = resolver.resolve(InetSocketAddress.createUnresolved(uri.getHost()<MASK><NEW_LINE>resolveFuture.addListener((FutureListener<InetSocketAddress>) future -> {<NEW_LINE>if (!future.isSuccess()) {<NEW_LINE>promise.completeExceptionally(future.cause());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>InetSocketAddress resolved = future.getNow();<NEW_LINE>byte[] addr1 = resolved.getAddress().getAddress();<NEW_LINE>resolvedAddr = new InetSocketAddress(InetAddress.getByAddress(uri.getHost(), addr1), resolved.getPort());<NEW_LINE>promise.complete(resolvedAddr);<NEW_LINE>});<NEW_LINE>return promise;<NEW_LINE>} | , uri.getPort())); |
1,593,007 | private ShipmentSchedule ofRecord(final I_M_ShipmentSchedule record) {<NEW_LINE>final OrgId orgId = OrgId.<MASK><NEW_LINE>final ShipmentScheduleId shipmentScheduleId = ShipmentScheduleId.ofRepoId(record.getM_ShipmentSchedule_ID());<NEW_LINE>final OrderAndLineId orderAndLineId = record.getC_Order_ID() > 0 && record.getC_OrderLine_ID() > 0 ? OrderAndLineId.ofRepoIds(record.getC_Order_ID(), record.getC_OrderLine_ID()) : null;<NEW_LINE>final ShipmentSchedule.ShipmentScheduleBuilder shipmentScheduleBuilder = ShipmentSchedule.builder().id(shipmentScheduleId).orgId(orgId).shipBPartnerId(shipmentScheduleEffectiveBL.getBPartnerId(record)).shipLocationId(shipmentScheduleEffectiveBL.getBPartnerLocationId(record)).shipContactId(shipmentScheduleEffectiveBL.getBPartnerContactId(record)).billBPartnerId(BPartnerId.ofRepoIdOrNull(record.getBill_BPartner_ID())).billLocationId(BPartnerLocationId.ofRepoIdOrNull(record.getBill_BPartner_ID(), record.getBill_Location_ID())).billContactId(BPartnerContactId.ofRepoIdOrNull(record.getBill_BPartner_ID(), record.getBill_User_ID())).orderAndLineId(orderAndLineId).productId(ProductId.ofRepoId(record.getM_Product_ID())).attributeSetInstanceId(AttributeSetInstanceId.ofRepoIdOrNone(record.getM_AttributeSetInstance_ID())).shipperId(ShipperId.ofRepoIdOrNull(record.getM_Shipper_ID())).quantityToDeliver(shipmentScheduleBL.getQtyToDeliver(record)).orderedQuantity(shipmentScheduleBL.getQtyOrdered(record)).numberOfItemsForSameShipment(record.getNrOfOLCandsWithSamePOReference()).deliveredQuantity(shipmentScheduleBL.getQtyDelivered(record)).exportStatus(APIExportStatus.ofCode(record.getExportStatus())).isProcessed(record.isProcessed());<NEW_LINE>if (record.getDateOrdered() != null) {<NEW_LINE>shipmentScheduleBuilder.dateOrdered(record.getDateOrdered().toLocalDateTime());<NEW_LINE>}<NEW_LINE>return shipmentScheduleBuilder.build();<NEW_LINE>} | ofRepoId(record.getAD_Org_ID()); |
314,711 | public void execute(String commandName, ConsoleInput ci, List args) {<NEW_LINE>StatsWriterStreamer sws = StatsWriterFactory.createStreamer(ci.getCore());<NEW_LINE>String file = null;<NEW_LINE>if ((args != null) && (!args.isEmpty()))<NEW_LINE>file = (String) args.get(0);<NEW_LINE>if (file == null) {<NEW_LINE>try {<NEW_LINE>ci.out.println("> -----");<NEW_LINE>sws.write(ci.out);<NEW_LINE>ci.out.println("> -----");<NEW_LINE>} catch (Exception e) {<NEW_LINE>ci.out.println("> Exception while trying to output xml stats:" + e.getMessage());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>FileOutputStream os = new FileOutputStream(file);<NEW_LINE>try {<NEW_LINE>sws.write(os);<NEW_LINE>} finally {<NEW_LINE>os.close();<NEW_LINE>}<NEW_LINE>ci.out.println("> XML stats successfully written to " + file);<NEW_LINE>} catch (Exception e) {<NEW_LINE>ci.out.println(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | "> Exception while trying to write xml stats:" + e.getMessage()); |
163,884 | public void weaveJarFile(String sourceJarFileName, String destJarFileName) throws IOException {<NEW_LINE>JarFile jarFile = new JarFile(sourceJarFileName);<NEW_LINE>ArrayList<JarEntry> entries = Collections.list(jarFile.entries());<NEW_LINE>OutputStream os = new FileOutputStream(destJarFileName);<NEW_LINE>JarOutputStream out = new JarOutputStream(os);<NEW_LINE>int n = 0;<NEW_LINE>for (JarEntry entry : entries) {<NEW_LINE>if (entry.getName().endsWith(".class")) {<NEW_LINE>n++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>displayStartMessage(n);<NEW_LINE>for (JarEntry entry : entries) {<NEW_LINE>String name = entry.getName();<NEW_LINE>InputStream dataStream = null;<NEW_LINE>if (name.endsWith(".class")) {<NEW_LINE>// weave class<NEW_LINE>InputStream is = jarFile.getInputStream(entry);<NEW_LINE>ByteArrayOutputStream classStream = new ByteArrayOutputStream();<NEW_LINE>if (weave(is, name, classStream)) {<NEW_LINE>// class file was modified<NEW_LINE>weavedClassCount++;<NEW_LINE>dataStream = new ByteArrayInputStream(classStream.toByteArray());<NEW_LINE>// create new entry<NEW_LINE>entry = new JarEntry(name);<NEW_LINE>recordFileForVerifier(name);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (dataStream == null) {<NEW_LINE>// not a class file or class wasn't no<NEW_LINE>dataStream = jarFile.getInputStream(entry);<NEW_LINE>}<NEW_LINE>// writing entry<NEW_LINE>out.putNextEntry(new JarEntry(name));<NEW_LINE>// writing data<NEW_LINE>int len;<NEW_LINE>final byte[] buf = new byte[1024];<NEW_LINE>while ((len = dataStream.read(buf)) >= 0) {<NEW_LINE>out.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>out.close();<NEW_LINE>jarFile.close();<NEW_LINE>displayEndMessage();<NEW_LINE>if (verifier != null) {<NEW_LINE>verifier.verifyJarFile(destJarFileName);<NEW_LINE>verifier.displaySummary();<NEW_LINE>}<NEW_LINE>} | write(buf, 0, len); |
1,104,670 | public void onBindHeaderViewHolder(HeaderViewHolder holder, int position) {<NEW_LINE>sortType = SharedPreferencesUtil.getInt(ConstantStrings.PREF_SORT_SPEAKER, SORTED_BY_NAME);<NEW_LINE>String speakerData;<NEW_LINE>if (sortType == SORTED_BY_NAME)<NEW_LINE>speakerData = Utils.nullToEmpty(getItem<MASK><NEW_LINE>else if (sortType == SORTED_BY_ORGANIZATION)<NEW_LINE>speakerData = Utils.nullToEmpty(getItem(position).getOrganisation());<NEW_LINE>else<NEW_LINE>speakerData = Utils.nullToEmpty(getItem(position).getCountry());<NEW_LINE>if (!TextUtils.isEmpty(speakerData) && sortType == SORTED_BY_NAME)<NEW_LINE>holder.header.setText(String.valueOf(speakerData.toUpperCase().charAt(0)));<NEW_LINE>else if (!TextUtils.isEmpty(speakerData) && (sortType == SORTED_BY_ORGANIZATION || sortType == SORTED_BY_COUNTRY))<NEW_LINE>holder.header.setText(String.valueOf(speakerData));<NEW_LINE>else<NEW_LINE>holder.header.setText(String.valueOf("#"));<NEW_LINE>} | (position).getName()); |
1,654,724 | static boolean combineAnnotations(PathObjectHierarchy hierarchy, List<PathObject> pathObjects, RoiTools.CombineOp op) {<NEW_LINE>if (hierarchy == null || hierarchy.isEmpty() || pathObjects.isEmpty()) {<NEW_LINE>logger.warn("Combine annotations: Cannot combine - no annotations found");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>pathObjects = new ArrayList<>(pathObjects);<NEW_LINE>PathObject <MASK><NEW_LINE>if (!pathObject.isAnnotation()) {<NEW_LINE>// || !RoiTools.isShapeROI(pathObject.getROI())) {<NEW_LINE>logger.warn("Combine annotations: No annotation with ROI selected");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>var plane = pathObject.getROI().getImagePlane();<NEW_LINE>// pathObjects.removeIf(p -> !RoiTools.isShapeROI(p.getROI())); // Remove any null or point ROIs, TODO: Consider supporting points<NEW_LINE>// Remove any null or point ROIs, TODO: Consider supporting points<NEW_LINE>pathObjects.removeIf(p -> !p.hasROI() || !p.getROI().getImagePlane().equals(plane));<NEW_LINE>if (pathObjects.isEmpty()) {<NEW_LINE>logger.warn("Cannot combine annotations - only one suitable annotation found");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>var allROIs = pathObjects.stream().map(p -> p.getROI()).collect(Collectors.toCollection(() -> new ArrayList<>()));<NEW_LINE>ROI newROI;<NEW_LINE>switch(op) {<NEW_LINE>case ADD:<NEW_LINE>newROI = RoiTools.union(allROIs);<NEW_LINE>break;<NEW_LINE>case INTERSECT:<NEW_LINE>newROI = RoiTools.intersection(allROIs);<NEW_LINE>break;<NEW_LINE>case SUBTRACT:<NEW_LINE>var first = allROIs.remove(0);<NEW_LINE>newROI = RoiTools.combineROIs(first, RoiTools.union(allROIs), op);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new IllegalArgumentException("Unknown combine op " + op);<NEW_LINE>}<NEW_LINE>if (newROI == null) {<NEW_LINE>logger.debug("No changes were made");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>PathObject newObject = null;<NEW_LINE>if (!newROI.isEmpty()) {<NEW_LINE>newObject = PathObjects.createAnnotationObject(newROI, pathObject.getPathClass());<NEW_LINE>newObject.setName(pathObject.getName());<NEW_LINE>newObject.setColorRGB(pathObject.getColorRGB());<NEW_LINE>}<NEW_LINE>// Remove previous objects<NEW_LINE>hierarchy.removeObjects(pathObjects, true);<NEW_LINE>if (newObject != null)<NEW_LINE>hierarchy.addPathObject(newObject);<NEW_LINE>return true;<NEW_LINE>} | pathObject = pathObjects.get(0); |
300,465 | public Message<?> toMessage(Object object, @Nullable MessageHeaders messageHeaders) {<NEW_LINE>Assert.isInstanceOf(Map.class, object, "This converter expects a Map");<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>Map<String, ?> map = (Map<String, ?>) object;<NEW_LINE>Object payload = map.get("payload");<NEW_LINE>Assert.notNull(payload, "'payload' entry cannot be null");<NEW_LINE>AbstractIntegrationMessageBuilder<?> messageBuilder = <MASK><NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>Map<String, ?> headers = (Map<String, ?>) map.get("headers");<NEW_LINE>if (headers != null) {<NEW_LINE>if (this.filterHeadersInToMessage) {<NEW_LINE>headers.keySet().retainAll(Arrays.asList(this.headerNames));<NEW_LINE>}<NEW_LINE>messageBuilder.copyHeaders(headers);<NEW_LINE>}<NEW_LINE>return messageBuilder.copyHeadersIfAbsent(messageHeaders).build();<NEW_LINE>} | getMessageBuilderFactory().withPayload(payload); |
1,722,541 | public <W, X> java.util.List<X> asList(W e) {<NEW_LINE>return new AbstractList<X>() {<NEW_LINE><NEW_LINE>T element = castTarget(e);<NEW_LINE><NEW_LINE>boolean hasValue = SingleHandler.this.getValue(element) != null;<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public int size() {<NEW_LINE>return hasValue ? 1 : 0;<NEW_LINE>}<NEW_LINE><NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>@Override<NEW_LINE>public X get(int index) {<NEW_LINE>if (index < 0 || index >= size()) {<NEW_LINE>throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + size());<NEW_LINE>}<NEW_LINE>return (X) SingleHandler.this.getValue(element);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public X set(int index, X value) {<NEW_LINE>if (index < 0 || index >= size()) {<NEW_LINE>throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + size());<NEW_LINE>}<NEW_LINE>X oldValue = get(0);<NEW_LINE>SingleHandler.this.setValue(element, value);<NEW_LINE>return oldValue;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean add(X value) {<NEW_LINE>if (hasValue) {<NEW_LINE>// single value cannot have more then one value<NEW_LINE>throw new SpoonException("Single value attribute cannot have more then one value");<NEW_LINE>}<NEW_LINE>SingleHandler.this.setValue(element, value);<NEW_LINE>hasValue = true;<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public X remove(int index) {<NEW_LINE>if (index < 0 || index >= size()) {<NEW_LINE>throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + size());<NEW_LINE>}<NEW_LINE>X oldValue = get(0);<NEW_LINE>if (oldValue != null) {<NEW_LINE>SingleHandler.this.setValue(element, null);<NEW_LINE>}<NEW_LINE>hasValue = false;<NEW_LINE>return oldValue;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean remove(Object value) {<NEW_LINE>if (hasValue == false) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>X oldValue = get(0);<NEW_LINE>if (equals(oldValue, value)) {<NEW_LINE>if (oldValue != null) {<NEW_LINE>SingleHandler.<MASK><NEW_LINE>}<NEW_LINE>hasValue = false;<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE><NEW_LINE>private boolean equals(Object v1, Object v2) {<NEW_LINE>if (v1 == v2) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (v1 == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return v1.equals(v2);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | this.setValue(element, null); |
1,044,641 | // Dump the content of this bean returning it as a String<NEW_LINE>public void dump(StringBuffer str, String indent) {<NEW_LINE>String s;<NEW_LINE>BaseBean n;<NEW_LINE>str.append(indent);<NEW_LINE>// NOI18N<NEW_LINE>str.append("SessionIn");<NEW_LINE>n = this.getSessionIn();<NEW_LINE>if (n != null)<NEW_LINE>// NOI18N<NEW_LINE>n.dump(str, indent + "\t");<NEW_LINE>else<NEW_LINE>// NOI18N<NEW_LINE>str.append(indent + "\tnull");<NEW_LINE>this.dumpAttributes(SESSIONIN, 0, str, indent);<NEW_LINE>str.append(indent);<NEW_LINE>// NOI18N<NEW_LINE>str.append("SessionOut");<NEW_LINE>n = this.getSessionOut();<NEW_LINE>if (n != null)<NEW_LINE>// NOI18N<NEW_LINE>n.dump(str, indent + "\t");<NEW_LINE>else<NEW_LINE>// NOI18N<NEW_LINE><MASK><NEW_LINE>this.dumpAttributes(SESSIONOUT, 0, str, indent);<NEW_LINE>} | str.append(indent + "\tnull"); |
1,083,338 | default void georeMelting(Consumer<FinishedRecipe> consumer, Fluid fluid, int unit, String name, String folder) {<NEW_LINE>// base<NEW_LINE>tagMelting(consumer, fluid, unit, "geore_shards/" + name, 1.0f, folder + "geore/shard", true);<NEW_LINE>tagMelting(consumer, fluid, unit * 4, "geore_blocks/" + name, 2.0f, folder + "geore/block", true);<NEW_LINE>// clusters<NEW_LINE>tagMelting(consumer, fluid, unit * 4, "geore_clusters/" + name, 2.5f, folder + "geore/cluster", true);<NEW_LINE>tagMelting(consumer, fluid, unit, "geore_small_buds/" + name, <MASK><NEW_LINE>tagMelting(consumer, fluid, unit * 2, "geore_medium_buds/" + name, 1.5f, folder + "geore/bud_medium", true);<NEW_LINE>tagMelting(consumer, fluid, unit * 3, "geore_large_buds/" + name, 2.0f, folder + "geore/bud_large", true);<NEW_LINE>} | 1.0f, folder + "geore/bud_small", true); |
547,993 | private void configureSettings(HashLookupSettings settings, Set<String> officialSetNames) {<NEW_LINE>allDatabasesLoadedCorrectly = true;<NEW_LINE>List<HashDbInfo> hashDbInfoList = settings.getHashDbInfo();<NEW_LINE><MASK><NEW_LINE>for (HashDbInfo hashDbInfo : hashDbInfoList) {<NEW_LINE>configureLocalDb(hashDbInfo);<NEW_LINE>}<NEW_LINE>if (CentralRepository.isEnabled()) {<NEW_LINE>configureCrDbs();<NEW_LINE>}<NEW_LINE>if (!allDatabasesLoadedCorrectly && RuntimeProperties.runningWithGUI()) {<NEW_LINE>try {<NEW_LINE>HashLookupSettings.writeSettings(new HashLookupSettings(HashLookupSettings.convertHashSetList(this.hashSets)));<NEW_LINE>allDatabasesLoadedCorrectly = true;<NEW_LINE>} catch (HashLookupSettings.HashLookupSettingsException ex) {<NEW_LINE>allDatabasesLoadedCorrectly = false;<NEW_LINE>logger.log(Level.SEVERE, "Could not overwrite hash set settings.", ex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | hashDbInfoList = handleNameConflict(hashDbInfoList, officialSetNames); |
1,117,725 | final TagResourceResult executeTagResource(TagResourceRequest tagResourceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(tagResourceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<TagResourceRequest> request = null;<NEW_LINE>Response<TagResourceResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new TagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(tagResourceRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "DLM");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "TagResource");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<TagResourceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new TagResourceResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
1,338,594 | public void execute() throws MojoExecutionException, MojoFailureException {<NEW_LINE>Bundlers bundlers = Bundlers.createBundlersInstance();<NEW_LINE>getLog().info("Available bundlers:");<NEW_LINE>getLog().info("-------------------");<NEW_LINE>Map<String, ? super Object> dummyParams = new HashMap<>();<NEW_LINE>bundlers.getBundlers().stream().forEach((bundler) -> {<NEW_LINE>try {<NEW_LINE>bundler.validate(dummyParams);<NEW_LINE>} catch (UnsupportedPlatformException ex) {<NEW_LINE>return;<NEW_LINE>} catch (ConfigException ex) {<NEW_LINE>// NO-OP<NEW_LINE>// bundler is supported on this OS<NEW_LINE>}<NEW_LINE>getLog().info(<MASK><NEW_LINE>getLog().info("Name: " + bundler.getName());<NEW_LINE>getLog().info("Description: " + bundler.getDescription());<NEW_LINE>Collection<BundlerParamInfo<?>> bundleParameters = bundler.getBundleParameters();<NEW_LINE>Optional.ofNullable(bundleParameters).ifPresent(nonNullBundleArguments -> {<NEW_LINE>getLog().info("Available bundle arguments: ");<NEW_LINE>nonNullBundleArguments.stream().forEach(bundleArgument -> {<NEW_LINE>getLog().info("\t\tArgument ID: " + bundleArgument.getID());<NEW_LINE>getLog().info("\t\tArgument Type: " + bundleArgument.getValueType().getName());<NEW_LINE>getLog().info("\t\tArgument Name: " + bundleArgument.getName());<NEW_LINE>getLog().info("\t\tArgument Description: " + bundleArgument.getDescription());<NEW_LINE>getLog().info("");<NEW_LINE>});<NEW_LINE>});<NEW_LINE>getLog().info("-------------------");<NEW_LINE>});<NEW_LINE>} | "ID: " + bundler.getID()); |
1,533,882 | final DescribePolicyResult executeDescribePolicy(DescribePolicyRequest describePolicyRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describePolicyRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<DescribePolicyRequest> request = null;<NEW_LINE>Response<DescribePolicyResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribePolicyRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describePolicyRequest));<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, "Organizations");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribePolicy");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribePolicyResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribePolicyResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
1,217,528 | public void copyTo(HugeLongArray dest, long length) {<NEW_LINE>if (length > size) {<NEW_LINE>length = size;<NEW_LINE>}<NEW_LINE>if (length > dest.size()) {<NEW_LINE>length = dest.size();<NEW_LINE>}<NEW_LINE>if (dest instanceof SingleHugeLongArray) {<NEW_LINE>SingleHugeLongArray dst = (SingleHugeLongArray) dest;<NEW_LINE>System.arraycopy(page, 0, dst.page, 0, (int) length);<NEW_LINE>Arrays.fill(dst.page, (int) length, dst.size, 0L);<NEW_LINE>} else if (dest instanceof PagedHugeLongArray) {<NEW_LINE>PagedHugeLongArray dst = (PagedHugeLongArray) dest;<NEW_LINE>int start = 0;<NEW_LINE>int remaining = (int) length;<NEW_LINE>for (long[] dstPage : dst.pages) {<NEW_LINE>int toCopy = Math.min(remaining, dstPage.length);<NEW_LINE>if (toCopy == 0) {<NEW_LINE>Arrays.fill(page, 0L);<NEW_LINE>} else {<NEW_LINE>System.arraycopy(page, start, dstPage, 0, toCopy);<NEW_LINE>if (toCopy < dstPage.length) {<NEW_LINE>Arrays.fill(dstPage, <MASK><NEW_LINE>}<NEW_LINE>start += toCopy;<NEW_LINE>remaining -= toCopy;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | toCopy, dstPage.length, 0L); |
354,392 | private void initViewFooter() {<NEW_LINE>String creation = DateHelper.getFormattedDate(noteTmp.getCreation(), Prefs.getBoolean(PREF_PRETTIFIED_DATES, true));<NEW_LINE>binding.creation.append(creation.length() > 0 ? getString(R.string.creation<MASK><NEW_LINE>if (binding.creation.getText().length() == 0) {<NEW_LINE>binding.creation.setVisibility(View.GONE);<NEW_LINE>}<NEW_LINE>String lastModification = DateHelper.getFormattedDate(noteTmp.getLastModification(), Prefs.getBoolean(PREF_PRETTIFIED_DATES, true));<NEW_LINE>binding.lastModification.append(lastModification.length() > 0 ? getString(R.string.last_update) + " " + lastModification : "");<NEW_LINE>if (binding.lastModification.getText().length() == 0) {<NEW_LINE>binding.lastModification.setVisibility(View.GONE);<NEW_LINE>}<NEW_LINE>} | ) + " " + creation : ""); |
729,781 | final ModifyReplicationInstanceResult executeModifyReplicationInstance(ModifyReplicationInstanceRequest modifyReplicationInstanceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(modifyReplicationInstanceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ModifyReplicationInstanceRequest> request = null;<NEW_LINE>Response<ModifyReplicationInstanceResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ModifyReplicationInstanceRequestProtocolMarshaller(protocolFactory).marshall<MASK><NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Database Migration Service");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ModifyReplicationInstance");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ModifyReplicationInstanceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ModifyReplicationInstanceResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | (super.beforeMarshalling(modifyReplicationInstanceRequest)); |
1,214,824 | public void updateTime() {<NEW_LINE>byte[] payload = new byte[TIME_INFO_PAYLOAD_LEN];<NEW_LINE>byte tmp;<NEW_LINE>Calendar now = new GregorianCalendar(tz);<NEW_LINE>payload[0] = (byte) (now.get<MASK><NEW_LINE>payload[1] = (byte) now.get(Calendar.DAY_OF_MONTH);<NEW_LINE>// TODO ?? can set<NEW_LINE>payload[2] = (byte) now.get(Calendar.HOUR_OF_DAY);<NEW_LINE>// DST flag in<NEW_LINE>// bit[6] to advance<NEW_LINE>// time by 1hour,<NEW_LINE>// but java handles<NEW_LINE>// this<NEW_LINE>tmp = (byte) (now.get(Calendar.MONTH) + 1);<NEW_LINE>tmp &= 0x03;<NEW_LINE>tmp <<= 6;<NEW_LINE>tmp |= (byte) (now.get(Calendar.SECOND) & 0x3f);<NEW_LINE>payload[4] = tmp;<NEW_LINE>super.appendPayload(payload);<NEW_LINE>super.printDebugPayload();<NEW_LINE>} | (Calendar.YEAR) - 2000); |
1,566,795 | final DescribeRepositoryResult executeDescribeRepository(DescribeRepositoryRequest describeRepositoryRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeRepositoryRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeRepositoryRequest> request = null;<NEW_LINE>Response<DescribeRepositoryResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeRepositoryRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeRepositoryRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "codeartifact");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeRepository");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeRepositoryResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeRepositoryResultJsonUnmarshaller());<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.CLIENT_ENDPOINT, endpoint); |
68,740 | public void keyPressed(java.awt.event.KeyEvent e) {<NEW_LINE>if (changingPage)<NEW_LINE>return;<NEW_LINE>int deltaPage = 0;<NEW_LINE>int keyCode = e.getKeyCode();<NEW_LINE>if (keyCode == java.awt.event.KeyEvent.VK_PAGE_DOWN) {<NEW_LINE>deltaPage = documentView.getPreviousPageIncrement();<NEW_LINE>} else if (keyCode == java.awt.event.KeyEvent.VK_PAGE_UP) {<NEW_LINE>deltaPage = -documentView.getNextPageIncrement();<NEW_LINE>} else if (keyCode == java.awt.event.KeyEvent.VK_HOME) {<NEW_LINE>deltaPage = -controller.getCurrentPageNumber();<NEW_LINE>} else if (keyCode == java.awt.event.KeyEvent.VK_END) {<NEW_LINE>deltaPage = controller.getDocument().getNumberOfPages() - controller.getCurrentPageNumber() - 1;<NEW_LINE>}<NEW_LINE>if (deltaPage == 0)<NEW_LINE>return;<NEW_LINE>int newPage <MASK><NEW_LINE>if (controller.getDocument() == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (newPage < 0) {<NEW_LINE>deltaPage = -controller.getCurrentPageNumber();<NEW_LINE>}<NEW_LINE>if (newPage >= controller.getDocument().getNumberOfPages()) {<NEW_LINE>deltaPage = controller.getDocument().getNumberOfPages() - controller.getCurrentPageNumber() - 1;<NEW_LINE>}<NEW_LINE>changingPage = true;<NEW_LINE>final int dp = deltaPage;<NEW_LINE>SwingUtilities.invokeLater(new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>changingPage = false;<NEW_LINE>controller.goToDeltaPage(dp);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | = controller.getCurrentPageNumber() + deltaPage; |
1,207,410 | public static ClassNode correctToGenericsSpec(Map<String, ClassNode> genericsSpec, ClassNode type) {<NEW_LINE>if (type.isArray()) {<NEW_LINE>return correctToGenericsSpec(genericsSpec, type.<MASK><NEW_LINE>}<NEW_LINE>if (type.isGenericsPlaceHolder() && type.getGenericsTypes() != null) {<NEW_LINE>String name = type.getGenericsTypes()[0].getName();<NEW_LINE>type = genericsSpec.get(name);<NEW_LINE>if (type != null && type.isGenericsPlaceHolder() && /* GRECLIPSE edit -- GROOVY-9059<NEW_LINE>&& !name.equals(type.getUnresolvedName())) {<NEW_LINE>*/<NEW_LINE>type.hasMultiRedirect()) {<NEW_LINE>type = type.asGenericsType().getUpperBounds()[0];<NEW_LINE>// GRECLIPSE end<NEW_LINE>return correctToGenericsSpec(genericsSpec, type);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (type == null)<NEW_LINE>type = ClassHelper.OBJECT_TYPE;<NEW_LINE>return type;<NEW_LINE>} | getComponentType()).makeArray(); |
31,568 | public void processMouseWheelEvent(@Nonnull MouseWheelEvent e, @Nullable Consumer<MouseWheelEvent> alternative) {<NEW_LINE>JScrollBar bar = !myScrollEnabled.get(<MASK><NEW_LINE>if (bar == null) {<NEW_LINE>if (alternative != null)<NEW_LINE>alternative.accept(e);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (TouchScrollUtil.isBegin(e)) {<NEW_LINE>verticalFling.registerBegin();<NEW_LINE>horizontalFling.registerBegin();<NEW_LINE>} else if (TouchScrollUtil.isUpdate(e)) {<NEW_LINE>int value = bar.getValue();<NEW_LINE>int delta = (int) TouchScrollUtil.getDelta(e);<NEW_LINE>bar.setValue(value + delta);<NEW_LINE>FlingManager fling = isHorizontalScroll(e) ? horizontalFling : verticalFling;<NEW_LINE>fling.registerUpdate(delta);<NEW_LINE>} else if (TouchScrollUtil.isEnd(e)) {<NEW_LINE>verticalFling.start(getEventVerticalScrollBar(e), vertical);<NEW_LINE>horizontalFling.start(getEventHorizontalScrollBar(e), horizontal);<NEW_LINE>}<NEW_LINE>e.consume();<NEW_LINE>} | ) ? null : getEventScrollBar(e); |
570,035 | private boolean isClusterWideMigrationPossible(Host host, List<VMInstanceVO> vms, List<HostVO> hosts) {<NEW_LINE>if (MIGRATE_VM_ACROSS_CLUSTERS.valueIn(host.getDataCenterId())) {<NEW_LINE>s_logger.info("Looking for hosts across different clusters in zone: " + host.getDataCenterId());<NEW_LINE>Long podId = null;<NEW_LINE>for (final VMInstanceVO vm : vms) {<NEW_LINE>if (VirtualMachine.systemVMs.contains(vm.getType())) {<NEW_LINE>// SystemVMs can only be migrated to same pod<NEW_LINE>podId = host.getPodId();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>hosts.addAll(listAllUpAndEnabledHosts(Host.Type.Routing, null, podId, host.getDataCenterId()));<NEW_LINE>if (CollectionUtils.isEmpty(hosts)) {<NEW_LINE>s_logger.warn("Unable to find a host for vm migration in zone: " + host.getDataCenterId());<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>s_logger.info("Found hosts in the zone for vm migration: " + hosts);<NEW_LINE>if (HypervisorType.VMware.equals(host.getHypervisorType())) {<NEW_LINE>s_logger.debug("Skipping pool check of volumes on VMware environment because across-cluster vm migration is supported by vMotion");<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>// Don't migrate vm if it has volumes on cluster-wide pool<NEW_LINE>for (final VMInstanceVO vm : vms) {<NEW_LINE>if (_vmMgr.checkIfVmHasClusterWideVolumes(vm.getId())) {<NEW_LINE>s_logger.warn(String<MASK><NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>s_logger.warn(String.format("VMs cannot be migrated across cluster since %s is false for zone ID: %d", MIGRATE_VM_ACROSS_CLUSTERS.key(), host.getDataCenterId()));<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | .format("VM %s cannot be migrated across cluster as it has volumes on cluster-wide pool", vm)); |
477,757 | // Bermudan or European<NEW_LINE>private AdjustableDate selectStandard(LocalDate proposedExerciseDate, DateAdjuster adjuster) {<NEW_LINE>AdjustableDates dates = calculateDates();<NEW_LINE>// search adjusted dates<NEW_LINE>for (LocalDate unadjusted : dates.getUnadjusted()) {<NEW_LINE>if (adjuster.adjust(unadjusted).equals(proposedExerciseDate)) {<NEW_LINE>return unadjusted.equals(proposedExerciseDate) ? AdjustableDate.of(proposedExerciseDate, dateDefinition.getAdjustment()<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>// search unadjusted dates<NEW_LINE>if (dates.getUnadjusted().contains(proposedExerciseDate)) {<NEW_LINE>return AdjustableDate.of(proposedExerciseDate, dateDefinition.getAdjustment());<NEW_LINE>}<NEW_LINE>throw new IllegalArgumentException("Invalid exercise date: " + proposedExerciseDate);<NEW_LINE>} | ) : AdjustableDate.of(proposedExerciseDate); |
85,505 | static ClusterState deleteModelAlias(final ClusterState currentState, final IngestService ingestService, final InferenceAuditor inferenceAuditor, final DeleteTrainedModelAliasAction.Request request) {<NEW_LINE>final ModelAliasMetadata currentMetadata = ModelAliasMetadata.fromState(currentState);<NEW_LINE>final String referencedModel = currentMetadata.getModelId(request.getModelAlias());<NEW_LINE>if (referencedModel == null) {<NEW_LINE>throw new ElasticsearchStatusException("model_alias [{}] could not be found", RestStatus.NOT_FOUND, request.getModelAlias());<NEW_LINE>}<NEW_LINE>if (referencedModel.equals(request.getModelId()) == false) {<NEW_LINE>throw new ElasticsearchStatusException("model_alias [{}] does not refer to provided model_id [{}]", RestStatus.CONFLICT, request.getModelAlias(), request.getModelId());<NEW_LINE>}<NEW_LINE>IngestMetadata currentIngestMetadata = currentState.metadata().custom(IngestMetadata.TYPE);<NEW_LINE>Set<String> referencedModels = getReferencedModelKeys(currentIngestMetadata, ingestService);<NEW_LINE>if (referencedModels.contains(request.getModelAlias())) {<NEW_LINE>throw new ElasticsearchStatusException("Cannot delete model_alias [{}] as it is still referenced by ingest processors", RestStatus.CONFLICT, request.getModelAlias());<NEW_LINE>}<NEW_LINE>final ClusterState.Builder builder = ClusterState.builder(currentState);<NEW_LINE>final Map<String, ModelAliasMetadata.ModelAliasEntry> newMetadata = new HashMap<>(currentMetadata.modelAliases());<NEW_LINE>logger.info("deleting model_alias [{}] that refers to model [{}]", request.getModelAlias(), request.getModelId());<NEW_LINE>inferenceAuditor.info(referencedModel, String.format(Locale.ROOT, "deleting model_alias [%s]"<MASK><NEW_LINE>newMetadata.remove(request.getModelAlias());<NEW_LINE>final ModelAliasMetadata modelAliasMetadata = new ModelAliasMetadata(newMetadata);<NEW_LINE>builder.metadata(Metadata.builder(currentState.getMetadata()).putCustom(ModelAliasMetadata.NAME, modelAliasMetadata).build());<NEW_LINE>return builder.build();<NEW_LINE>} | , request.getModelAlias())); |
1,690,427 | private void sendScreenNotification(String message, String detail) {<NEW_LINE>Context context = mContext;<NEW_LINE>if (context == null) {<NEW_LINE>LogManager.e(TAG, "congtext is unexpectedly null");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>initializeWithContext(context);<NEW_LINE>if (this.mNotificationsEnabled) {<NEW_LINE>if (!this.mNotificationChannelCreated) {<NEW_LINE>createNotificationChannel(context, "err");<NEW_LINE>}<NEW_LINE>NotificationCompat.Builder builder = (new NotificationCompat.Builder(context, "err")).setContentTitle("BluetoothMedic: " + message).setSmallIcon(mNotificationIcon).setVibrate(new long[] { 200L, 100L, 200L }).setContentText(detail);<NEW_LINE>TaskStackBuilder <MASK><NEW_LINE>stackBuilder.addNextIntent(new Intent("NoOperation"));<NEW_LINE>PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);<NEW_LINE>builder.setContentIntent(resultPendingIntent);<NEW_LINE>NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);<NEW_LINE>if (notificationManager != null) {<NEW_LINE>notificationManager.notify(1, builder.build());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | stackBuilder = TaskStackBuilder.create(context); |
1,790,258 | private String generateRedirectURI(Map<DefDescriptor<?>, String> descriptors, String computedUID, HttpServletRequest request) {<NEW_LINE>StringBuilder redirectURI = new StringBuilder(URI_DEFINITIONS_PATH);<NEW_LINE>// note, keep parameters in alpha order and keep in sync with componentDefLoader.js to increase chances of cache hits<NEW_LINE>// with the exception of '_def', all definitions requested will be towards the end, followed by UID last, since it's calculated based on defs.<NEW_LINE>redirectURI.append('?');<NEW_LINE>// app param<NEW_LINE>redirectURI.append(appDescriptorParam.name).append('=').append(appDescriptorParam.get(request));<NEW_LINE>redirectURI.append('&').append(formFactorParam.name).append('=').append(formFactorParam.get(request));<NEW_LINE>redirectURI.append('&').append(lockerParam.name).append('=').<MASK><NEW_LINE>redirectURI.append('&').append(cssVarParam.name).append('=').append(configAdapter.isCssVarTransformEnabled());<NEW_LINE>String locale = localeParam.get(request);<NEW_LINE>if (locale != null) {<NEW_LINE>redirectURI.append('&').append(localeParam.name).append('=').append(locale);<NEW_LINE>}<NEW_LINE>String styleContext = styleParam.get(request);<NEW_LINE>if (styleContext != null) {<NEW_LINE>redirectURI.append('&').append(styleParam.name).append('=').append(styleContext);<NEW_LINE>}<NEW_LINE>redirectURI.append(generateAdditionalParameters(request));<NEW_LINE>redirectURI.append(generateDefinitionsURIParameters(descriptors));<NEW_LINE>if (descriptors.size() > 1) {<NEW_LINE>computedUID = String.format("%d", computedUID.hashCode());<NEW_LINE>}<NEW_LINE>redirectURI.append('&').append(componentUIDParam.name).append('=').append(computedUID);<NEW_LINE>return redirectURI.toString();<NEW_LINE>} | append(configAdapter.isLockerServiceEnabled()); |
221,742 | final DescribeSavingsPlansOfferingsResult executeDescribeSavingsPlansOfferings(DescribeSavingsPlansOfferingsRequest describeSavingsPlansOfferingsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeSavingsPlansOfferingsRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeSavingsPlansOfferingsRequest> request = null;<NEW_LINE>Response<DescribeSavingsPlansOfferingsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeSavingsPlansOfferingsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeSavingsPlansOfferingsRequest));<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, "savingsplans");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeSavingsPlansOfferings");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeSavingsPlansOfferingsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeSavingsPlansOfferingsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
1,348,881 | public void onCheckedChanged(CompoundButton _param1, boolean _param2) {<NEW_LINE>final boolean _isChecked = _param2;<NEW_LINE>try {<NEW_LINE>if (_isChecked) {<NEW_LINE>try {<NEW_LINE>version_switch_01.setChecked(false);<NEW_LINE>version_switch_02.setChecked(false);<NEW_LINE>list_changelogs.setVisibility(View.VISIBLE);<NEW_LINE>Mod_Changelogs.addListenerForSingleValueEvent(new ValueEventListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onDataChange(DataSnapshot _dataSnapshot) {<NEW_LINE>others = new ArrayList<>();<NEW_LINE>try {<NEW_LINE>GenericTypeIndicator<HashMap<String, Object>> _ind = new GenericTypeIndicator<HashMap<String, Object>>() {<NEW_LINE>};<NEW_LINE>for (DataSnapshot _data : _dataSnapshot.getChildren()) {<NEW_LINE>HashMap<String, Object> _map = _data.getValue(_ind);<NEW_LINE>others.add(_map);<NEW_LINE>}<NEW_LINE>} catch (Exception _e) {<NEW_LINE>_e.printStackTrace();<NEW_LINE>}<NEW_LINE>if (!SketchwareUtil.isConnected(getApplicationContext())) {<NEW_LINE>com.google.android.material.snackbar.Snackbar.make(main_refresh_layout, "Slow or No Internet Connection. Try again later.", com.google.android.material.snackbar.Snackbar.LENGTH_LONG).show();<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onCancelled(DatabaseError _databaseError) {<NEW_LINE>}<NEW_LINE>});<NEW_LINE>_Switches();<NEW_LINE>} catch (Exception e) {<NEW_LINE>SketchwareUtil.CustomToast(getApplicationContext(), "Fetching Failed", 0xFF000000, 14, 0xFFE0E0E0, 30, SketchwareUtil.BOTTOM);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>list_changelogs.setVisibility(View.GONE);<NEW_LINE>main_refresh_layout.setEnabled(true);<NEW_LINE>list_changelogs.setSelection((int) 0);<NEW_LINE>}<NEW_LINE>Animation animation;<NEW_LINE>animation = AnimationUtils.loadAnimation(getApplicationContext(), <MASK><NEW_LINE>animation.setDuration(300);<NEW_LINE>list_changelogs.startAnimation(animation);<NEW_LINE>animation = null;<NEW_LINE>} catch (Exception e) {<NEW_LINE>}<NEW_LINE>} | android.R.anim.slide_in_left); |
1,083,298 | private static void tryAssertionSubqueryNW(RegressionEnvironment env) {<NEW_LINE>String[] fields = new String[] { "theString", "intPrimitive", "val0" };<NEW_LINE>env.sendEventBean(new SupportBean_S0(10, "s1"));<NEW_LINE>env.sendEventBean(new SupportBean("G1", 10));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { "G1", 10, "s1" });<NEW_LINE>env.milestone(0);<NEW_LINE>env.sendEventBean(new SupportBean("G2", 10));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { "G2", 10, "s1" });<NEW_LINE>env.sendEventBean(new SupportBean("G3", 20));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { "G3", 20, null });<NEW_LINE>env.milestone(1);<NEW_LINE>env.sendEventBean(new SupportBean_S0(20, "s2"));<NEW_LINE>env.sendEventBean(new SupportBean("G3", 20));<NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { "G3", 20, "s2" });<NEW_LINE>env.sendEventBean(<MASK><NEW_LINE>env.assertPropsNew("s0", fields, new Object[] { "G1", 20, "s2" });<NEW_LINE>} | new SupportBean("G1", 20)); |
1,115,710 | public com.amazonaws.services.config.model.RemediationInProgressException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.config.model.RemediationInProgressException remediationInProgressException = new com.amazonaws.services.config.model.RemediationInProgressException(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 remediationInProgressException;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
1,711,611 | private String parse(String text, PO po) {<NEW_LINE>if (text == null)<NEW_LINE>return "";<NEW_LINE>if (text.indexOf('@') == -1)<NEW_LINE>return text;<NEW_LINE>String inStr = text;<NEW_LINE>String token;<NEW_LINE>StringBuffer outStr = new StringBuffer();<NEW_LINE>int i = inStr.indexOf('@');<NEW_LINE>while (i != -1) {<NEW_LINE>// up to @<NEW_LINE>outStr.append(inStr.substring(0, i));<NEW_LINE>// from first @<NEW_LINE>inStr = inStr.substring(i + 1, inStr.length());<NEW_LINE>// next @<NEW_LINE>int j = inStr.indexOf('@');<NEW_LINE>if (// no second tag<NEW_LINE>j < 0) {<NEW_LINE>inStr = "@" + inStr;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>token = inStr.substring(0, j);<NEW_LINE>String value = "";<NEW_LINE>StringTokenizer completeToken <MASK><NEW_LINE>if (completeToken.hasMoreElements()) {<NEW_LINE>String tableName = completeToken.nextToken();<NEW_LINE>String columnName = token.replaceAll(tableName, "").replace(".", "");<NEW_LINE>if (!Util.isEmpty(tableName)) {<NEW_LINE>value = parseVariable(columnName, entityMap.get(tableName));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// for PO<NEW_LINE>if (Util.isEmpty(value) && po != null) {<NEW_LINE>// replace context<NEW_LINE>value = parseVariable(token, po);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// For all entries<NEW_LINE>if (Util.isEmpty(value)) {<NEW_LINE>value = parseVariable(token);<NEW_LINE>}<NEW_LINE>//<NEW_LINE>outStr.append(value);<NEW_LINE>// from second @<NEW_LINE>inStr = inStr.substring(j + 1, inStr.length());<NEW_LINE>i = inStr.indexOf('@');<NEW_LINE>}<NEW_LINE>// add remainder<NEW_LINE>outStr.append(inStr);<NEW_LINE>return outStr.toString();<NEW_LINE>} | = new StringTokenizer(token, "."); |
256,001 | public AwsEc2NetworkInterfaceSecurityGroup unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>AwsEc2NetworkInterfaceSecurityGroup awsEc2NetworkInterfaceSecurityGroup = new AwsEc2NetworkInterfaceSecurityGroup();<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE><MASK><NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return 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("GroupName", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>awsEc2NetworkInterfaceSecurityGroup.setGroupName(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("GroupId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>awsEc2NetworkInterfaceSecurityGroup.setGroupId(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 awsEc2NetworkInterfaceSecurityGroup;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
1,755,810 | public void onMessage(Session session, String message) {<NEW_LINE>if (!session.equals(this.session)) {<NEW_LINE>handleWrongSession(session, message);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>logger.<MASK><NEW_LINE>try {<NEW_LINE>DeconzBaseMessage changedMessage = Objects.requireNonNull(gson.fromJson(message, DeconzBaseMessage.class));<NEW_LINE>if (changedMessage.r == ResourceType.UNKNOWN) {<NEW_LINE>logger.trace("Received message has unknown resource type. Skipping message.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>WebSocketMessageListener listener = listeners.get(getListenerId(changedMessage.r, changedMessage.id));<NEW_LINE>if (listener == null) {<NEW_LINE>logger.trace("Couldn't find listener for id {} with resource type {}. Either no thing for this id has been defined or this is a bug.", changedMessage.id, changedMessage.r);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Class<? extends DeconzBaseMessage> expectedMessageType = changedMessage.r.getExpectedMessageType();<NEW_LINE>if (expectedMessageType == null) {<NEW_LINE>logger.warn("BUG! Could not get expected message type for resource type {}. Please report this incident.", changedMessage.r);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>DeconzBaseMessage deconzMessage = gson.fromJson(message, expectedMessageType);<NEW_LINE>if (deconzMessage != null) {<NEW_LINE>listener.messageReceived(changedMessage.id, deconzMessage);<NEW_LINE>}<NEW_LINE>} catch (RuntimeException e) {<NEW_LINE>// we need to catch all processing exceptions, otherwise they could affect the connection<NEW_LINE>logger.warn("{} encountered an error while processing the message {}: {}", socketName, message, e.getMessage());<NEW_LINE>}<NEW_LINE>} | trace("{} received raw data: {}", socketName, message); |
476,629 | public DruidFilter deserialize(JsonParser jp, DeserializationContext context) throws IOException {<NEW_LINE>ObjectMapper mapper = (ObjectMapper) jp.getCodec();<NEW_LINE>ObjectNode root = mapper.readTree(jp);<NEW_LINE>boolean filterKnowsItsType = root.has("type");<NEW_LINE>if (filterKnowsItsType) {<NEW_LINE>DruidCompareOp type = DruidCompareOp.get(root.get("type").asText());<NEW_LINE>switch(type) {<NEW_LINE>case TYPE_SELECTOR:<NEW_LINE>{<NEW_LINE>return mapper.readValue(root.toString(), DruidSelectorFilter.class);<NEW_LINE>}<NEW_LINE>case TYPE_BOUND:<NEW_LINE>{<NEW_LINE>return mapper.readValue(root.toString(), DruidBoundFilter.class);<NEW_LINE>}<NEW_LINE>case TYPE_IN:<NEW_LINE>{<NEW_LINE>return mapper.readValue(root.toString(), DruidInFilter.class);<NEW_LINE>}<NEW_LINE>case TYPE_REGEX:<NEW_LINE>{<NEW_LINE>return mapper.readValue(root.toString(), DruidRegexFilter.class);<NEW_LINE>}<NEW_LINE>case TYPE_SEARCH:<NEW_LINE>{<NEW_LINE>return mapper.readValue(root.toString(), DruidSearchFilter.class);<NEW_LINE>}<NEW_LINE>case AND:<NEW_LINE>{<NEW_LINE>return mapper.readValue(root.<MASK><NEW_LINE>}<NEW_LINE>case OR:<NEW_LINE>{<NEW_LINE>return mapper.readValue(root.toString(), DruidOrFilter.class);<NEW_LINE>}<NEW_LINE>case NOT:<NEW_LINE>{<NEW_LINE>return mapper.readValue(root.toString(), DruidNotFilter.class);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (filterKnowsItsType && root.get("type").asText().equals(TYPE_SELECTOR.getCompareOp())) {<NEW_LINE>return mapper.readValue(root.toString(), DruidSelectorFilter.class);<NEW_LINE>}<NEW_LINE>return mapper.readValue(root.toString(), DruidSelectorFilter.class);<NEW_LINE>} | toString(), DruidAndFilter.class); |
1,678,513 | final ReadPresetResult executeReadPreset(ReadPresetRequest readPresetRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(readPresetRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ReadPresetRequest> request = null;<NEW_LINE>Response<ReadPresetResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ReadPresetRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(readPresetRequest));<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, "Elastic Transcoder");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ReadPreset");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ReadPresetResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ReadPresetResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.endEvent(Field.RequestMarshallTime); |
1,745,737 | public void adjust(ByteBuf dataBuf, int numInputs, int numOutputs) {<NEW_LINE>// used to accumulate the updates for input vectors<NEW_LINE>float[] neu1e = new float[dim];<NEW_LINE>float[] inputUpdates = new float[numInputs * dim];<NEW_LINE>Int2IntOpenHashMap inputIndex = new Int2IntOpenHashMap();<NEW_LINE>Int2IntOpenHashMap inputUpdateCounter = new Int2IntOpenHashMap();<NEW_LINE>Random negativeSeed = new Random(seed);<NEW_LINE>int batchSize = dataBuf.readInt();<NEW_LINE>for (int position = 0; position < batchSize; position++) {<NEW_LINE>int src = dataBuf.readInt();<NEW_LINE>int dst = dataBuf.readInt();<NEW_LINE>float[] inputs = layers[src / numNodeOneRow];<NEW_LINE>int l1 = (src % numNodeOneRow) * dim;<NEW_LINE>Arrays.fill(neu1e, 0);<NEW_LINE>// Negative sampling<NEW_LINE>int target;<NEW_LINE>for (int d = 0; d < negative + 1; d++) {<NEW_LINE>if (d == 0)<NEW_LINE>target = dst;<NEW_LINE>else<NEW_LINE>do {<NEW_LINE>target = negativeSeed.nextInt(maxIndex);<NEW_LINE>} while (target == src);<NEW_LINE>float[] outputs = layers[target / numNodeOneRow];<NEW_LINE>int l2 = (target % numNodeOneRow) * dim;<NEW_LINE>float g = dataBuf.readFloat();<NEW_LINE>// accumulate for the hidden layer<NEW_LINE>for (int a = 0; a < dim; a++) neu1e[a] += g * outputs[a + l2];<NEW_LINE>// update output layer<NEW_LINE>merge(inputUpdates, inputIndex, target, inputs, g, l1);<NEW_LINE>inputUpdateCounter.addTo(target, 1);<NEW_LINE>}<NEW_LINE>// update the hidden layer<NEW_LINE>merge(inputUpdates, inputIndex, src, neu1e, 1, 0);<NEW_LINE>inputUpdateCounter.addTo(src, 1);<NEW_LINE>}<NEW_LINE>// update input<NEW_LINE>ObjectIterator<Int2IntMap.Entry> it = inputIndex.int2IntEntrySet().fastIterator();<NEW_LINE>while (it.hasNext()) {<NEW_LINE>Int2IntMap.Entry entry = it.next();<NEW_LINE>int node = entry.getIntKey();<NEW_LINE>int offset <MASK><NEW_LINE>int divider = inputUpdateCounter.get(node);<NEW_LINE>int col = (node % numNodeOneRow) * dim;<NEW_LINE>float[] values = layers[node / numNodeOneRow];<NEW_LINE>for (int a = 0; a < dim; a++) values[a + col] += inputUpdates[offset + a] / divider;<NEW_LINE>}<NEW_LINE>} | = entry.getIntValue() * dim; |
1,807,130 | public void marshall(DocumentVersionMetadata documentVersionMetadata, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (documentVersionMetadata == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(documentVersionMetadata.getId(), ID_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentVersionMetadata.getName(), NAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentVersionMetadata.getContentType(), CONTENTTYPE_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentVersionMetadata.getSize(), SIZE_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentVersionMetadata.getSignature(), SIGNATURE_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentVersionMetadata.getStatus(), STATUS_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentVersionMetadata.getCreatedTimestamp(), CREATEDTIMESTAMP_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(documentVersionMetadata.getContentCreatedTimestamp(), CONTENTCREATEDTIMESTAMP_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentVersionMetadata.getContentModifiedTimestamp(), CONTENTMODIFIEDTIMESTAMP_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentVersionMetadata.getCreatorId(), CREATORID_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentVersionMetadata.getThumbnail(), THUMBNAIL_BINDING);<NEW_LINE>protocolMarshaller.marshall(documentVersionMetadata.getSource(), SOURCE_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | documentVersionMetadata.getModifiedTimestamp(), MODIFIEDTIMESTAMP_BINDING); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.