idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
238,040 | private CheckPoints httpCheckpoints(Application application, FlinkCluster flinkCluster) throws IOException {<NEW_LINE>final String flinkUrl = "jobs/%s/checkpoints";<NEW_LINE>ExecutionMode execMode = application.getExecutionModeEnum();<NEW_LINE>if (ExecutionMode.YARN_PER_JOB.equals(execMode) || ExecutionMode.YARN_APPLICATION.equals(execMode)) {<NEW_LINE>String reqURL;<NEW_LINE>if (StringUtils.isEmpty(application.getJobManagerUrl())) {<NEW_LINE>String format = "proxy/%s/" + flinkUrl;<NEW_LINE>reqURL = String.format(format, application.getAppId(), application.getJobId());<NEW_LINE>} else {<NEW_LINE>String format = "%s/" + flinkUrl;<NEW_LINE>reqURL = String.format(format, application.getJobManagerUrl(), application.getJobId());<NEW_LINE>}<NEW_LINE>return <MASK><NEW_LINE>} else if (ExecutionMode.REMOTE.equals(execMode) || ExecutionMode.YARN_SESSION.equals(execMode)) {<NEW_LINE>if (application.getJobId() != null) {<NEW_LINE>String remoteUrl = flinkCluster.getActiveAddress().toURL() + "/" + String.format(flinkUrl, application.getJobId());<NEW_LINE>return httpRestRequest(remoteUrl, CheckPoints.class);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | yarnRestRequest(reqURL, CheckPoints.class); |
201,548 | public boolean onInterceptTouchEvent(final MotionEvent me) {<NEW_LINE>// Detecting sliding up finger to show {@link MoreSuggestionsView}.<NEW_LINE>if (!mMoreSuggestionsView.isShowingInParent()) {<NEW_LINE>mLastX = (int) me.getX();<NEW_LINE>mLastY = (int) me.getY();<NEW_LINE>return mMoreSuggestionsSlidingDetector.onTouchEvent(me);<NEW_LINE>}<NEW_LINE>if (mMoreSuggestionsView.isInModalMode()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>final <MASK><NEW_LINE>final int index = me.getActionIndex();<NEW_LINE>final int x = (int) me.getX(index);<NEW_LINE>final int y = (int) me.getY(index);<NEW_LINE>if (Math.abs(x - mOriginX) >= mMoreSuggestionsModalTolerance || mOriginY - y >= mMoreSuggestionsModalTolerance) {<NEW_LINE>// Decided to be in the sliding suggestion mode only when the touch point has been moved<NEW_LINE>// upward. Further {@link MotionEvent}s will be delivered to<NEW_LINE>// {@link #onTouchEvent(MotionEvent)}.<NEW_LINE>mNeedsToTransformTouchEventToHoverEvent = AccessibilityUtils.Companion.getInstance().isTouchExplorationEnabled();<NEW_LINE>mIsDispatchingHoverEventToMoreSuggestions = false;<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_POINTER_UP) {<NEW_LINE>// Decided to be in the modal input mode.<NEW_LINE>mMoreSuggestionsView.setModalMode();<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | int action = me.getAction(); |
1,741,230 | protected String[] customCommandLineValidation() {<NEW_LINE>final List<String> <MASK><NEW_LINE>if (CROSSCHECK_BY != CrosscheckMetric.DataType.READGROUP) {<NEW_LINE>errors.add("When calling CrosscheckReadGroupFingerprints, please refrain from supplying a CROSSCHECK_BY argument. " + "(Found value " + CROSSCHECK_BY + "\n" + "Use CrosscheckFingerprints if you would like to do that.");<NEW_LINE>}<NEW_LINE>if (MATRIX_OUTPUT != null) {<NEW_LINE>errors.add("When calling CrosscheckReadGroupFingerprints, please refrain from supplying a MATRIX_OUTPUT argument.\n" + "(Found value " + MATRIX_OUTPUT + "\n" + "Use CrosscheckFingerprints if you would like to do that.");<NEW_LINE>}<NEW_LINE>if (!SECOND_INPUT.isEmpty()) {<NEW_LINE>errors.add("When calling CrosscheckReadGroupFingerprints, please refrain from supplying a SECOND_INPUT argument.\n" + "(Found value " + SECOND_INPUT + "\n" + "Use CrosscheckFingerprints if you would like to do that.");<NEW_LINE>}<NEW_LINE>if (!errors.isEmpty()) {<NEW_LINE>return errors.toArray(new String[errors.size()]);<NEW_LINE>} else {<NEW_LINE>return super.customCommandLineValidation();<NEW_LINE>}<NEW_LINE>} | errors = new ArrayList<>(); |
1,262,447 | private boolean parseTileSourceIntent() {<NEW_LINE>Intent intent = mapActivity.getIntent();<NEW_LINE>if (intent != null && intent.getData() != null) {<NEW_LINE>Uri data = intent.getData();<NEW_LINE>if (("http".equalsIgnoreCase(data.getScheme()) || "https".equalsIgnoreCase(data.getScheme())) && data.getHost() != null && data.getHost().contains("osmand.net") && data.getPath() != null && data.getPath().startsWith("/add-tile-source")) {<NEW_LINE>Map<String, String> attrs = new HashMap<>();<NEW_LINE>for (String name : data.getQueryParameterNames()) {<NEW_LINE>String value = data.getQueryParameter(name);<NEW_LINE>if (value != null) {<NEW_LINE>attrs.put(name, value);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!attrs.isEmpty()) {<NEW_LINE>try {<NEW_LINE>TileSourceManager.TileSourceTemplate r = TileSourceManager.createTileSourceTemplate(attrs);<NEW_LINE>if (r != null) {<NEW_LINE>EditMapSourceDialogFragment.showInstance(<MASK><NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.error("parseAddTileSourceIntent error", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>mapActivity.setIntent(null);<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | mapActivity.getSupportFragmentManager(), r); |
137,615 | private Object executeRxJava2Aspect(RateLimiterOperator rateLimiterOperator, Object returnValue) {<NEW_LINE>if (returnValue instanceof ObservableSource) {<NEW_LINE>Observable<?> observable = (Observable) returnValue;<NEW_LINE>return observable.compose(rateLimiterOperator);<NEW_LINE>} else if (returnValue instanceof SingleSource) {<NEW_LINE>Single<?> single = (Single) returnValue;<NEW_LINE>return single.compose(rateLimiterOperator);<NEW_LINE>} else if (returnValue instanceof CompletableSource) {<NEW_LINE>Completable completable = (Completable) returnValue;<NEW_LINE>return completable.compose(rateLimiterOperator);<NEW_LINE>} else if (returnValue instanceof MaybeSource) {<NEW_LINE>Maybe<?> maybe = (Maybe) returnValue;<NEW_LINE>return maybe.compose(rateLimiterOperator);<NEW_LINE>} else if (returnValue instanceof Flowable) {<NEW_LINE>Flowable<?> flowable = (Flowable) returnValue;<NEW_LINE>return flowable.compose(rateLimiterOperator);<NEW_LINE>} else {<NEW_LINE>logger.error("Unsupported type for Rate limiter RxJava2 {}", returnValue.<MASK><NEW_LINE>throw new IllegalArgumentException("Not Supported type for the Rate limiter in RxJava2 :" + returnValue.getClass().getName());<NEW_LINE>}<NEW_LINE>} | getClass().getTypeName()); |
1,345,586 | private MultiContainsResult processMultiContainsHttpResponse(HttpResponse httpResponse, List<RuleKey> ruleKeys) throws IOException {<NEW_LINE>ImmutableMultiContainsResult.Builder resultBuilder = ImmutableMultiContainsResult.builder();<NEW_LINE>if (httpResponse.statusCode() != 200) {<NEW_LINE>LOG.warn(String.format("Failed to multi-contains request for [%d] cache artifacts " + "with HTTP status code [%d:%s] to url [%s].", ruleKeys.size(), httpResponse.statusCode(), httpResponse.statusMessage(), httpResponse.requestUrl()));<NEW_LINE>Function<RuleKey, CacheResult> genErrorResult = ruleKey -> CacheResult.error(getName(), getMode(), String.format("Failed to check cache artifact (via multi-contains request) " + "with HTTP status code [%d:%s] to url [%s] for rule key [%s].", httpResponse.statusCode(), httpResponse.statusMessage(), httpResponse.requestUrl(), ruleKey.toString()));<NEW_LINE>return resultBuilder.setCacheResults(Maps.toMap(ruleKeys, genErrorResult::apply)).build();<NEW_LINE>}<NEW_LINE>try (ThriftArtifactCacheProtocol.Response response = ThriftArtifactCacheProtocol.parseResponse(PROTOCOL, httpResponse.getBody())) {<NEW_LINE>resultBuilder.setResponseSizeBytes(httpResponse.contentLength());<NEW_LINE>BuckCacheResponse cacheResponse = response.getThriftData();<NEW_LINE>if (!cacheResponse.isWasSuccessful()) {<NEW_LINE>LOG.warn(<MASK><NEW_LINE>Function<RuleKey, CacheResult> genErrorResult = k -> CacheResult.error(getName(), getMode(), cacheResponse.getErrorMessage());<NEW_LINE>return resultBuilder.setCacheResults(Maps.toMap(ruleKeys, genErrorResult::apply)).build();<NEW_LINE>}<NEW_LINE>BuckCacheMultiContainsResponse containsResponse = cacheResponse.getMultiContainsResponse();<NEW_LINE>Preconditions.checkState(containsResponse.results.size() == ruleKeys.size(), "Bad response from server. MultiContains Response does not have the " + "same number of results as the MultiContains Request.");<NEW_LINE>for (int i = 0; i < containsResponse.results.size(); ++i) {<NEW_LINE>processContainsResult(ruleKeys.get(i), containsResponse.results.get(i), resultBuilder);<NEW_LINE>}<NEW_LINE>return resultBuilder.build();<NEW_LINE>}<NEW_LINE>} | "Request was unsuccessful: %s", cacheResponse.getErrorMessage()); |
1,017,244 | T jsonRead(SpiJsonReader jsonRead, String path, boolean withInheritance, T target) throws IOException {<NEW_LINE>JsonParser parser = jsonRead.getParser();<NEW_LINE>// noinspection StatementWithEmptyBody<NEW_LINE>if (parser.getCurrentToken() == JsonToken.START_OBJECT) {<NEW_LINE>// start object token read by Jackson already<NEW_LINE>} else {<NEW_LINE>// check for null or start object<NEW_LINE>JsonToken token = parser.nextToken();<NEW_LINE>if (JsonToken.VALUE_NULL == token || JsonToken.END_ARRAY == token) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (JsonToken.START_OBJECT != token) {<NEW_LINE>throw new JsonParseException(parser, "Unexpected token " + token + <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (desc.inheritInfo == null || !withInheritance) {<NEW_LINE>return jsonReadObject(jsonRead, path, target);<NEW_LINE>}<NEW_LINE>ObjectNode node = jsonRead.getObjectMapper().readTree(parser);<NEW_LINE>if (node.isNull()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>JsonParser newParser = node.traverse();<NEW_LINE>SpiJsonReader newReader = jsonRead.forJson(newParser);<NEW_LINE>// check for the discriminator value to determine the correct sub type<NEW_LINE>String discColumn = inheritInfo.getRoot().getDiscriminatorColumn();<NEW_LINE>JsonNode discNode = node.get(discColumn);<NEW_LINE>if (discNode == null || discNode.isNull()) {<NEW_LINE>if (!desc.isAbstractType()) {<NEW_LINE>return desc.jsonReadObject(newReader, path, target);<NEW_LINE>}<NEW_LINE>String msg = "Error reading inheritance discriminator - expected [" + discColumn + "] but no json key?";<NEW_LINE>throw new JsonParseException(newParser, msg, parser.getCurrentLocation());<NEW_LINE>}<NEW_LINE>BeanDescriptor<T> inheritDesc = (BeanDescriptor<T>) inheritInfo.readType(discNode.asText()).desc();<NEW_LINE>return inheritDesc.jsonReadObject(newReader, path, target);<NEW_LINE>} | " - expecting start_object", parser.getCurrentLocation()); |
1,647,120 | void checkAgainstInheritedMethods(MethodBinding currentMethod, MethodBinding[] methods, int length, MethodBinding[] allInheritedMethods) {<NEW_LINE>super.checkAgainstInheritedMethods(currentMethod, methods, length, allInheritedMethods);<NEW_LINE><MASK><NEW_LINE>if (options.isAnnotationBasedNullAnalysisEnabled && (currentMethod.tagBits & TagBits.IsNullnessKnown) == 0) {<NEW_LINE>// if annotations are inherited these have been checked during STB.resolveTypesFor() (for methods explicit in this.type)<NEW_LINE>AbstractMethodDeclaration srcMethod = null;<NEW_LINE>if (// is currentMethod from the current type?<NEW_LINE>this.type.equals(currentMethod.declaringClass))<NEW_LINE>srcMethod = currentMethod.sourceMethod();<NEW_LINE>boolean hasReturnNonNullDefault = currentMethod.hasNonNullDefaultForReturnType(srcMethod);<NEW_LINE>ParameterNonNullDefaultProvider hasParameterNonNullDefault = currentMethod.hasNonNullDefaultForParameter(srcMethod);<NEW_LINE>for (int i = length; --i >= 0; ) if (!currentMethod.isStatic() && !methods[i].isStatic())<NEW_LINE>checkNullSpecInheritance(currentMethod, srcMethod, hasReturnNonNullDefault, hasParameterNonNullDefault, true, methods[i], methods, this.type.scope, null);<NEW_LINE>}<NEW_LINE>} | CompilerOptions options = this.environment.globalOptions; |
861,023 | private void placePostCompileAndDontMakeForceRoundDummiesHook() {<NEW_LINE>stopJavacProcessingEnvironmentFromClosingOurClassloader();<NEW_LINE>forceMultipleRoundsInNetBeansEditor();<NEW_LINE>Context context = javacProcessingEnv.getContext();<NEW_LINE>disablePartialReparseInNetBeansEditor(context);<NEW_LINE>try {<NEW_LINE>Method keyMethod = Permit.getMethod(Context.class, "key", Class.class);<NEW_LINE>Object key = Permit.invoke(keyMethod, context, JavaFileManager.class);<NEW_LINE>Field htField = Permit.<MASK><NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>Map<Object, Object> ht = (Map<Object, Object>) Permit.get(htField, context);<NEW_LINE>final JavaFileManager originalFiler = (JavaFileManager) ht.get(key);<NEW_LINE>if (!(originalFiler instanceof InterceptingJavaFileManager)) {<NEW_LINE>final Messager messager = processingEnv.getMessager();<NEW_LINE>DiagnosticsReceiver receiver = new MessagerDiagnosticsReceiver(messager);<NEW_LINE>JavaFileManager newFilerManager = new InterceptingJavaFileManager(originalFiler, receiver);<NEW_LINE>ht.put(key, newFilerManager);<NEW_LINE>Field filerFileManagerField = Permit.getField(JavacFiler.class, "fileManager");<NEW_LINE>filerFileManagerField.set(javacFiler, newFilerManager);<NEW_LINE>if (lombok.javac.Javac.getJavaCompilerVersion() > 8 && !lombok.javac.handlers.JavacHandlerUtil.inNetbeansCompileOnSave(context)) {<NEW_LINE>replaceFileManagerJdk9(context, newFilerManager);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw Lombok.sneakyThrow(e);<NEW_LINE>}<NEW_LINE>} | getField(Context.class, "ht"); |
1,850,373 | private TScanRangeLocations newLocations(TBrokerScanRangeParams params, String brokerName) throws UserException {<NEW_LINE>Backend selectedBackend = backends.get(nextBe++);<NEW_LINE>nextBe = nextBe % backends.size();<NEW_LINE>// Generate on broker scan range<NEW_LINE>TBrokerScanRange brokerScanRange = new TBrokerScanRange();<NEW_LINE>brokerScanRange.setParams(params);<NEW_LINE>FsBroker broker = null;<NEW_LINE>try {<NEW_LINE>broker = Catalog.getCurrentCatalog().getBrokerMgr().getBroker(brokerName, selectedBackend.getHost());<NEW_LINE>} catch (AnalysisException e) {<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>brokerScanRange.addToBroker_addresses(new TNetworkAddress(broker.ip, broker.port));<NEW_LINE>// Scan range<NEW_LINE>TScanRange scanRange = new TScanRange();<NEW_LINE>scanRange.setBroker_scan_range(brokerScanRange);<NEW_LINE>// Locations<NEW_LINE>TScanRangeLocations locations = new TScanRangeLocations();<NEW_LINE>locations.setScan_range(scanRange);<NEW_LINE>TScanRangeLocation location = new TScanRangeLocation();<NEW_LINE>location.setBackend_id(selectedBackend.getId());<NEW_LINE>location.setServer(new TNetworkAddress(selectedBackend.getHost(), selectedBackend.getBePort()));<NEW_LINE>locations.addToLocations(location);<NEW_LINE>return locations;<NEW_LINE>} | UserException(e.getMessage()); |
239,937 | private void indexExperimentsToUser(List<Pair<Experiment, Assignment>> assignments) {<NEW_LINE>try {<NEW_LINE>Session session = driver.getSession();<NEW_LINE>final BatchStatement batchStatement = new BatchStatement(BatchStatement.Type.UNLOGGED);<NEW_LINE>assignments.forEach(pair -> {<NEW_LINE>Assignment assignment = pair.getRight();<NEW_LINE>LOGGER.debug("assignment={}", assignment);<NEW_LINE>BoundStatement bs;<NEW_LINE>if (isNull(assignment.getBucketLabel())) {<NEW_LINE>bs = experimentUserIndexAccessor.insertBoundStatement(assignment.getUserID().toString(), assignment.getContext().toString(), assignment.getApplicationName().toString(), assignment.getExperimentID().getRawID());<NEW_LINE>} else {<NEW_LINE>bs = experimentUserIndexAccessor.insertBoundStatement(assignment.getUserID().toString(), assignment.getContext().toString(), assignment.getApplicationName().toString(), assignment.getExperimentID().getRawID(), assignment.<MASK><NEW_LINE>}<NEW_LINE>batchStatement.add(bs);<NEW_LINE>});<NEW_LINE>session.execute(batchStatement);<NEW_LINE>LOGGER.debug("Finished experiment_user_index");<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error("Error occurred while adding data in to experiment_user_index", e);<NEW_LINE>}<NEW_LINE>} | getBucketLabel().toString()); |
1,427,432 | final ModifyDBClusterParameterGroupResult executeModifyDBClusterParameterGroup(ModifyDBClusterParameterGroupRequest modifyDBClusterParameterGroupRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(modifyDBClusterParameterGroupRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ModifyDBClusterParameterGroupRequest> request = null;<NEW_LINE>Response<ModifyDBClusterParameterGroupResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ModifyDBClusterParameterGroupRequestMarshaller().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, "DocDB");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ModifyDBClusterParameterGroup");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<ModifyDBClusterParameterGroupResult> responseHandler = new StaxResponseHandler<ModifyDBClusterParameterGroupResult>(new ModifyDBClusterParameterGroupResultStaxUnmarshaller());<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(modifyDBClusterParameterGroupRequest)); |
1,569,929 | public boolean showLookup() {<NEW_LINE>ApplicationManager.getApplication().assertIsDispatchThread();<NEW_LINE>checkValid();<NEW_LINE>LOG.assertTrue(!myShown);<NEW_LINE>myShown = true;<NEW_LINE>myStampShown = System.currentTimeMillis();<NEW_LINE>fireLookupShown();<NEW_LINE>if (ApplicationManager.getApplication().isHeadlessEnvironment())<NEW_LINE>return true;<NEW_LINE>if (!myEditor.getContentComponent().isShowing()) {<NEW_LINE>hideLookup(false);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>myAdComponent.showRandomText();<NEW_LINE>if (Boolean.TRUE.equals(myEditor.getUserData(AutoPopupController.NO_ADS))) {<NEW_LINE>myAdComponent.clearAdvertisements();<NEW_LINE>}<NEW_LINE>// , myProject);<NEW_LINE>myUi = new LookupUi(this, myAdComponent, myList);<NEW_LINE>myUi.setCalculating(myCalculating);<NEW_LINE>Point p = myUi.calculatePosition().getLocation();<NEW_LINE>if (ScreenReader.isActive()) {<NEW_LINE>myList.setFocusable(true);<NEW_LINE>setFocusRequestor(myList);<NEW_LINE>AnActionEvent actionEvent = AnActionEvent.createFromDataContext(ActionPlaces.EDITOR_POPUP, null, ((DesktopEditorImpl) myEditor).getDataContext());<NEW_LINE>delegateActionToEditor(IdeActions.ACTION_EDITOR_BACKSPACE, null, actionEvent);<NEW_LINE>delegateActionToEditor(IdeActions.ACTION_EDITOR_ESCAPE, null, actionEvent);<NEW_LINE>delegateActionToEditor(IdeActions.ACTION_EDITOR_TAB, () -> new ChooseItemAction.Replacing(), actionEvent);<NEW_LINE>delegateActionToEditor(IdeActions.ACTION_EDITOR_ENTER, /* e.g. rename popup comes initially unfocused */<NEW_LINE>() -> getLookupFocusDegree() == LookupFocusDegree.UNFOCUSED ? new NextVariableAction() : new ChooseItemAction.FocusedOnly(), actionEvent);<NEW_LINE>delegateActionToEditor(IdeActions.ACTION_EDITOR_MOVE_CARET_UP, null, actionEvent);<NEW_LINE>delegateActionToEditor(IdeActions.ACTION_EDITOR_MOVE_CARET_DOWN, null, actionEvent);<NEW_LINE>delegateActionToEditor(IdeActions.ACTION_EDITOR_MOVE_CARET_RIGHT, null, actionEvent);<NEW_LINE>delegateActionToEditor(IdeActions.ACTION_EDITOR_MOVE_CARET_LEFT, null, actionEvent);<NEW_LINE>delegateActionToEditor(<MASK><NEW_LINE>}<NEW_LINE>try {<NEW_LINE>HintManagerImpl.getInstanceImpl().showEditorHint(this, myEditor, p, HintManager.HIDE_BY_ESCAPE | HintManager.UPDATE_BY_SCROLLING, 0, false, HintManagerImpl.createHintHint(myEditor, p, this, HintManager.UNDER).setRequestFocus(ScreenReader.isActive()).setAwtTooltip(false));<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.error(e);<NEW_LINE>}<NEW_LINE>if (!isVisible() || !myList.isShowing()) {<NEW_LINE>hideLookup(false);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | IdeActions.ACTION_RENAME, null, actionEvent); |
1,801,063 | public JSModuleRecord resolveImportedModule(ScriptOrModule referrer, ModuleRequest moduleRequest) {<NEW_LINE>Map<TruffleString, JSModuleRecord> referrerCache = cache.get(referrer);<NEW_LINE>TruffleString specifier = moduleRequest.getSpecifier();<NEW_LINE>if (referrerCache == null) {<NEW_LINE>referrerCache = new HashMap<>();<NEW_LINE>cache.put(referrer, referrerCache);<NEW_LINE>} else {<NEW_LINE>JSModuleRecord cached = referrerCache.get(specifier);<NEW_LINE>if (cached != null) {<NEW_LINE>return cached;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (resolver == 0) {<NEW_LINE>System.err.println("Cannot resolve module outside module instantiation!");<NEW_LINE>System.exit(1);<NEW_LINE>}<NEW_LINE>Object importAssertions = moduleRequestGetImportAssertionsImpl(moduleRequest, true);<NEW_LINE>JSRealm <MASK><NEW_LINE>JSModuleRecord result = (JSModuleRecord) NativeAccess.executeResolveCallback(resolver, realm, specifier, importAssertions, referrer);<NEW_LINE>referrerCache.put(specifier, result);<NEW_LINE>return result;<NEW_LINE>} | realm = JSRealm.get(null); |
448,864 | public StreamBucket collect(IntArrayList docIds) {<NEW_LINE>boolean collectSequential = isSequential(docIds);<NEW_LINE>StreamBucket.Builder builder = new StreamBucket.Builder(streamers, ramAccounting);<NEW_LINE>try (var borrowed = fetchTask.searcher(readerId)) {<NEW_LINE>var searcher = borrowed.item();<NEW_LINE>List<LeafReaderContext> leaves = searcher.getTopReaderContext().leaves();<NEW_LINE>var readerContexts = new IntObjectHashMap<ReaderContext>(leaves.size());<NEW_LINE>for (var cursor : docIds) {<NEW_LINE>int docId = cursor.value;<NEW_LINE>int readerIndex = readerIndex(docId, leaves);<NEW_LINE>LeafReaderContext subReaderContext = leaves.get(readerIndex);<NEW_LINE>try {<NEW_LINE>var readerContext = readerContexts.get(readerIndex);<NEW_LINE>if (readerContext == null) {<NEW_LINE>if (collectSequential) {<NEW_LINE>var storedFieldReader = sequentialStoredFieldReader(subReaderContext);<NEW_LINE>readerContext = new <MASK><NEW_LINE>} else {<NEW_LINE>readerContext = new ReaderContext(subReaderContext);<NEW_LINE>}<NEW_LINE>readerContexts.put(readerIndex, readerContext);<NEW_LINE>}<NEW_LINE>setNextDocId(readerContext, docId - subReaderContext.docBase);<NEW_LINE>} catch (IOException e) {<NEW_LINE>Exceptions.rethrowRuntimeException(e);<NEW_LINE>}<NEW_LINE>builder.add(row);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return builder.build();<NEW_LINE>} | ReaderContext(subReaderContext, storedFieldReader::visitDocument); |
187,881 | public static List<ErrorDescription> deadBranch(HintContext ctx) {<NEW_LINE>String deadBranchLabel = NbBundle.getMessage(UnusedAssignmentOrBranch.class, "LBL_DEAD_BRANCH");<NEW_LINE>FlowResult <MASK><NEW_LINE>if (flow == null)<NEW_LINE>return null;<NEW_LINE>List<ErrorDescription> result = new ArrayList<ErrorDescription>();<NEW_LINE>Set<? extends Tree> flowResult = flow.getDeadBranches();<NEW_LINE>IfTree it = (IfTree) ctx.getPath().getLeaf();<NEW_LINE>if (flowResult.contains(it.getThenStatement())) {<NEW_LINE>result.add(ErrorDescriptionFactory.forTree(ctx, it.getThenStatement(), deadBranchLabel));<NEW_LINE>}<NEW_LINE>Tree t = it.getElseStatement();<NEW_LINE>if (flowResult.contains(t)) {<NEW_LINE>result.add(ErrorDescriptionFactory.forTree(ctx, t, deadBranchLabel));<NEW_LINE>while (t != null && t.getKind() == Tree.Kind.IF) {<NEW_LINE>it = (IfTree) t;<NEW_LINE>t = it.getElseStatement();<NEW_LINE>result.add(ErrorDescriptionFactory.forTree(ctx, t, deadBranchLabel));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | flow = Flow.assignmentsForUse(ctx); |
1,176,579 | public Entity add(PersistencePackage persistencePackage, DynamicEntityDao dynamicEntityDao, RecordHelper helper) throws ServiceException {<NEW_LINE>final Tuple<Category, Category> parentAndChild = getChildAndParentCategories(persistencePackage, dynamicEntityDao);<NEW_LINE>final Category parent = parentAndChild.getFirst();<NEW_LINE>final <MASK><NEW_LINE>final CategoryXref categoryXref = createXref(parentAndChild);<NEW_LINE>if (parent.getAllChildCategoryXrefs().contains(categoryXref)) {<NEW_LINE>throw new ServiceException(BLCMessageUtils.getMessage(ADMIN_CANT_ADD_DUPLICATE_CHILD));<NEW_LINE>} else if (Objects.equals(child.getId(), parent.getId())) {<NEW_LINE>throw new ServiceException(BLCMessageUtils.getMessage(ADMIN_CANT_ADD_CATEGORY_AS_OWN_PARENT));<NEW_LINE>} else if (isChildAlreadyAnAncestor(child, parent)) {<NEW_LINE>throw new ServiceException(BLCMessageUtils.getMessage(ADMIN_CANT_ADD_ANCESTOR_AS_CHILD));<NEW_LINE>}<NEW_LINE>return helper.getCompatibleModule(OperationType.ADORNEDTARGETLIST).add(persistencePackage);<NEW_LINE>} | Category child = parentAndChild.getSecond(); |
1,532,158 | protected PageBook createPropertiesPanelTitle(Composite parent) {<NEW_LINE>GridLayout layout;<NEW_LINE>PageBook book = new PageBook(parent, SWT.NONE);<NEW_LINE>book.setFont(parent.getFont());<NEW_LINE>book.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));<NEW_LINE>titlePage = new Composite(book, SWT.NONE);<NEW_LINE>titlePage.setFont(book.getFont());<NEW_LINE>layout <MASK><NEW_LINE>layout.horizontalSpacing = 0;<NEW_LINE>layout.marginWidth = 0;<NEW_LINE>layout.marginHeight = 0;<NEW_LINE>layout.verticalSpacing = 0;<NEW_LINE>titlePage.setLayout(layout);<NEW_LINE>title = createSectionTitle(titlePage, PaletteMessages.NO_SELECTION_TITLE);<NEW_LINE>errorPage = new Composite(book, SWT.NONE);<NEW_LINE>errorPage.setFont(book.getFont());<NEW_LINE>layout = new GridLayout(1, false);<NEW_LINE>layout.horizontalSpacing = 0;<NEW_LINE>layout.marginWidth = 0;<NEW_LINE>layout.marginHeight = 0;<NEW_LINE>layout.verticalSpacing = 0;<NEW_LINE>errorPage.setLayout(layout);<NEW_LINE>Composite intermediary = new Composite(errorPage, SWT.NONE) {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Point computeSize(int wHint, int hHint, boolean changed) {<NEW_LINE>Rectangle bounds = title.getBounds();<NEW_LINE>return new Point(bounds.width, bounds.height);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>intermediary.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));<NEW_LINE>StackLayout stackLayout = new StackLayout();<NEW_LINE>intermediary.setLayout(stackLayout);<NEW_LINE>errorTitle = new MultiLineLabel(intermediary);<NEW_LINE>stackLayout.topControl = errorTitle;<NEW_LINE>errorTitle.setImage(JFaceResources.getImage(DLG_IMG_MESSAGE_ERROR));<NEW_LINE>errorTitle.setFont(errorPage.getFont());<NEW_LINE>Label separator = new Label(errorPage, SWT.SEPARATOR | SWT.HORIZONTAL);<NEW_LINE>separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));<NEW_LINE>book.showPage(titlePage);<NEW_LINE>return book;<NEW_LINE>} | = new GridLayout(2, false); |
633,364 | public byte[] serialize(ParserErrorCallback errorCallback, RootNode rootNode) {<NEW_LINE>Source source = rootNode.getSourceSection().getSource();<NEW_LINE>assert source != null;<NEW_LINE>CacheItem lastParserResult = cachedLastAntlrResult;<NEW_LINE>if (source != lastParserResult.source && !source.equals(lastParserResult.source)) {<NEW_LINE>// we need to parse the source again<NEW_LINE>PythonSSTNodeFactory sstFactory = new <MASK><NEW_LINE>lastParserResult = parseWithANTLR(ParserMode.File, 0, errorCallback, sstFactory, source, null, null);<NEW_LINE>}<NEW_LINE>if (rootNode instanceof ModuleRootNode) {<NEW_LINE>// serialize whole module<NEW_LINE>return serialize(rootNode.getSourceSection(), lastParserResult.antlrResult, lastParserResult.globalScope, true);<NEW_LINE>} else {<NEW_LINE>// serialize just the part<NEW_LINE>SSTNodeWithScopeFinder finder = new SSTNodeWithScopeFinder(rootNode.getSourceSection().getCharIndex(), rootNode.getSourceSection().getCharEndIndex());<NEW_LINE>SSTNodeWithScope rootSST = lastParserResult.antlrResult.accept(finder);<NEW_LINE>// store with parent scope<NEW_LINE>return serialize(rootNode.getSourceSection(), rootSST, rootSST.getScope().getParent(), false);<NEW_LINE>}<NEW_LINE>} | PythonSSTNodeFactory(errorCallback, source, this); |
1,392,744 | protected void loadTileLayer(TiledMap map, MapLayers parentLayers, Element element) {<NEW_LINE>if (element.getName().equals("layer")) {<NEW_LINE>int width = element.getIntAttribute("width", 0);<NEW_LINE>int height = element.getIntAttribute("height", 0);<NEW_LINE>int tileWidth = map.getProperties().get("tilewidth", Integer.class);<NEW_LINE>int tileHeight = map.getProperties().get("tileheight", Integer.class);<NEW_LINE>TiledMapTileLayer layer = new TiledMapTileLayer(width, height, tileWidth, tileHeight);<NEW_LINE>loadBasicLayerInfo(layer, element);<NEW_LINE>int[] ids = getTileIds(element, width, height);<NEW_LINE>TiledMapTileSets tilesets = map.getTileSets();<NEW_LINE>for (int y = 0; y < height; y++) {<NEW_LINE>for (int x = 0; x < width; x++) {<NEW_LINE>int id = ids[y * width + x];<NEW_LINE>boolean flipHorizontally = ((id & FLAG_FLIP_HORIZONTALLY) != 0);<NEW_LINE>boolean flipVertically = ((id & FLAG_FLIP_VERTICALLY) != 0);<NEW_LINE>boolean flipDiagonally = ((id & FLAG_FLIP_DIAGONALLY) != 0);<NEW_LINE>TiledMapTile tile = tilesets.getTile(id & ~MASK_CLEAR);<NEW_LINE>if (tile != null) {<NEW_LINE>Cell cell = <MASK><NEW_LINE>cell.setTile(tile);<NEW_LINE>layer.setCell(x, flipY ? height - 1 - y : y, cell);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Element properties = element.getChildByName("properties");<NEW_LINE>if (properties != null) {<NEW_LINE>loadProperties(layer.getProperties(), properties);<NEW_LINE>}<NEW_LINE>parentLayers.add(layer);<NEW_LINE>}<NEW_LINE>} | createTileLayerCell(flipHorizontally, flipVertically, flipDiagonally); |
1,351,671 | private boolean parseProxyLine(String line) throws ProtocolException {<NEW_LINE>// PROXY TCP4 255.255.255.255 255.255.255.255 65535 65535\r\n<NEW_LINE>if (!line.startsWith("PROXY ")) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>final Matcher m = PROXY_PATTERN.matcher(line);<NEW_LINE>if (!m.matches()) {<NEW_LINE>throw new ProtocolException("Unsupported or malformed proxy header: " + line);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>final InetAddress clientAddr = InetAddress.getByName(m.group(1));<NEW_LINE>final InetAddress proxyAddr = InetAddress.getByName<MASK><NEW_LINE>final int clientPort = Integer.parseInt(m.group(3), 10);<NEW_LINE>final int proxyPort = Integer.parseInt(m.group(4), 10);<NEW_LINE>if (((clientPort | proxyPort) & ~0xffff) != 0) {<NEW_LINE>throw new ProtocolException("Invalid port number: " + line);<NEW_LINE>}<NEW_LINE>xForwardedFor = clientAddr.getHostAddress();<NEW_LINE>if (proxyPort == 80) {<NEW_LINE>xForwardedProto = "http";<NEW_LINE>} else if (proxyPort == 443) {<NEW_LINE>xForwardedProto = "https";<NEW_LINE>}<NEW_LINE>xForwardedPort = proxyPort;<NEW_LINE>return true;<NEW_LINE>} catch (NumberFormatException ex) {<NEW_LINE>throw new ProtocolException("Malformed port in: " + line);<NEW_LINE>} catch (UnknownHostException ex) {<NEW_LINE>throw new ProtocolException("Malformed address in: " + line);<NEW_LINE>}<NEW_LINE>} | (m.group(2)); |
182,987 | public ResolveCustomerResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ResolveCustomerResult resolveCustomerResult = new ResolveCustomerResult();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return resolveCustomerResult;<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("CustomerIdentifier", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>resolveCustomerResult.setCustomerIdentifier(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("ProductCode", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>resolveCustomerResult.setProductCode(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("CustomerAWSAccountId", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>resolveCustomerResult.setCustomerAWSAccountId(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 resolveCustomerResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
1,851,811 | public Request<ListEntitiesDetectionJobsRequest> marshall(ListEntitiesDetectionJobsRequest listEntitiesDetectionJobsRequest) {<NEW_LINE>if (listEntitiesDetectionJobsRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(ListEntitiesDetectionJobsRequest)");<NEW_LINE>}<NEW_LINE>Request<ListEntitiesDetectionJobsRequest> request = new DefaultRequest<ListEntitiesDetectionJobsRequest>(listEntitiesDetectionJobsRequest, "AmazonComprehend");<NEW_LINE>String target = "Comprehend_20171127.ListEntitiesDetectionJobs";<NEW_LINE>request.addHeader("X-Amz-Target", target);<NEW_LINE>request.setHttpMethod(HttpMethodName.POST);<NEW_LINE>String uriResourcePath = "/";<NEW_LINE>request.setResourcePath(uriResourcePath);<NEW_LINE>try {<NEW_LINE>StringWriter stringWriter = new StringWriter();<NEW_LINE>AwsJsonWriter jsonWriter = JsonUtils.getJsonWriter(stringWriter);<NEW_LINE>jsonWriter.beginObject();<NEW_LINE>if (listEntitiesDetectionJobsRequest.getFilter() != null) {<NEW_LINE>EntitiesDetectionJobFilter filter = listEntitiesDetectionJobsRequest.getFilter();<NEW_LINE>jsonWriter.name("Filter");<NEW_LINE>EntitiesDetectionJobFilterJsonMarshaller.getInstance().marshall(filter, jsonWriter);<NEW_LINE>}<NEW_LINE>if (listEntitiesDetectionJobsRequest.getNextToken() != null) {<NEW_LINE>String nextToken = listEntitiesDetectionJobsRequest.getNextToken();<NEW_LINE>jsonWriter.name("NextToken");<NEW_LINE>jsonWriter.value(nextToken);<NEW_LINE>}<NEW_LINE>if (listEntitiesDetectionJobsRequest.getMaxResults() != null) {<NEW_LINE>Integer maxResults = listEntitiesDetectionJobsRequest.getMaxResults();<NEW_LINE>jsonWriter.name("MaxResults");<NEW_LINE>jsonWriter.value(maxResults);<NEW_LINE>}<NEW_LINE>jsonWriter.endObject();<NEW_LINE>jsonWriter.close();<NEW_LINE>String snippet = stringWriter.toString();<NEW_LINE>byte[] content = snippet.getBytes(UTF8);<NEW_LINE>request.setContent(new StringInputStream(snippet));<NEW_LINE>request.addHeader("Content-Length", Integer.toString(content.length));<NEW_LINE>} catch (Throwable t) {<NEW_LINE>throw new AmazonClientException("Unable to marshall request to JSON: " + <MASK><NEW_LINE>}<NEW_LINE>if (!request.getHeaders().containsKey("Content-Type")) {<NEW_LINE>request.addHeader("Content-Type", "application/x-amz-json-1.1");<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | t.getMessage(), t); |
1,055,947 | private Set<ScalarOperator> searchEquivalentValues(Set<ScalarOperator> search, ColumnRefOperator replaceColumnRef) {<NEW_LINE>Set<ScalarOperator> result = Sets.newLinkedHashSet();<NEW_LINE>Map<ColumnRefOperator, ScalarOperator> rewriteMap = Maps.newHashMap();<NEW_LINE>for (ScalarOperator operator : search) {<NEW_LINE>// can't resolve function(columnRef)<NEW_LINE>if (!isColumnRefOperator(operator)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>rewriteMap.put((ColumnRefOperator) operator, replaceColumnRef);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>for (ScalarOperator operator : search) {<NEW_LINE>if (!isColumnRefOperator(operator)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>Set<ScalarOperator> values = columnValuesMap.getOrDefault((ColumnRefOperator) operator, Collections.emptySet());<NEW_LINE>// avoid use Collection::toSet<NEW_LINE>values.stream().map(d -> d.clone().accept(rewriter, null)).forEach(result::add);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | ReplaceColumnRefRewriter rewriter = new ReplaceColumnRefRewriter(rewriteMap); |
245,351 | private Coordinate displaceFromCornerAwayFromArms(Coordinate nearPt, Coordinate p1, Coordinate p2, double dist) {<NEW_LINE>Coordinate[] corner = orientCorner(nearPt, p1, p2);<NEW_LINE>boolean isInsideCorner = isInsideCorner(vertexPt, nearPt, corner[0], corner[1]);<NEW_LINE>Vector2D u1 = Vector2D.create(nearPt, corner[0]).normalize();<NEW_LINE>Vector2D u2 = Vector2D.create(nearPt, corner[1]).normalize();<NEW_LINE>double <MASK><NEW_LINE>double maxAngToBisec = maxAngleToBisector(cornerAng);<NEW_LINE>Vector2D bisec = u2.rotate(cornerAng / 2);<NEW_LINE>if (!isInsideCorner) {<NEW_LINE>bisec = bisec.multiply(-1);<NEW_LINE>double outerAng = 2 * Math.PI - cornerAng;<NEW_LINE>maxAngToBisec = maxAngleToBisector(outerAng);<NEW_LINE>}<NEW_LINE>Vector2D pointwiseDisplacement = Vector2D.create(nearPt, vertexPt).normalize();<NEW_LINE>double stretchAng = pointwiseDisplacement.angleTo(bisec);<NEW_LINE>double stretchAngClamp = MathUtil.clamp(stretchAng, -maxAngToBisec, maxAngToBisec);<NEW_LINE>Vector2D cornerDisplacement = bisec.rotate(-stretchAngClamp).multiply(dist);<NEW_LINE>return cornerDisplacement.translate(vertexPt);<NEW_LINE>} | cornerAng = u1.angle(u2); |
1,647,329 | public static void registerType(ModelBuilder modelBuilder) {<NEW_LINE>ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(CallActivity.class, BPMN_ELEMENT_CALL_ACTIVITY).namespaceUri(BPMN20_NS).extendsType(Activity.class).instanceProvider(new ModelTypeInstanceProvider<CallActivity>() {<NEW_LINE><NEW_LINE>public CallActivity newInstance(ModelTypeInstanceContext instanceContext) {<NEW_LINE>return new CallActivityImpl(instanceContext);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>calledElementAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_CALLED_ELEMENT).build();<NEW_LINE>camundaAsyncAttribute = typeBuilder.booleanAttribute(CAMUNDA_ATTRIBUTE_ASYNC).namespace(CAMUNDA_NS).defaultValue(false).build();<NEW_LINE>camundaCalledElementBindingAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_CALLED_ELEMENT_BINDING).namespace(CAMUNDA_NS).build();<NEW_LINE>camundaCalledElementVersionAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_CALLED_ELEMENT_VERSION).namespace(CAMUNDA_NS).build();<NEW_LINE>camundaCalledElementVersionTagAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_CALLED_ELEMENT_VERSION_TAG).namespace(CAMUNDA_NS).build();<NEW_LINE>camundaCaseRefAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_CASE_REF).namespace(CAMUNDA_NS).build();<NEW_LINE>camundaCaseBindingAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_CASE_BINDING).namespace(CAMUNDA_NS).build();<NEW_LINE>camundaCaseVersionAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_CASE_VERSION).namespace(CAMUNDA_NS).build();<NEW_LINE>camundaCalledElementTenantIdAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_CALLED_ELEMENT_TENANT_ID).namespace(CAMUNDA_NS).build();<NEW_LINE>camundaCaseTenantIdAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_CASE_TENANT_ID).namespace(CAMUNDA_NS).build();<NEW_LINE>camundaVariableMappingClassAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_VARIABLE_MAPPING_CLASS).namespace(CAMUNDA_NS).build();<NEW_LINE>camundaVariableMappingDelegateExpressionAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_VARIABLE_MAPPING_DELEGATE_EXPRESSION).<MASK><NEW_LINE>typeBuilder.build();<NEW_LINE>} | namespace(CAMUNDA_NS).build(); |
1,558,291 | private static boolean showDialog(URL whereTo) {<NEW_LINE>String msg = NbBundle.getMessage(FeedbackSurvey.class, "MSG_FeedbackSurvey_Message");<NEW_LINE>String tit = NbBundle.getMessage(FeedbackSurvey.class, "MSG_FeedbackSurvey_Title");<NEW_LINE>String yes = NbBundle.getMessage(FeedbackSurvey.class, "MSG_FeedbackSurvey_Yes");<NEW_LINE>String later = NbBundle.getMessage(FeedbackSurvey.class, "MSG_FeedbackSurvey_Later");<NEW_LINE>String never = NbBundle.<MASK><NEW_LINE>NotifyDescriptor nd = new NotifyDescriptor.Message(msg, NotifyDescriptor.QUESTION_MESSAGE);<NEW_LINE>nd.setTitle(tit);<NEW_LINE>// Object[] buttons = { yes, later, never };<NEW_LINE>JButton yesButton = new JButton();<NEW_LINE>yesButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(FeedbackSurvey.class, "ACSD_FeedbackSurvey_Yes"));<NEW_LINE>Mnemonics.setLocalizedText(yesButton, yes);<NEW_LINE>JButton laterButton = new JButton();<NEW_LINE>laterButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(FeedbackSurvey.class, "ACSD_FeedbackSurvey_Later"));<NEW_LINE>Mnemonics.setLocalizedText(laterButton, later);<NEW_LINE>JButton neverButton = new JButton();<NEW_LINE>neverButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(FeedbackSurvey.class, "ACSD_FeedbackSurvey_Never"));<NEW_LINE>Mnemonics.setLocalizedText(neverButton, never);<NEW_LINE>Object[] buttons = { yesButton, laterButton, neverButton };<NEW_LINE>nd.setOptions(buttons);<NEW_LINE>Object res = DialogDisplayer.getDefault().notify(nd);<NEW_LINE>if (res == yesButton) {<NEW_LINE>HtmlBrowser.URLDisplayer.getDefault().showURL(whereTo);<NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>if (res == neverButton) {<NEW_LINE>Preferences prefs = NbPreferences.forModule(FeedbackSurvey.class);<NEW_LINE>// NOI18N<NEW_LINE>prefs.putInt("feedback.survey.show.count", (int) bundledInt("MSG_FeedbackSurvey_AskTimes"));<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | getMessage(FeedbackSurvey.class, "MSG_FeedbackSurvey_Never"); |
903,154 | public static int bitCount(long lng) {<NEW_LINE>lng = (lng & 0x5555555555555555L) + ((lng >> 1) & 0x5555555555555555L);<NEW_LINE>lng = (lng & 0x3333333333333333L) + ((<MASK><NEW_LINE>// adjust for 64-bit integer<NEW_LINE>int i = (int) ((lng >>> 32) + lng);<NEW_LINE>i = (i & 0x0F0F0F0F) + ((i >> 4) & 0x0F0F0F0F);<NEW_LINE>i = (i & 0x00FF00FF) + ((i >> 8) & 0x00FF00FF);<NEW_LINE>i = (i & 0x0000FFFF) + ((i >> 16) & 0x0000FFFF);<NEW_LINE>return i;<NEW_LINE>} | lng >> 2) & 0x3333333333333333L); |
1,182,505 | private void greeting() {<NEW_LINE>// generate auth data<NEW_LINE>byte[] rand1 = RandomUtil.randomBytes(8);<NEW_LINE>byte[] rand2 = RandomUtil.randomBytes(12);<NEW_LINE>// save auth data<NEW_LINE>byte[] rand = new byte[rand1.length + rand2.length];<NEW_LINE>System.arraycopy(rand1, 0, rand, 0, rand1.length);<NEW_LINE>System.arraycopy(rand2, 0, rand, <MASK><NEW_LINE>this.seed = rand;<NEW_LINE>HandshakeV10Packet hs = new HandshakeV10Packet();<NEW_LINE>hs.setPacketId(0);<NEW_LINE>// [0a] protocol version V10<NEW_LINE>hs.setProtocolVersion(Versions.PROTOCOL_VERSION);<NEW_LINE>hs.setServerVersion(Versions.getServerVersion());<NEW_LINE>hs.setThreadId(connection.getId());<NEW_LINE>hs.setSeed(rand1);<NEW_LINE>hs.setServerCapabilities(getServerCapabilities());<NEW_LINE>int charsetIndex = CharsetUtil.getCharsetDefaultIndex(SystemConfig.getInstance().getCharset());<NEW_LINE>hs.setServerCharsetIndex((byte) (charsetIndex & 0xff));<NEW_LINE>hs.setServerStatus(2);<NEW_LINE>hs.setRestOfScrambleBuff(rand2);<NEW_LINE>hs.setAuthPluginName(pluginName.name().getBytes());<NEW_LINE>// writeDirectly out<NEW_LINE>hs.write(connection);<NEW_LINE>} | rand1.length, rand2.length); |
887,083 | public Inventory toInventory(@NonNull final I_M_Inventory inventoryRecord) {<NEW_LINE>final InventoryId inventoryId = InventoryId.ofRepoId(inventoryRecord.getM_Inventory_ID());<NEW_LINE>// shall not be null at this point<NEW_LINE>final DocBaseAndSubType docBaseAndSubType = extractDocBaseAndSubTypeOrNull(inventoryRecord);<NEW_LINE>if (docBaseAndSubType == null) {<NEW_LINE>throw new AdempiereException("Failed extracting DocBaseType and DocSubType from " + inventoryRecord);<NEW_LINE>}<NEW_LINE>final OrgId orgId = OrgId.ofRepoId(inventoryRecord.getAD_Org_ID());<NEW_LINE>final ZoneId <MASK><NEW_LINE>final Collection<I_M_InventoryLine> inventoryLineRecords = retrieveLineRecords(inventoryId);<NEW_LINE>final ImmutableSet<InventoryLineId> inventoryLineIds = inventoryLineRecords.stream().map(r -> extractInventoryLineId(r)).collect(ImmutableSet.toImmutableSet());<NEW_LINE>final ListMultimap<InventoryLineId, I_M_InventoryLine_HU> inventoryLineHURecords = retrieveInventoryLineHURecords(inventoryLineIds);<NEW_LINE>final List<InventoryLine> inventoryLines = inventoryLineRecords.stream().map(inventoryLineRecord -> toInventoryLine(inventoryLineRecord, inventoryLineHURecords)).collect(ImmutableList.toImmutableList());<NEW_LINE>return Inventory.builder().id(inventoryId).orgId(OrgId.ofRepoId(inventoryRecord.getAD_Org_ID())).docBaseAndSubType(docBaseAndSubType).movementDate(TimeUtil.asZonedDateTime(inventoryRecord.getMovementDate(), timeZone)).warehouseId(WarehouseId.ofRepoIdOrNull(inventoryRecord.getM_Warehouse_ID())).description(inventoryRecord.getDescription()).activityId(ActivityId.ofRepoIdOrNull(inventoryRecord.getC_Activity_ID())).docStatus(DocStatus.ofCode(inventoryRecord.getDocStatus())).documentNo(inventoryRecord.getDocumentNo()).lines(inventoryLines).build();<NEW_LINE>} | timeZone = orgDAO.getTimeZone(orgId); |
1,483,473 | public LocalFileHeader nextHeaderFrom(long offset) throws IOException {<NEW_LINE>int skipped = 0;<NEW_LINE>for (ByteBuffer buffer = getData(offset + skipped, MAX_HEADER_SIZE); buffer.limit() >= LocalFileHeader.SIZE; buffer = getData(offset + skipped, MAX_HEADER_SIZE)) {<NEW_LINE>int markerOffset = <MASK><NEW_LINE>if (markerOffset < 0) {<NEW_LINE>skipped += buffer.limit() - 3;<NEW_LINE>} else {<NEW_LINE>skipped += markerOffset;<NEW_LINE>LocalFileHeader header = markerOffset == 0 ? localHeaderIn(buffer, offset + skipped) : localHeaderAt(offset + skipped);<NEW_LINE>if (header != null) {<NEW_LINE>if (skipped > 0) {<NEW_LINE>System.out.println("Warning: local header search: skipped " + skipped + " bytes");<NEW_LINE>}<NEW_LINE>return header;<NEW_LINE>}<NEW_LINE>// If localHeaderIn or localHeaderAt decided it is not a header location,<NEW_LINE>// we continue the search.<NEW_LINE>skipped += 4;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | ScanUtil.scanTo(HEADER_SIG, buffer); |
1,236,439 | public void onReceive(Context context, Intent intent) {<NEW_LINE>if (context.getResources().getBoolean(R.bool.opentasks_support_local_lists)) {<NEW_LINE>// The database was just created, insert a local task list<NEW_LINE>ContentValues listValues = new ContentValues(5);<NEW_LINE>listValues.put(TaskLists.LIST_NAME, context.getString(R.string.initial_local_task_list_name));<NEW_LINE>listValues.put(TaskLists.LIST_COLOR, Color.rgb(30, 136, 229));<NEW_LINE>listValues.put(TaskLists.VISIBLE, 1);<NEW_LINE>listValues.put(TaskLists.SYNC_ENABLED, 1);<NEW_LINE>listValues.<MASK><NEW_LINE>context.getContentResolver().insert(TaskContract.TaskLists.getContentUri(AuthorityUtil.taskAuthority(context)).buildUpon().appendQueryParameter(TaskContract.CALLER_IS_SYNCADAPTER, "true").appendQueryParameter(TaskContract.ACCOUNT_NAME, TaskContract.LOCAL_ACCOUNT_NAME).appendQueryParameter(TaskContract.ACCOUNT_TYPE, TaskContract.LOCAL_ACCOUNT_TYPE).build(), listValues);<NEW_LINE>}<NEW_LINE>} | put(TaskLists.OWNER, ""); |
1,508,796 | private void embedNetwork(final EncogProgramNode node) {<NEW_LINE>addBreak();<NEW_LINE>final File methodFile = (File) node.getArgs().get(0).getValue();<NEW_LINE>final MLMethod method = (MLMethod) EncogDirectoryPersistence.loadObject(methodFile);<NEW_LINE>if (!(method instanceof MLFactory)) {<NEW_LINE>throw new EncogError("Code generation not yet supported for: " + method.getClass().getName());<NEW_LINE>}<NEW_LINE>final FlatNetwork flat = ((ContainsFlat) method).getFlat();<NEW_LINE>// header<NEW_LINE>final StringBuilder line = new StringBuilder();<NEW_LINE>line.append("public static MLMethod ");<NEW_LINE>line.append(node.getName());<NEW_LINE>line.append("() {");<NEW_LINE>indentLine(line.toString());<NEW_LINE>// create factory<NEW_LINE>line.setLength(0);<NEW_LINE>addLine("var network = ENCOG.BasicNetwork.create( null );");<NEW_LINE>addLine("network.inputCount = " + flat.getInputCount() + ";");<NEW_LINE>addLine("network.outputCount = " + flat.getOutputCount() + ";");<NEW_LINE>addLine("network.layerCounts = " + toSingleLineArray(flat.getLayerCounts()) + ";");<NEW_LINE>addLine("network.layerContextCount = " + toSingleLineArray(flat.getLayerContextCount()) + ";");<NEW_LINE>addLine("network.weightIndex = " + toSingleLineArray(flat.getWeightIndex()) + ";");<NEW_LINE>addLine("network.layerIndex = " + toSingleLineArray(flat.getLayerIndex()) + ";");<NEW_LINE>addLine("network.activationFunctions = " + toSingleLineArray(flat.getActivationFunctions()) + ";");<NEW_LINE>addLine("network.layerFeedCounts = " + toSingleLineArray(flat.getLayerFeedCounts()) + ";");<NEW_LINE>addLine("network.contextTargetOffset = " + toSingleLineArray(flat<MASK><NEW_LINE>addLine("network.contextTargetSize = " + toSingleLineArray(flat.getContextTargetSize()) + ";");<NEW_LINE>addLine("network.biasActivation = " + toSingleLineArray(flat.getBiasActivation()) + ";");<NEW_LINE>addLine("network.beginTraining = " + flat.getBeginTraining() + ";");<NEW_LINE>addLine("network.endTraining=" + flat.getEndTraining() + ";");<NEW_LINE>addLine("network.weights = WEIGHTS;");<NEW_LINE>addLine("network.layerOutput = " + toSingleLineArray(flat.getLayerOutput()) + ";");<NEW_LINE>addLine("network.layerSums = " + toSingleLineArray(flat.getLayerSums()) + ";");<NEW_LINE>// return<NEW_LINE>addLine("return network;");<NEW_LINE>unIndentLine("}");<NEW_LINE>} | .getContextTargetOffset()) + ";"); |
1,460,479 | public CompletableFuture<MessagingService> start() {<NEW_LINE>if (started.get()) {<NEW_LINE><MASK><NEW_LINE>return CompletableFuture.completedFuture(this);<NEW_LINE>}<NEW_LINE>final CompletableFuture<Void> serviceLoader;<NEW_LINE>if (config.isTlsEnabled()) {<NEW_LINE>serviceLoader = loadServerSslContext().thenCompose(ok -> loadClientSslContext());<NEW_LINE>} else {<NEW_LINE>serviceLoader = CompletableFuture.completedFuture(null);<NEW_LINE>}<NEW_LINE>initTransport();<NEW_LINE>return serviceLoader.thenCompose(ok -> bootstrapServer()).thenRun(() -> {<NEW_LINE>timeoutExecutor = Executors.newSingleThreadScheduledExecutor(new DefaultThreadFactory("netty-messaging-timeout-"));<NEW_LINE>localConnection = new LocalClientConnection(handlers);<NEW_LINE>started.set(true);<NEW_LINE>log.info("Started messaging service bound to {}, advertising {}, and using {}", bindingAddresses, advertisedAddress, config.isTlsEnabled() ? "TLS" : "plaintext");<NEW_LINE>}).thenApply(v -> this);<NEW_LINE>} | log.warn("Already running at local address: {}", advertisedAddress); |
677,621 | public void install(@Nonnull Jooby application) throws Exception {<NEW_LINE>ServiceRegistry registry = application.getServices();<NEW_LINE>Jdbi jdbi;<NEW_LINE>if (factory != null) {<NEW_LINE>jdbi = factory.apply(findDataSource(registry));<NEW_LINE>} else {<NEW_LINE>jdbi = Jdbi.create(findDataSource(registry));<NEW_LINE>jdbi.installPlugins();<NEW_LINE>}<NEW_LINE>registry.putIfAbsent(ServiceKey.key(Jdbi.class), jdbi);<NEW_LINE>registry.put(ServiceKey.key(Jdbi.class, name), jdbi);<NEW_LINE>Provider<Handle> provider = new HandleProvider(jdbi);<NEW_LINE>registry.putIfAbsent(ServiceKey.key(Handle.class), provider);<NEW_LINE>registry.put(ServiceKey.key(Handle.class, name), provider);<NEW_LINE>for (Class<?> sqlObject : sqlObjects) {<NEW_LINE>registry.put(sqlObject, <MASK><NEW_LINE>}<NEW_LINE>} | new SqlObjectProvider(jdbi, sqlObject)); |
229,214 | protected ProcessResult write(final CrawlURI curi) throws IOException {<NEW_LINE>WARCWriter writer = (WARCWriter) getPool().borrowFile();<NEW_LINE>// Reset writer temp stats so they reflect only this set of records.<NEW_LINE>writer.resetTmpStats();<NEW_LINE>writer.resetTmpRecordLog();<NEW_LINE>long position = writer.getPosition();<NEW_LINE>try {<NEW_LINE>// Roll over to new warc file if we've exceeded maxBytes.<NEW_LINE>writer.checkSize();<NEW_LINE>if (writer.getPosition() != position) {<NEW_LINE>// We rolled over to a new warc and wrote a warcinfo record.<NEW_LINE>// Tally stats and reset temp stats, to avoid including warcinfo<NEW_LINE>// record in stats for current url.<NEW_LINE>addTotalBytesWritten(<MASK><NEW_LINE>addStats(writer.getTmpStats());<NEW_LINE>writer.resetTmpStats();<NEW_LINE>writer.resetTmpRecordLog();<NEW_LINE>position = writer.getPosition();<NEW_LINE>}<NEW_LINE>writeRecords(curi, writer);<NEW_LINE>} catch (IOException e) {<NEW_LINE>// Invalidate this file (It gets a '.invalid' suffix).<NEW_LINE>getPool().invalidateFile(writer);<NEW_LINE>// Set the writer to null otherwise the pool accounting<NEW_LINE>// of how many active writers gets skewed if we subsequently<NEW_LINE>// do a returnWriter call on this object in the finally block.<NEW_LINE>writer = null;<NEW_LINE>throw e;<NEW_LINE>} finally {<NEW_LINE>if (writer != null) {<NEW_LINE>updateMetadataAfterWrite(curi, writer, position);<NEW_LINE>getPool().returnFile(writer);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// XXX this looks wrong, check should happen *before* writing the<NEW_LINE>// record, the way checkBytesWritten() currently works<NEW_LINE>return checkBytesWritten();<NEW_LINE>} | writer.getPosition() - position); |
808,103 | private void init() {<NEW_LINE>setBorder("normal");<NEW_LINE>VerticalBox vbox = new VerticalBox();<NEW_LINE>appendChild(vbox);<NEW_LINE>tabbox = new Tabbox();<NEW_LINE>vbox.appendChild(tabbox);<NEW_LINE>Tabs tabs = new Tabs();<NEW_LINE>tabbox.appendChild(tabs);<NEW_LINE>Tabpanels tabPanels = new Tabpanels();<NEW_LINE>tabbox.appendChild(tabPanels);<NEW_LINE>Tab tab = new Tab("Text");<NEW_LINE>tabs.appendChild(tab);<NEW_LINE>Tabpanel tabPanel = new Tabpanel();<NEW_LINE>tabPanels.appendChild(tabPanel);<NEW_LINE>textBox = new Textbox(text);<NEW_LINE>textBox.setCols(80);<NEW_LINE>textBox.setRows(30);<NEW_LINE>textBox.setEnabled(editable);<NEW_LINE>textBox.setWidth("700px");<NEW_LINE>textBox.setHeight("500px");<NEW_LINE>tabPanel.appendChild(textBox);<NEW_LINE>if (isShowHTMLTab) {<NEW_LINE>tab = new Tab("HTML");<NEW_LINE>tabs.appendChild(tab);<NEW_LINE>tabPanel = new Tabpanel();<NEW_LINE>tabPanels.appendChild(tabPanel);<NEW_LINE>if (editable) {<NEW_LINE>editor = new FCKeditor();<NEW_LINE>tabPanel.appendChild(editor);<NEW_LINE>editor.setWidth("700px");<NEW_LINE>editor.setHeight("500px");<NEW_LINE>editor.setValue(text);<NEW_LINE>} else {<NEW_LINE>Div div = new Div();<NEW_LINE>div.setHeight("500px");<NEW_LINE>div.setWidth("700px");<NEW_LINE>div.setStyle("overflow: auto; border: 1px solid");<NEW_LINE>tabPanel.appendChild(div);<NEW_LINE>Html html = new Html();<NEW_LINE>div.appendChild(html);<NEW_LINE>html.setContent(text);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>vbox.appendChild(new Separator());<NEW_LINE>ConfirmPanel confirmPanel = new ConfirmPanel(true);<NEW_LINE>vbox.appendChild(confirmPanel);<NEW_LINE>confirmPanel.addButton(confirmPanel.createButton(ConfirmPanel.A_RESET));<NEW_LINE>confirmPanel.addActionListener(this);<NEW_LINE>if (maxSize > 0) {<NEW_LINE>status = new Label();<NEW_LINE>appendChild(status);<NEW_LINE><MASK><NEW_LINE>status.setStyle("margin-top:10px;");<NEW_LINE>textBox.addEventListener(Events.ON_CHANGE, this);<NEW_LINE>if (isShowHTMLTab)<NEW_LINE>editor.addEventListener(Events.ON_CHANGE, this);<NEW_LINE>}<NEW_LINE>tabbox.addEventListener(Events.ON_SELECT, this);<NEW_LINE>} | updateStatus(text.length()); |
1,617,975 | protected void handleBladeException(BladeException e, Request request, Response response) {<NEW_LINE>var blade = WebContext.blade();<NEW_LINE>response.status(e.getStatus());<NEW_LINE>var modelAndView = new ModelAndView();<NEW_LINE>modelAndView.add("title", e.getStatus() + " " + e.getName());<NEW_LINE>modelAndView.add("message", e.getMessage());<NEW_LINE>if (null != e.getCause()) {<NEW_LINE>request.attribute(VARIABLE_STACKTRACE, getStackTrace(e));<NEW_LINE>}<NEW_LINE>if (e.getStatus() == InternalErrorException.STATUS) {<NEW_LINE>log.error("", e);<NEW_LINE>this.render500(request, response);<NEW_LINE>}<NEW_LINE>String paddingMethod = BladeCache.getPaddingMethod(request.method());<NEW_LINE>if (e.getStatus() == NotFoundException.STATUS) {<NEW_LINE>log404(log, paddingMethod, request.uri());<NEW_LINE>if (request.isJsonRequest()) {<NEW_LINE>response.json(RestResponse.fail(NotFoundException.STATUS, "Not Found [" + request<MASK><NEW_LINE>} else {<NEW_LINE>var page404 = Optional.ofNullable(blade.environment().get(ENV_KEY_PAGE_404, null));<NEW_LINE>if (page404.isPresent()) {<NEW_LINE>modelAndView.setView(page404.get());<NEW_LINE>renderPage(response, modelAndView);<NEW_LINE>response.render(page404.get());<NEW_LINE>} else {<NEW_LINE>HtmlCreator htmlCreator = new HtmlCreator();<NEW_LINE>htmlCreator.center("<h1>404 Not Found - " + request.uri() + "</h1>");<NEW_LINE>htmlCreator.hr();<NEW_LINE>response.html(htmlCreator.html());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (e.getStatus() == MethodNotAllowedException.STATUS) {<NEW_LINE>log405(log, paddingMethod, request.uri());<NEW_LINE>if (request.isJsonRequest()) {<NEW_LINE>response.json(RestResponse.fail(MethodNotAllowedException.STATUS, e.getMessage()));<NEW_LINE>} else {<NEW_LINE>response.text(e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .uri() + "]")); |
1,405,912 | void check() {<NEW_LINE>String[] <MASK><NEW_LINE>String firstExpand = slices[0];<NEW_LINE>if (isFromAnnotation) {<NEW_LINE>ExpandedQueries eqs = (ExpandedQueries) inventoryClassDefiningThisAlias.getAnnotation(ExpandedQueries.class);<NEW_LINE>DebugUtils.Assert(eqs != null, String.format("inventory[%s] having annotation[ExpandedQueryAliases] must also have annotation[ExpandedQueries]", inventoryClassDefiningThisAlias.getName()));<NEW_LINE>for (ExpandedQuery at : eqs.value()) {<NEW_LINE>if (at.expandedField().equals(firstExpand)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw new CloudRuntimeException(String.format("inventory[%s] has an expanded query alias[%s]," + " but it doesn't have an expand query that has expandedField[%s]", inventoryClassDefiningThisAlias.getName(), alias, firstExpand));<NEW_LINE>} else {<NEW_LINE>List<ExpandedQueryStruct> expds = expandedQueryStructs.get(inventoryClassDefiningThisAlias);<NEW_LINE>for (ExpandedQueryStruct s : expds) {<NEW_LINE>if (s.getExpandedField().equals(firstExpand)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw new CloudRuntimeException(String.format("inventory[%s] has an expanded query alias[%s](added by AddExpandedQueryExtensionPoint]," + " but the extension doesn't declare any expanded query having expandedField[%s]", inventoryClassDefiningThisAlias.getClass(), alias, firstExpand));<NEW_LINE>}<NEW_LINE>} | slices = expandField.split("\\."); |
1,385,408 | private void initializeValuesForMissing() {<NEW_LINE>if (nonNullReadOrderLength() < parsedFields.size()) {<NEW_LINE>Set<FieldMapping> unmapped = new LinkedHashSet<FieldMapping>(parsedFields);<NEW_LINE>unmapped.removeAll(Arrays.asList(readOrder));<NEW_LINE>missing = unmapped.toArray(new FieldMapping[0]);<NEW_LINE>String[] headers <MASK><NEW_LINE>BeanConversionProcessor tmp = new BeanConversionProcessor(getBeanClass(), methodFilter) {<NEW_LINE><NEW_LINE>protected void addConversion(Conversion conversion, FieldMapping mapping) {<NEW_LINE>if (conversion == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>convertFields(conversion).add(NormalizedString.valueOf(mapping.getFieldName()));<NEW_LINE>}<NEW_LINE>};<NEW_LINE>for (int i = 0; i < missing.length; i++) {<NEW_LINE>FieldMapping mapping = missing[i];<NEW_LINE>if (processField(mapping)) {<NEW_LINE>tmp.setupConversions(mapping.getTarget(), mapping);<NEW_LINE>}<NEW_LINE>headers[i] = NormalizedString.valueOf(mapping.getFieldName());<NEW_LINE>}<NEW_LINE>tmp.initializeConversions(headers, null);<NEW_LINE>valuesForMissing = tmp.applyConversions(new String[missing.length], null);<NEW_LINE>} else {<NEW_LINE>missing = null;<NEW_LINE>valuesForMissing = null;<NEW_LINE>}<NEW_LINE>} | = new String[missing.length]; |
1,711,510 | final DescribeGatewayCapabilityConfigurationResult executeDescribeGatewayCapabilityConfiguration(DescribeGatewayCapabilityConfigurationRequest describeGatewayCapabilityConfigurationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeGatewayCapabilityConfigurationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeGatewayCapabilityConfigurationRequest> request = null;<NEW_LINE>Response<DescribeGatewayCapabilityConfigurationResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeGatewayCapabilityConfigurationRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeGatewayCapabilityConfigurationRequest));<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, "IoTSiteWise");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeGatewayCapabilityConfiguration");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>URI endpointTraitHost = null;<NEW_LINE>if (!clientConfiguration.isDisableHostPrefixInjection()) {<NEW_LINE>String hostPrefix = "api.";<NEW_LINE>String resolvedHostPrefix = String.format("api.");<NEW_LINE>endpointTraitHost = UriResourcePathUtils.updateUriHost(endpoint, resolvedHostPrefix);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeGatewayCapabilityConfigurationResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeGatewayCapabilityConfigurationResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext, null, endpointTraitHost);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
286,096 | private static void runAssertionAllTypes(RegressionEnvironment env, String typeName, Object[] events) {<NEW_LINE>String graph = "@name('flow') create dataflow MyGraph " <MASK><NEW_LINE>env.compileDeploy(graph);<NEW_LINE>env.compileDeploy("@name('s0') select * from " + typeName).addListener("s0");<NEW_LINE>DefaultSupportSourceOp source = new DefaultSupportSourceOp(events);<NEW_LINE>EPDataFlowInstantiationOptions options = new EPDataFlowInstantiationOptions();<NEW_LINE>options.operatorProvider(new DefaultSupportGraphOpProvider(source));<NEW_LINE>EPDataFlowInstance instance = env.runtime().getDataFlowService().instantiate(env.deploymentId("flow"), "MyGraph", options);<NEW_LINE>instance.run();<NEW_LINE>env.assertPropsPerRowNewFlattened("s0", "myDouble,myInt,myString".split(","), new Object[][] { { 1.1d, 1, "one" }, { 2.2d, 2, "two" } });<NEW_LINE>env.undeployAll();<NEW_LINE>} | + "DefaultSupportSourceOp -> instream<" + typeName + ">{}" + "EventBusSink(instream) {}"; |
189,006 | public void run(RegressionEnvironment env) {<NEW_LINE>RegressionPath path = new RegressionPath();<NEW_LINE>String stmtTextOne = "@public insert into MyStreamTE select a, b from AEventTE#keepall as a, BEventTE#keepall as b";<NEW_LINE>env.compileDeploy(stmtTextOne, path);<NEW_LINE>String stmtTextTwo = "@name('s0') select a.id, b.id from MyStreamTE";<NEW_LINE>env.compileDeploy(stmtTextTwo, path).addListener("s0");<NEW_LINE>Map<String, Object> eventOne = makeMap(new Object[][] { { "id", "A1" } });<NEW_LINE>Map<String, Object> eventTwo = makeMap(new Object[][] <MASK><NEW_LINE>env.sendEventMap(eventOne, "AEventTE");<NEW_LINE>env.sendEventMap(eventTwo, "BEventTE");<NEW_LINE>env.assertPropsNew("s0", "a.id,b.id".split(","), new Object[] { "A1", "B1" });<NEW_LINE>env.undeployAll();<NEW_LINE>} | { { "id", "B1" } }); |
921,763 | private static void generatePrimitiveConstantDecoder(final StringBuilder sb, final int level, final String name, final Encoding encoding) throws IOException {<NEW_LINE>assert encoding.presence() == Encoding.Presence.CONSTANT;<NEW_LINE>final PrimitiveType primitiveType = encoding.primitiveType();<NEW_LINE>final String rustPrimitiveType = rustTypeName(primitiveType);<NEW_LINE>final String characterEncoding = encoding.characterEncoding();<NEW_LINE>indent(sb, level, "/// CONSTANT \n");<NEW_LINE>final String rawConstValue = encoding.constValue().toString();<NEW_LINE>if (characterEncoding != null) {<NEW_LINE>indent(sb, level, "/// characterEncoding: '%s'\n", characterEncoding);<NEW_LINE><MASK><NEW_LINE>if (JavaUtil.isAsciiEncoding(characterEncoding)) {<NEW_LINE>indent(sb, level, "pub fn %s(&self) -> &'static [u8] {\n", formatFunctionName(name));<NEW_LINE>indent(sb, level + 1, "b\"%s\"\n", rawConstValue);<NEW_LINE>} else if (JavaUtil.isUtf8Encoding(characterEncoding)) {<NEW_LINE>indent(sb, level, "pub fn %s(&self) -> &'static str {\n", formatFunctionName(name));<NEW_LINE>indent(sb, level + 1, "\"%s\"\n", rawConstValue);<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("Unsupported encoding: " + characterEncoding);<NEW_LINE>}<NEW_LINE>indent(sb, level, "}\n\n");<NEW_LINE>} else {<NEW_LINE>indent(sb, level, "#[inline]\n");<NEW_LINE>indent(sb, level, "pub fn %s(&self) -> %s {\n", formatFunctionName(name), rustPrimitiveType);<NEW_LINE>indent(sb, level + 1, "%s\n", rawConstValue);<NEW_LINE>indent(sb, level, "}\n\n");<NEW_LINE>}<NEW_LINE>} | indent(sb, level, "#[inline]\n"); |
476,678 | // Reviewed vs. Native Jan 11, 2011<NEW_LINE>protected void _beforeNewSegment(int resizeBy) {<NEW_LINE>// Called for each new segment being added.<NEW_LINE>if (m_bPathStarted) {<NEW_LINE>// make sure the m_movetoPoint exists and has<NEW_LINE>_initPathStartPoint();<NEW_LINE>// right vertex description<NEW_LINE>// The new path is started. Need to grow m_parts and m_pathFlags.<NEW_LINE>if (m_paths == null) {<NEW_LINE>m_paths = (AttributeStreamOfInt32) AttributeStreamBase.createIndexStream(2);<NEW_LINE>m_paths.write(0, 0);<NEW_LINE>m_pathFlags = (AttributeStreamOfInt8) AttributeStreamBase.createByteStream(2, (byte) 0);<NEW_LINE>} else {<NEW_LINE>// _ASSERT(m_parts.size() >= 2);<NEW_LINE>m_paths.resize(m_paths.size() + 1, 0);<NEW_LINE>m_pathFlags.resize(m_pathFlags.size() + 1, 0);<NEW_LINE>}<NEW_LINE>if (m_bPolygon) {<NEW_LINE>// Mark the path as closed<NEW_LINE>m_pathFlags.write(m_pathFlags.size() - 2, (byte) PathFlags.enumClosed);<NEW_LINE>}<NEW_LINE>// +1 for the StartPath point.<NEW_LINE>resizeBy++;<NEW_LINE>}<NEW_LINE>int oldcount = m_pointCount;<NEW_LINE>// The<NEW_LINE>m_paths.write(m_paths.size() - 1, m_pointCount + resizeBy);<NEW_LINE>// NotifyModified<NEW_LINE>// will<NEW_LINE>// update<NEW_LINE>// the<NEW_LINE>// m_pointCount<NEW_LINE>// with this<NEW_LINE>// value.<NEW_LINE>_resizeImpl(oldcount + resizeBy);<NEW_LINE>m_pathFlags.write(m_paths.size() <MASK><NEW_LINE>if (m_bPathStarted) {<NEW_LINE>// setPoint(oldcount,<NEW_LINE>setPointByVal(oldcount, m_moveToPoint);<NEW_LINE>// m_moveToPoint); //finally<NEW_LINE>// set the start point to<NEW_LINE>// the geometry<NEW_LINE>m_bPathStarted = false;<NEW_LINE>}<NEW_LINE>} | - 1, (byte) 0); |
891,276 | private static Class<? extends DBusSignal> createSignalClass(String intname, String signame) throws DBusException {<NEW_LINE>String name = intname + '$' + signame;<NEW_LINE>Class<? extends DBusSignal> c = classCache.get(name);<NEW_LINE>if (null == c)<NEW_LINE>c = DBusMatchRule.getCachedSignalType(name);<NEW_LINE>if (null != c)<NEW_LINE>return c;<NEW_LINE>do {<NEW_LINE>try {<NEW_LINE>c = (Class<? extends DBusSignal>) Class.forName(name);<NEW_LINE>} catch (ClassNotFoundException CNFe) {<NEW_LINE>}<NEW_LINE>name = name.replaceAll("\\.([^\\.]*)$", "\\$$1");<NEW_LINE>} while (null == c && name.matches(".*\\..*"));<NEW_LINE>if (null == c)<NEW_LINE>throw new DBusException(getString("cannotCreateClassFromSignal"<MASK><NEW_LINE>classCache.put(name, c);<NEW_LINE>return c;<NEW_LINE>} | ) + intname + '.' + signame); |
1,532,332 | public static void configureSubtitleView(PlayerView playerView) {<NEW_LINE>if (playerView != null) {<NEW_LINE><MASK><NEW_LINE>Context context = playerView.getContext();<NEW_LINE>if (subtitleView != null && context != null) {<NEW_LINE>// disable default style<NEW_LINE>subtitleView.setApplyEmbeddedStyles(false);<NEW_LINE>int textColor = ContextCompat.getColor(context, R.color.sub_text_color2);<NEW_LINE>int outlineColor = ContextCompat.getColor(context, R.color.sub_outline_color);<NEW_LINE>int backgroundColor = ContextCompat.getColor(context, R.color.sub_background_color);<NEW_LINE>CaptionStyleCompat style = new CaptionStyleCompat(textColor, backgroundColor, Color.TRANSPARENT, CaptionStyleCompat.EDGE_TYPE_OUTLINE, outlineColor, Typeface.DEFAULT);<NEW_LINE>subtitleView.setStyle(style);<NEW_LINE>float textSize = subtitleView.getContext().getResources().getDimension(R.dimen.subtitle_text_size);<NEW_LINE>subtitleView.setFixedTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | SubtitleView subtitleView = playerView.getSubtitleView(); |
429,950 | public void mergeFiles() {<NEW_LINE>String[] pdfpaths = mViewFilesAdapter.getSelectedFilePath().<MASK><NEW_LINE>String masterpwd = mSharedPrefs.getString(MASTER_PWD_STRING, appName);<NEW_LINE>new MaterialDialog.Builder(mActivity).title(R.string.creating_pdf).content(R.string.enter_file_name).input(mContext.getResources().getString(R.string.example), null, (dialog, input) -> {<NEW_LINE>if (StringUtils.getInstance().isEmpty(input)) {<NEW_LINE>StringUtils.getInstance().showSnackbar(mActivity, R.string.snackbar_name_not_blank);<NEW_LINE>} else {<NEW_LINE>if (!mFileUtils.isFileExist(input + mContext.getResources().getString(R.string.pdf_ext))) {<NEW_LINE>new MergePdf(input.toString(), mHomePath, mPasswordProtected, mPassword, this, masterpwd).execute(pdfpaths);<NEW_LINE>} else {<NEW_LINE>MaterialDialog.Builder builder = DialogUtils.getInstance().createOverwriteDialog(mActivity);<NEW_LINE>builder.onPositive((dialog12, which) -> new MergePdf(input.toString(), mHomePath, mPasswordProtected, mPassword, this, masterpwd).execute(pdfpaths)).onNegative((dialog1, which) -> mergeFiles()).show();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}).show();<NEW_LINE>} | toArray(new String[0]); |
401,836 | public void actionPerformed(ActionEvent e) {<NEW_LINE>String command = e.getActionCommand();<NEW_LINE>DialogDescriptor dd = new // NOI18N<NEW_LINE>DialogDescriptor(// NOI18N<NEW_LINE>changesetPickerPanel, // NOI18N<NEW_LINE>org.openide.util.NbBundle.getMessage(ExportBundle.class, "CTL_ExportBundle.ChangesetPicker_Title"), // NOI18N<NEW_LINE>true, // NOI18N<NEW_LINE>new Object[] { selectButton, DialogDescriptor.CANCEL_OPTION }, // NOI18N<NEW_LINE>selectButton, // NOI18N<NEW_LINE>DialogDescriptor.DEFAULT_ALIGN, new HelpCtx("org.netbeans.modules.mercurial.ui.repository.ChangesetPickerPanel"), null);<NEW_LINE>selectButton.setEnabled(changesetPickerPanel.getSelectedRevision() != null);<NEW_LINE>changesetPickerPanel.addPropertyChangeListener(this);<NEW_LINE>changesetPickerPanel.initRevisions();<NEW_LINE>Dialog dialog = DialogDisplayer.<MASK><NEW_LINE>dialog.setVisible(true);<NEW_LINE>changesetPickerPanel.removePropertyChangeListener(this);<NEW_LINE>if (dd.getValue() == selectButton) {<NEW_LINE>HgLogMessage revisionWithChangeset = changesetPickerPanel.getSelectedRevision();<NEW_LINE>String revision = ChangesetPickerPanel.HG_TIP.equals(revisionWithChangeset.getRevisionNumber()) ? ChangesetPickerPanel.HG_TIP : new StringBuilder(revisionWithChangeset.getRevisionNumber()).append(SEP).append("(").append(revisionWithChangeset.getCSetShortID()).append(")").toString();<NEW_LINE>if (ExportBundlePanel.CMD_SELECT_BASE_REVISION.equals(command)) {<NEW_LINE>// NOI18N<NEW_LINE>panel.baseRevision.setModel(new DefaultComboBoxModel(new String[] { HG_NULL_BASE, revision }));<NEW_LINE>panel.baseRevision.setSelectedItem(revision);<NEW_LINE>} else if (ExportBundlePanel.CMD_SELECT_REVISION.equals(command)) {<NEW_LINE>panel.txtTopRevision.setText(revision);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | getDefault().createDialog(dd); |
530,223 | private String sendRaw(String topicName, Producer<?, ?> producer, ProducerRecord recordToSend, Boolean isAsync) throws InterruptedException, ExecutionException {<NEW_LINE>ProducerRecord qualifiedRecord = prepareRecordToSend(topicName, recordToSend);<NEW_LINE>RecordMetadata metadata;<NEW_LINE>if (Boolean.TRUE.equals(isAsync)) {<NEW_LINE>LOGGER.info("Asynchronous Producer sending record - {}", qualifiedRecord);<NEW_LINE>metadata = (RecordMetadata) producer.send(qualifiedRecord, new ProducerAsyncCallback()).get();<NEW_LINE>} else {<NEW_LINE>LOGGER.info("Synchronous Producer sending record - {}", qualifiedRecord);<NEW_LINE>metadata = (RecordMetadata) producer.send(qualifiedRecord).get();<NEW_LINE>}<NEW_LINE>LOGGER.info("Record was sent to partition- {}, with offset- {} ", metadata.partition(), metadata.offset());<NEW_LINE>// --------------------------------------------------------------<NEW_LINE>// Logs deliveryDetails, which shd be good enough for the caller<NEW_LINE>// TODO- combine deliveryDetails into a list n return (if needed)<NEW_LINE>// --------------------------------------------------------------<NEW_LINE>String deliveryDetails = gson.toJson(<MASK><NEW_LINE>LOGGER.info("deliveryDetails- {}", deliveryDetails);<NEW_LINE>return deliveryDetails;<NEW_LINE>} | new DeliveryDetails(OK, metadata)); |
1,831,646 | private void importResource(final StructrModuleInfo module) throws IOException {<NEW_LINE>final Set<String> classes = module.getClasses();<NEW_LINE>for (final String name : classes) {<NEW_LINE>String className = StringUtils.removeStart(name, ".");<NEW_LINE>try {<NEW_LINE>// instantiate class..<NEW_LINE>final Class clazz = Class.forName(className);<NEW_LINE>final <MASK><NEW_LINE>// register node entity classes<NEW_LINE>if (NodeInterface.class.isAssignableFrom(clazz)) {<NEW_LINE>registerEntityType(clazz);<NEW_LINE>}<NEW_LINE>// register entity classes<NEW_LINE>if (AbstractRelationship.class.isAssignableFrom(clazz) && !(Modifier.isAbstract(modifiers))) {<NEW_LINE>registerEntityType(clazz);<NEW_LINE>}<NEW_LINE>// register services<NEW_LINE>if (Service.class.isAssignableFrom(clazz) && !(Modifier.isAbstract(modifiers))) {<NEW_LINE>Services.getInstance().registerServiceClass(clazz);<NEW_LINE>}<NEW_LINE>// register agents<NEW_LINE>if (Agent.class.isAssignableFrom(clazz) && !(Modifier.isAbstract(modifiers))) {<NEW_LINE>final String simpleName = clazz.getSimpleName();<NEW_LINE>final String fullName = clazz.getName();<NEW_LINE>agentClassCache.put(simpleName, clazz);<NEW_LINE>agentPackages.add(fullName.substring(0, fullName.lastIndexOf(".")));<NEW_LINE>}<NEW_LINE>// register modules<NEW_LINE>if (StructrModule.class.isAssignableFrom(clazz) && !(Modifier.isAbstract(modifiers))) {<NEW_LINE>try {<NEW_LINE>// we need to make sure that a module is initialized exactly once<NEW_LINE>final StructrModule structrModule = (StructrModule) clazz.newInstance();<NEW_LINE>final String moduleName = structrModule.getName();<NEW_LINE>if (!modules.containsKey(moduleName)) {<NEW_LINE>structrModule.registerModuleFunctions(licenseManager);<NEW_LINE>if (coreModules.contains(moduleName) || licenseManager == null || licenseManager.isModuleLicensed(moduleName)) {<NEW_LINE>modules.put(moduleName, structrModule);<NEW_LINE>logger.info("Activating module {}", moduleName);<NEW_LINE>structrModule.onLoad(licenseManager);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Throwable t) {<NEW_LINE>// log only errors from internal classes<NEW_LINE>if (className.startsWith("org.structr.")) {<NEW_LINE>logger.warn("Unable to instantiate module " + clazz.getName(), t);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Throwable t) {<NEW_LINE>logger.warn("Error trying to load class {}: {}", className, t.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | int modifiers = clazz.getModifiers(); |
193,834 | protected void onCreate(Bundle savedInstanceState) {<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>setContentView(R.layout.accounts_layout);<NEW_LINE>recyclerView = findViewById(R.id.account_list);<NEW_LINE>setupToolbar();<NEW_LINE>// set the back button from action bar<NEW_LINE>ActionBar actionBar = getSupportActionBar();<NEW_LINE>// check if is not null<NEW_LINE>if (actionBar != null) {<NEW_LINE>actionBar.setDisplayHomeAsUpEnabled(true);<NEW_LINE>actionBar.setDisplayShowHomeEnabled(true);<NEW_LINE>}<NEW_LINE>// set title Action bar<NEW_LINE>updateActionBarTitleAndHomeButtonByString(getResources().getString(R.string.prefs_manage_accounts));<NEW_LINE>themeToolbarUtils.tintBackButton(actionBar, this);<NEW_LINE>List<User> users = accountManager.getAllUsers();<NEW_LINE>originalUsers = toAccountNames(users);<NEW_LINE>Optional<User> currentUser = getUser();<NEW_LINE>if (currentUser.isPresent()) {<NEW_LINE>originalCurrentUser = currentUser.get().getAccountName();<NEW_LINE>}<NEW_LINE>arbitraryDataProvider <MASK><NEW_LINE>multipleAccountsSupported = getResources().getBoolean(R.bool.multiaccount_support);<NEW_LINE>userListAdapter = new UserListAdapter(this, accountManager, getUserListItems(), this, multipleAccountsSupported, true, themeColorUtils, themeDrawableUtils);<NEW_LINE>recyclerView.setAdapter(userListAdapter);<NEW_LINE>recyclerView.setLayoutManager(new LinearLayoutManager(this));<NEW_LINE>initializeComponentGetters();<NEW_LINE>} | = new ArbitraryDataProvider(getContentResolver()); |
30,738 | public static void extractSuperClassGenerics(ClassNode type, ClassNode target, Map<String, ClassNode> spec) {<NEW_LINE>// TODO: this method is very similar to StaticTypesCheckingSupport#extractGenericsConnections,<NEW_LINE>// but operates on ClassNodes instead of GenericsType<NEW_LINE>if (target == null || type == target)<NEW_LINE>return;<NEW_LINE>if (type.isArray() && target.isArray()) {<NEW_LINE>extractSuperClassGenerics(type.getComponentType(), target.getComponentType(), spec);<NEW_LINE>} else if (type.isArray() && JAVA_LANG_OBJECT.equals(target.getName())) {<NEW_LINE>// Object is superclass of arrays but no generics involved<NEW_LINE>} else if (target.isGenericsPlaceHolder() || type.equals(target) || !implementsInterfaceOrIsSubclassOf(type, target)) {<NEW_LINE>// structural match route<NEW_LINE>if (target.isGenericsPlaceHolder()) {<NEW_LINE>spec.put(target.getGenericsTypes()[0].getName(), type);<NEW_LINE>} else {<NEW_LINE>extractSuperClassGenerics(type.getGenericsTypes(), target.getGenericsTypes(), spec);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// have first to find matching super class or interface<NEW_LINE>ClassNode superClass = getSuperClass(type, target);<NEW_LINE>if (superClass != null) {<NEW_LINE>ClassNode corrected = getCorrectedClassNode(type, superClass, false);<NEW_LINE>extractSuperClassGenerics(corrected, target, spec);<NEW_LINE>} else {<NEW_LINE>// if we reach here, we have an unhandled case<NEW_LINE>throw new GroovyBugError("The type " + <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | type + " seems not to normally extend " + target + ". Sorry, I cannot handle this."); |
1,575,171 | public static DetectKitchenAnimalsResponse unmarshall(DetectKitchenAnimalsResponse detectKitchenAnimalsResponse, UnmarshallerContext _ctx) {<NEW_LINE>detectKitchenAnimalsResponse.setRequestId<MASK><NEW_LINE>detectKitchenAnimalsResponse.setCode(_ctx.stringValue("DetectKitchenAnimalsResponse.Code"));<NEW_LINE>detectKitchenAnimalsResponse.setMessage(_ctx.stringValue("DetectKitchenAnimalsResponse.Message"));<NEW_LINE>Data data = new Data();<NEW_LINE>List<ElementsItem> elements = new ArrayList<ElementsItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DetectKitchenAnimalsResponse.Data.Elements.Length"); i++) {<NEW_LINE>ElementsItem elementsItem = new ElementsItem();<NEW_LINE>elementsItem.setType(_ctx.stringValue("DetectKitchenAnimalsResponse.Data.Elements[" + i + "].Type"));<NEW_LINE>elementsItem.setScore(_ctx.floatValue("DetectKitchenAnimalsResponse.Data.Elements[" + i + "].Score"));<NEW_LINE>Rectangles rectangles = new Rectangles();<NEW_LINE>rectangles.setTop(_ctx.longValue("DetectKitchenAnimalsResponse.Data.Elements[" + i + "].Rectangles.Top"));<NEW_LINE>rectangles.setLeft(_ctx.longValue("DetectKitchenAnimalsResponse.Data.Elements[" + i + "].Rectangles.Left"));<NEW_LINE>rectangles.setHeight(_ctx.longValue("DetectKitchenAnimalsResponse.Data.Elements[" + i + "].Rectangles.Height"));<NEW_LINE>rectangles.setWidth(_ctx.longValue("DetectKitchenAnimalsResponse.Data.Elements[" + i + "].Rectangles.Width"));<NEW_LINE>elementsItem.setRectangles(rectangles);<NEW_LINE>elements.add(elementsItem);<NEW_LINE>}<NEW_LINE>data.setElements(elements);<NEW_LINE>detectKitchenAnimalsResponse.setData(data);<NEW_LINE>return detectKitchenAnimalsResponse;<NEW_LINE>} | (_ctx.stringValue("DetectKitchenAnimalsResponse.RequestId")); |
1,485,625 | public void computeExpectations(ArrayList<SumLattice> lattices) {<NEW_LINE>@Var<NEW_LINE>double[][] gammas;<NEW_LINE>IntArrayList cache = new IntArrayList();<NEW_LINE>for (int i = 0; i < lattices.size(); i++) {<NEW_LINE>if (lattices.get(i) == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>SumLattice lattice = lattices.get(i);<NEW_LINE>FeatureVectorSequence fvs = <MASK><NEW_LINE>gammas = lattice.getGammas();<NEW_LINE>for (int ip = 0; ip < fvs.size(); ++ip) {<NEW_LINE>cache.clear();<NEW_LINE>FeatureVector fv = fvs.getFeatureVector(ip);<NEW_LINE>@Var<NEW_LINE>int fi;<NEW_LINE>for (int loc = 0; loc < fv.numLocations(); loc++) {<NEW_LINE>fi = fv.indexAtLocation(loc);<NEW_LINE>// binary constraint features<NEW_LINE>if (constraints.containsKey(fi)) {<NEW_LINE>cache.add(fi);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (constraints.containsKey(fv.getAlphabet().size())) {<NEW_LINE>cache.add(fv.getAlphabet().size());<NEW_LINE>}<NEW_LINE>for (int s = 0; s < map.getNumStates(); ++s) {<NEW_LINE>int li = map.getLabelIndex(s);<NEW_LINE>if (li != StateLabelMap.START_LABEL) {<NEW_LINE>double gammaProb = Math.exp(gammas[ip + 1][s]);<NEW_LINE>for (int j = 0; j < cache.size(); j++) {<NEW_LINE>constraints.get(cache.get(j)).expectation[li] += gammaProb;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (FeatureVectorSequence) lattice.getInput(); |
1,418,406 | private void insert(QNm field, Sequence value, JsonNodeTrx trx) {<NEW_LINE>final var fieldName = field.getLocalName();<NEW_LINE>if (value instanceof Atomic) {<NEW_LINE>if (value instanceof Str) {<NEW_LINE>trx.insertObjectRecordAsLastChild(fieldName, new StringValue(((Str) value).stringValue()));<NEW_LINE>} else if (value instanceof Null) {<NEW_LINE>trx.insertObjectRecordAsLastChild(fieldName, new NullValue());<NEW_LINE>} else if (value instanceof Numeric) {<NEW_LINE>if (value instanceof Int) {<NEW_LINE>trx.insertObjectRecordAsLastChild(fieldName, new NumberValue(((Int) value).intValue()));<NEW_LINE>} else if (value instanceof Int32) {<NEW_LINE>trx.insertObjectRecordAsLastChild(fieldName, new NumberValue(((Int32) <MASK><NEW_LINE>} else if (value instanceof Int64) {<NEW_LINE>trx.insertObjectRecordAsLastChild(fieldName, new NumberValue(((Int64) value).longValue()));<NEW_LINE>} else if (value instanceof Flt) {<NEW_LINE>trx.insertObjectRecordAsLastChild(fieldName, new NumberValue(((Flt) value).floatValue()));<NEW_LINE>} else if (value instanceof Dbl) {<NEW_LINE>trx.insertObjectRecordAsLastChild(fieldName, new NumberValue(((Dbl) value).doubleValue()));<NEW_LINE>} else if (value instanceof Dec) {<NEW_LINE>trx.insertObjectRecordAsLastChild(fieldName, new NumberValue(((Dec) value).decimalValue()));<NEW_LINE>}<NEW_LINE>} else if (value instanceof Bool) {<NEW_LINE>trx.insertObjectRecordAsLastChild(fieldName, new BooleanValue(value.booleanValue()));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>final Item item = ExprUtil.asItem(value);<NEW_LINE>if (item.itemType() == ArrayType.ARRAY) {<NEW_LINE>trx.insertObjectRecordAsLastChild(fieldName, new ArrayValue());<NEW_LINE>} else if (item.itemType() == ObjectType.OBJECT) {<NEW_LINE>trx.insertObjectRecordAsLastChild(fieldName, new ObjectValue());<NEW_LINE>}<NEW_LINE>trx.moveToFirstChild();<NEW_LINE>trx.insertSubtreeAsFirstChild(item, JsonNodeTrx.Commit.NO, JsonNodeTrx.CheckParentNode.YES, JsonNodeTrx.SkipRootToken.YES);<NEW_LINE>}<NEW_LINE>} | value).intValue())); |
1,364,137 | public void initWithNiwsConfig(IClientConfig clientConfig) {<NEW_LINE>super.initWithNiwsConfig(clientConfig);<NEW_LINE>this.ncc = clientConfig;<NEW_LINE>this.restClientName = ncc.getClientName();<NEW_LINE>this.isSecure = ncc.get(CommonClientConfigKey.IsSecure, this.isSecure);<NEW_LINE>this.isHostnameValidationRequired = ncc.get(CommonClientConfigKey.IsHostnameValidationRequired, this.isHostnameValidationRequired);<NEW_LINE>this.isClientAuthRequired = ncc.get(CommonClientConfigKey.IsClientAuthRequired, this.isClientAuthRequired);<NEW_LINE>this.bFollowRedirects = ncc.get(CommonClientConfigKey.FollowRedirects, true);<NEW_LINE>this.ignoreUserToken = ncc.get(CommonClientConfigKey.IgnoreUserTokenInConnectionPoolForSecureClient, this.ignoreUserToken);<NEW_LINE><MASK><NEW_LINE>this.config.getProperties().put(ApacheHttpClient4Config.PROPERTY_CONNECT_TIMEOUT, ncc.get(CommonClientConfigKey.ConnectTimeout));<NEW_LINE>this.config.getProperties().put(ApacheHttpClient4Config.PROPERTY_READ_TIMEOUT, ncc.get(CommonClientConfigKey.ReadTimeout));<NEW_LINE>this.restClient = apacheHttpClientSpecificInitialization();<NEW_LINE>this.setRetryHandler(new HttpClientLoadBalancerErrorHandler(ncc));<NEW_LINE>} | this.config = new DefaultApacheHttpClient4Config(); |
954,997 | public static void verifyItem(JRVerifier verifier, Item item, String itemName, String[] requiredNames, Map<String, String> alternativeNamesMap) {<NEW_LINE>if (requiredNames != null && requiredNames.length > 0) {<NEW_LINE>List<ItemProperty<MASK><NEW_LINE>if (itemProperties != null && !itemProperties.isEmpty()) {<NEW_LINE>for (String reqName : requiredNames) {<NEW_LINE>boolean hasProperty = false;<NEW_LINE>for (ItemProperty itemProperty : itemProperties) {<NEW_LINE>if (itemProperty.getName().equals(reqName) || (alternativeNamesMap != null && itemProperty.getName().equals(alternativeNamesMap.get(reqName)))) {<NEW_LINE>hasProperty = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!hasProperty) {<NEW_LINE>verifier.addBrokenRule("No '" + reqName + "' property set for the " + itemName + " item.", itemProperties);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | > itemProperties = item.getProperties(); |
1,443,106 | protected String[] calculateAbilityDisplayValues(Player player) {<NEW_LINE>// TODO: Needed?<NEW_LINE>if (UserManager.getPlayer(player) == null) {<NEW_LINE>player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));<NEW_LINE>return new String[] { "DATA NOT LOADED", "DATA NOT LOADED" };<NEW_LINE>}<NEW_LINE>AlchemyManager alchemyManager = UserManager.getPlayer(player).getAlchemyManager();<NEW_LINE>String[<MASK><NEW_LINE>boolean isLucky = Permissions.lucky(player, PrimarySkillType.ALCHEMY);<NEW_LINE>displayValues[0] = decimal.format(alchemyManager.calculateBrewSpeed(false)) + "x";<NEW_LINE>displayValues[1] = isLucky ? decimal.format(alchemyManager.calculateBrewSpeed(true)) + "x" : null;<NEW_LINE>return displayValues;<NEW_LINE>} | ] displayValues = new String[2]; |
1,045,248 | public void checkExistingData(SessionLocal session) {<NEW_LINE>if (session.getDatabase().isStarting()) {<NEW_LINE>// don't check at startup<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>StringBuilder builder = new StringBuilder("SELECT 1 FROM (SELECT ");<NEW_LINE>IndexColumn.writeColumns(builder, columns, IndexColumn.SQL_NO_ORDER);<NEW_LINE>builder.append(" FROM ");<NEW_LINE>table.getSQL(builder, DEFAULT_SQL_FLAGS).append(" WHERE ");<NEW_LINE>IndexColumn.writeColumns(builder, columns, " AND ", " IS NOT NULL ", IndexColumn.SQL_NO_ORDER);<NEW_LINE>builder.append(" ORDER BY ");<NEW_LINE>IndexColumn.writeColumns(builder, columns, DEFAULT_SQL_FLAGS);<NEW_LINE>builder.append(") C WHERE NOT EXISTS(SELECT 1 FROM ");<NEW_LINE>refTable.getSQL(builder, DEFAULT_SQL_FLAGS).append(" P WHERE ");<NEW_LINE>for (int i = 0, l = columns.length; i < l; i++) {<NEW_LINE>if (i > 0) {<NEW_LINE>builder.append(" AND ");<NEW_LINE>}<NEW_LINE>builder.append("C.");<NEW_LINE>columns[i].column.getSQL(builder, DEFAULT_SQL_FLAGS).append<MASK><NEW_LINE>refColumns[i].column.getSQL(builder, DEFAULT_SQL_FLAGS);<NEW_LINE>}<NEW_LINE>builder.append(')');<NEW_LINE>session.startStatementWithinTransaction(null);<NEW_LINE>try {<NEW_LINE>ResultInterface r = session.prepare(builder.toString()).query(1);<NEW_LINE>if (r.next()) {<NEW_LINE>throw DbException.get(ErrorCode.REFERENTIAL_INTEGRITY_VIOLATED_PARENT_MISSING_1, getShortDescription(null, null));<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>session.endStatement();<NEW_LINE>}<NEW_LINE>} | ('=').append("P."); |
931,708 | private boolean decode(MicroQrCode qr) {<NEW_LINE>qr<MASK><NEW_LINE>// Convert pixel values into format bit values<NEW_LINE>if (!readFormatBitValues(qr)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// Save the mapping from marker to pixel space as well as the location inside the image<NEW_LINE>// Doing it here so if you look at a failed marker you know where it was<NEW_LINE>qr.Hinv.setTo(gridReader.getTransformGrid().Hinv);<NEW_LINE>if (!decodeFormatBitValues(qr)) {<NEW_LINE>// Set the bounds to the position pattern since we don't know the version and can't infer the bounds<NEW_LINE>qr.bounds.setTo(qr.pp);<NEW_LINE>if (verbose != null)<NEW_LINE>verbose.print("_ failed: reading format\n");<NEW_LINE>qr.failureCause = QrCode.Failure.FORMAT;<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// Save where the marker is now that the version is known<NEW_LINE>setBoundsOfMarker(qr);<NEW_LINE>if (verbose != null)<NEW_LINE>verbose.printf("valid: version=%d error=%s mask=%s\n", qr.version, qr.error, qr.mask);<NEW_LINE>if (!readRawData(qr)) {<NEW_LINE>if (verbose != null)<NEW_LINE>verbose.print("_ failed: reading bits\n");<NEW_LINE>qr.failureCause = QrCode.Failure.READING_BITS;<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (!decoder.applyErrorCorrection(qr)) {<NEW_LINE>if (verbose != null)<NEW_LINE>verbose.print("_ failed: error correction\n");<NEW_LINE>qr.failureCause = QrCode.Failure.ERROR_CORRECTION;<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (!decoder.decodeMessage(qr)) {<NEW_LINE>if (verbose != null)<NEW_LINE>verbose.print("_ failed: decoding message\n");<NEW_LINE>qr.failureCause = QrCode.Failure.DECODING_MESSAGE;<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (verbose != null)<NEW_LINE>verbose.printf("_ success: message='%s'\n", qr.message);<NEW_LINE>return true;<NEW_LINE>} | .failureCause = QrCode.Failure.NONE; |
1,127,327 | private void addItems() {<NEW_LINE>mTextFieldHelper = new CocosTextHelper(getTextField());<NEW_LINE>getTextField().setBubbleSize(0, 0);<NEW_LINE>mButton = (Button) findComponentById(ResourceTable.Id_editbox_enterBtn);<NEW_LINE>mButton.setTouchEventListener(new Component.TouchEventListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean onTouchEvent(Component component, TouchEvent touchEvent) {<NEW_LINE>CocosEditBoxAbility.this.onKeyboardConfirm(CocosEditBoxAbility.this.<MASK><NEW_LINE>if (!CocosEditBoxAbility.this.mConfirmHold && touchEvent.getAction() == TouchEvent.PRIMARY_POINT_DOWN)<NEW_LINE>CocosEditBoxAbility.this.hide();<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// When touch area outside EditText and soft keyboard, then hide.<NEW_LINE>Component layout = findComponentById(ResourceTable.Id_editbox_container);<NEW_LINE>layout.setTouchEventListener(new Component.TouchEventListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public boolean onTouchEvent(Component component, TouchEvent touchEvent) {<NEW_LINE>if (touchEvent.getAction() == TouchEvent.PRIMARY_POINT_DOWN) {<NEW_LINE>CocosEditBoxAbility.this.hide();<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>// layout.setLayoutRefreshedListener(new Component.LayoutRefreshedListener() {<NEW_LINE>// @Override<NEW_LINE>// public void onRefreshed(Component component) {<NEW_LINE>// // detect keyboard re-layout?<NEW_LINE>// HiLog.debug(LABEL, component.getClass().getSimpleName());<NEW_LINE>// }<NEW_LINE>// });<NEW_LINE>} | getTextField().getText()); |
1,712,547 | protected void invalidateTable(String databaseName, String tableName) {<NEW_LINE>HiveTableName hiveTableName = hiveTableName(databaseName, tableName);<NEW_LINE>tableCache.asMap().keySet().stream().filter(hiveTableNameKey -> hiveTableNameKey.getKey().equals(hiveTableName)).forEach(tableCache::invalidate);<NEW_LINE>tableNamesCache.asMap().keySet().stream().filter(tableNameKey -> tableNameKey.getKey().equals(databaseName)).forEach(tableNamesCache::invalidate);<NEW_LINE>viewNamesCache.asMap().keySet().stream().filter(viewNameKey -> viewNameKey.getKey().equals(databaseName)).forEach(viewNamesCache::invalidate);<NEW_LINE>tablePrivilegesCache.asMap().keySet().stream().filter(userTableKey -> userTableKey.getKey().matches(databaseName, tableName)<MASK><NEW_LINE>tableStatisticsCache.asMap().keySet().stream().filter(hiveTableNameKey -> hiveTableNameKey.getKey().equals(hiveTableName)).forEach(tableStatisticsCache::invalidate);<NEW_LINE>invalidatePartitionCache(databaseName, tableName);<NEW_LINE>} | ).forEach(tablePrivilegesCache::invalidate); |
525,821 | final ListBuildBatchesForProjectResult executeListBuildBatchesForProject(ListBuildBatchesForProjectRequest listBuildBatchesForProjectRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listBuildBatchesForProjectRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListBuildBatchesForProjectRequest> request = null;<NEW_LINE>Response<ListBuildBatchesForProjectResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListBuildBatchesForProjectRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listBuildBatchesForProjectRequest));<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, "CodeBuild");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListBuildBatchesForProject");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListBuildBatchesForProjectResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListBuildBatchesForProjectResultJsonUnmarshaller());<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | invoke(request, responseHandler, executionContext); |
1,189,815 | public static void serializeVector(ByteBuf buf, IntFloatVector vector) {<NEW_LINE>StorageMethod method = getStorageMethod(vector);<NEW_LINE>if (method == StorageMethod.SPARSE) {<NEW_LINE>// Sparse storage, use the iterator to avoid array copy<NEW_LINE>ObjectIterator<Int2FloatMap.Entry> iter = vector.getStorage().entryIterator();<NEW_LINE>int sizeIndex = buf.writerIndex();<NEW_LINE>buf.writeInt(0);<NEW_LINE>buf.writeInt(SerializeArrangement.KEY_VALUE.getValue());<NEW_LINE>Int2FloatMap.Entry entry;<NEW_LINE>int elemNum = 0;<NEW_LINE>while (iter.hasNext()) {<NEW_LINE>entry = iter.next();<NEW_LINE>buf.writeInt(entry.getIntKey());<NEW_LINE>buf.writeFloat(entry.getFloatValue());<NEW_LINE>elemNum++;<NEW_LINE>}<NEW_LINE>buf.setInt(sizeIndex, elemNum);<NEW_LINE>} else if (method == StorageMethod.SORTED) {<NEW_LINE>// Get the array pair<NEW_LINE>int[] indices = vector.getStorage().getIndices();<NEW_LINE>float[] values = vector.getStorage().getValues();<NEW_LINE><MASK><NEW_LINE>buf.writeInt(SerializeArrangement.KEY_VALUE.getValue());<NEW_LINE>for (int i = 0; i < indices.length; i++) {<NEW_LINE>buf.writeInt(indices[i]);<NEW_LINE>buf.writeFloat(values[i]);<NEW_LINE>}<NEW_LINE>} else if (method == StorageMethod.DENSE) {<NEW_LINE>float[] values = vector.getStorage().getValues();<NEW_LINE>buf.writeInt(values.length);<NEW_LINE>buf.writeInt(SerializeArrangement.VALUE.getValue());<NEW_LINE>for (int i = 0; i < values.length; i++) {<NEW_LINE>buf.writeFloat(values[i]);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new UnsupportedOperationException("Unknown vector storage type:" + vector.getStorage().getClass().getName());<NEW_LINE>}<NEW_LINE>} | buf.writeInt(indices.length); |
29,033 | public EvaluationMetricResult evaluate(Aggregations aggs) {<NEW_LINE>long[] tp = new long[thresholds.length];<NEW_LINE>long[] fp = new long[thresholds.length];<NEW_LINE>long[] tn = new long[thresholds.length];<NEW_LINE>long[] fn <MASK><NEW_LINE>for (int i = 0; i < thresholds.length; i++) {<NEW_LINE>Filter tpAgg = aggs.get(aggName(thresholds[i], Condition.TP));<NEW_LINE>Filter fpAgg = aggs.get(aggName(thresholds[i], Condition.FP));<NEW_LINE>Filter tnAgg = aggs.get(aggName(thresholds[i], Condition.TN));<NEW_LINE>Filter fnAgg = aggs.get(aggName(thresholds[i], Condition.FN));<NEW_LINE>tp[i] = tpAgg.getDocCount();<NEW_LINE>fp[i] = fpAgg.getDocCount();<NEW_LINE>tn[i] = tnAgg.getDocCount();<NEW_LINE>fn[i] = fnAgg.getDocCount();<NEW_LINE>}<NEW_LINE>return new Result(thresholds, tp, fp, tn, fn);<NEW_LINE>} | = new long[thresholds.length]; |
1,645,911 | static // Can be implemented with TreeSet (lower, remove, add)<NEW_LINE>// Can be implemented with TreeSet (lower, remove, add)<NEW_LINE>int // Can be implemented with TreeSet (lower, remove, add)<NEW_LINE>lis(// Can be implemented with TreeSet (lower, remove, add)<NEW_LINE>int[] A, int n) {<NEW_LINE>ArrayList<Integer> L = new ArrayList<Integer>();<NEW_LINE>int[] P = new int[n];<NEW_LINE>int[] L_id = new int[n];<NEW_LINE>int <MASK><NEW_LINE>for (int i = 0; i < n; ++i) {<NEW_LINE>int pos = Collections.binarySearch(L, A[i]);<NEW_LINE>if (pos < 0)<NEW_LINE>pos = -(pos + 1);<NEW_LINE>if (pos >= L.size())<NEW_LINE>L.add(A[i]);<NEW_LINE>else<NEW_LINE>L.set(pos, A[i]);<NEW_LINE>if (pos + 1 > lis) {<NEW_LINE>lis = pos + 1;<NEW_LINE>lis_end = i;<NEW_LINE>}<NEW_LINE>// lis_end and the following part for printing the solution<NEW_LINE>L_id[pos] = i;<NEW_LINE>P[i] = pos > 0 ? L_id[pos - 1] : -1;<NEW_LINE>}<NEW_LINE>stack = new Stack<Integer>();<NEW_LINE>while (lis_end != -1) {<NEW_LINE>stack.push(A[lis_end]);<NEW_LINE>lis_end = P[lis_end];<NEW_LINE>}<NEW_LINE>return lis;<NEW_LINE>} | lis = 0, lis_end = -1; |
879,750 | public static ClientMessage encodeRequest(java.lang.String name, java.util.UUID txnId, long threadId, com.hazelcast.internal.serialization.Data key, com.hazelcast.internal.serialization.Data value) {<NEW_LINE><MASK><NEW_LINE>clientMessage.setRetryable(false);<NEW_LINE>clientMessage.setOperationName("TransactionalMultiMap.RemoveEntry");<NEW_LINE>ClientMessage.Frame initialFrame = new ClientMessage.Frame(new byte[REQUEST_INITIAL_FRAME_SIZE], UNFRAGMENTED_MESSAGE);<NEW_LINE>encodeInt(initialFrame.content, TYPE_FIELD_OFFSET, REQUEST_MESSAGE_TYPE);<NEW_LINE>encodeInt(initialFrame.content, PARTITION_ID_FIELD_OFFSET, -1);<NEW_LINE>encodeUUID(initialFrame.content, REQUEST_TXN_ID_FIELD_OFFSET, txnId);<NEW_LINE>encodeLong(initialFrame.content, REQUEST_THREAD_ID_FIELD_OFFSET, threadId);<NEW_LINE>clientMessage.add(initialFrame);<NEW_LINE>StringCodec.encode(clientMessage, name);<NEW_LINE>DataCodec.encode(clientMessage, key);<NEW_LINE>DataCodec.encode(clientMessage, value);<NEW_LINE>return clientMessage;<NEW_LINE>} | ClientMessage clientMessage = ClientMessage.createForEncode(); |
906,190 | private String formatModules(Collection<String> data) {<NEW_LINE>boolean oddRow = false;<NEW_LINE>Color oddRowBackground = UIUtils.getDarker(UIUtils.getProfilerResultsBackground());<NEW_LINE>// NOI18N<NEW_LINE>String // NOI18N<NEW_LINE>oddRowBackgroundString = // NOI18N<NEW_LINE>"rgb(" + oddRowBackground.getRed() + "," + oddRowBackground.getGreen() + "," + // NOI18N<NEW_LINE>oddRowBackground.getBlue() + ")";<NEW_LINE>// NOI18N<NEW_LINE>StringBuilder sb = new StringBuilder("<table border='0' cellpadding='2' cellspacing='0' width='100%'>");<NEW_LINE>for (String string : data) {<NEW_LINE>sb.append(// NOI18N<NEW_LINE>oddRow ? // NOI18N<NEW_LINE>"<tr><td style='background-color: " + oddRowBackgroundString + ";'>" : "<tr><td>");<NEW_LINE>oddRow = !oddRow;<NEW_LINE>// NOI18N<NEW_LINE>sb.append(string<MASK><NEW_LINE>// NOI18N<NEW_LINE>sb.append("</td></tr>");<NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>sb.append("</table>");<NEW_LINE>return expandInvalidXMLChars(sb);<NEW_LINE>} | .replace(" ", " ")); |
827,826 | private List<CountAtBucket> nonZeroBuckets() {<NEW_LINE>List<CountAtBucket> buckets = new ArrayList<>();<NEW_LINE>long zeroSnap = zeros.get();<NEW_LINE>if (zeroSnap > 0) {<NEW_LINE>buckets.add(new CountAtBucket(UPPER_BOUNDS[getRangeIndex(ZERO.bucketIdx, ZERO.offset)], zeroSnap));<NEW_LINE>}<NEW_LINE>long lowerSnap = lower.get();<NEW_LINE>if (lowerSnap > 0) {<NEW_LINE>buckets.add(new CountAtBucket(UPPER_BOUNDS[getRangeIndex(LOWER.bucketIdx, LOWER.offset)], lowerSnap));<NEW_LINE>}<NEW_LINE>long upperSnap = upper.get();<NEW_LINE>if (upperSnap > 0) {<NEW_LINE>buckets.add(new CountAtBucket(UPPER_BOUNDS[getRangeIndex(UPPER.bucketIdx, UPPER.offset)], upperSnap));<NEW_LINE>}<NEW_LINE>for (int i = 0; i < values.length(); i++) {<NEW_LINE>AtomicLongArray <MASK><NEW_LINE>if (bucket != null) {<NEW_LINE>for (int j = 0; j < bucket.length(); j++) {<NEW_LINE>long cnt = bucket.get(j);<NEW_LINE>if (cnt > 0) {<NEW_LINE>buckets.add(new CountAtBucket(UPPER_BOUNDS[getRangeIndex(i, j)], cnt));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return buckets;<NEW_LINE>} | bucket = values.get(i); |
912,651 | public Response makeResponse(FitNesseContext context, Request request) throws Exception {<NEW_LINE>WikiPage page = getRequestedPage(request, context);<NEW_LINE>if (page == null)<NEW_LINE>return new NotFoundResponder().makeResponse(context, request);<NEW_LINE>if ("pages".equals(request.getInput("type"))) {<NEW_LINE>PageXmlizer pageXmlizer = new PageXmlizer();<NEW_LINE>pageXmlizer.addPageCondition(xmlizePageCondition);<NEW_LINE>Document doc = pageXmlizer.xmlize(page);<NEW_LINE>SimpleResponse response = makeResponseWithxml(doc);<NEW_LINE>return response;<NEW_LINE>} else if ("data".equals(request.getInput("type"))) {<NEW_LINE>Document doc = new PageXmlizer().xmlize(page.getData());<NEW_LINE>SimpleResponse response = makeResponseWithxml(doc);<NEW_LINE>return response;<NEW_LINE>} else {<NEW_LINE>Object <MASK><NEW_LINE>byte[] bytes = serializeToBytes(object);<NEW_LINE>return responseWith(bytes);<NEW_LINE>}<NEW_LINE>} | object = getObjectToSerialize(request, page); |
514,412 | public Node writeDescriptor(Node parent, String nodeName, ConnectionFactoryDefinitionDescriptor desc) {<NEW_LINE>Node node = appendChild(parent, nodeName);<NEW_LINE>appendTextChild(node, TagNames.CONNECTION_FACTORY_DESCRIPTION, desc.getDescription());<NEW_LINE>appendTextChild(node, TagNames.CONNECTION_FACTORY_NAME, desc.getName());<NEW_LINE>appendTextChild(node, TagNames.CONNECTION_FACTORY_INTERFACE_NAME, desc.getInterfaceName());<NEW_LINE>// change the resource adapter name from internal format to standard format<NEW_LINE>String resourceAdapterName = desc.getResourceAdapter();<NEW_LINE>int <MASK><NEW_LINE>if (poundIndex > 0) {<NEW_LINE>// the internal format of resource adapter name is "appName#raName", remove the appName part<NEW_LINE>resourceAdapterName = resourceAdapterName.substring(poundIndex);<NEW_LINE>} else if (poundIndex == 0) {<NEW_LINE>// the resource adapter name should not be the standard format "#raName" here<NEW_LINE>DOLUtils.getDefaultLogger().log(Level.WARNING, RESOURCE_ADAPTER_NAME_INVALID, new Object[] { desc.getName(), desc.getResourceAdapter() });<NEW_LINE>} else {<NEW_LINE>// the resource adapter name represent the standalone RA in this case.<NEW_LINE>}<NEW_LINE>appendTextChild(node, TagNames.CONNECTION_FACTORY_ADAPTER, resourceAdapterName);<NEW_LINE>appendTextChild(node, TagNames.CONNECTION_FACTORY_MAX_POOL_SIZE, desc.getMaxPoolSize());<NEW_LINE>appendTextChild(node, TagNames.CONNECTION_FACTORY_MIN_POOL_SIZE, desc.getMinPoolSize());<NEW_LINE>appendTextChild(node, TagNames.CONNECTION_FACTORY_TRANSACTION_SUPPORT, desc.getTransactionSupport());<NEW_LINE>ResourcePropertyNode propertyNode = new ResourcePropertyNode();<NEW_LINE>propertyNode.writeDescriptor(node, desc);<NEW_LINE>return node;<NEW_LINE>} | poundIndex = resourceAdapterName.indexOf('#'); |
165,251 | public DescribeEntitlementsResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>DescribeEntitlementsResult describeEntitlementsResult = new DescribeEntitlementsResult();<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 describeEntitlementsResult;<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("Entitlements", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>describeEntitlementsResult.setEntitlements(new ListUnmarshaller<Entitlement>(EntitlementJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("NextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>describeEntitlementsResult.setNextToken(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return describeEntitlementsResult;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
605,621 | private boolean embed(TaskEvent e) {<NEW_LINE>JavaFileObject sourceFile = e.getSourceFile();<NEW_LINE>if (!sourceFile.equals(_sourceFile)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>IFile file;<NEW_LINE>try {<NEW_LINE>file = getHost().getFileSystem().getIFile(sourceFile.toUri().toURL());<NEW_LINE>} catch (Exception ex) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>ExpressionTree pkg = e.getCompilationUnit().getPackageName();<NEW_LINE>if (pkg == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>FileFragmentImpl fragment = new FileFragmentImpl(_scope, _name, _ext, _hostKind, file, _offset, _content.length(), _content);<NEW_LINE>JavacManifoldHost host = JavacPlugin<MASK><NEW_LINE>Set<ITypeManifold> tms = host.getSingleModule().findTypeManifoldsFor(fragment, t -> t.getContributorKind() != Supplemental);<NEW_LINE>ITypeManifold tm = tms.stream().findFirst().orElse(null);<NEW_LINE>if (tm == null) {<NEW_LINE>// ## todo: add compile warning<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>// ensure path cache is created before creation notify<NEW_LINE>host.getSingleModule().getPathCache();<NEW_LINE>String fqn = PathCache.qualifyName(pkg.toString(), _name);<NEW_LINE>host.createdType(fragment, new String[] { fqn });<NEW_LINE>return true;<NEW_LINE>} | .instance().getHost(); |
978,973 | private Sequence record(Table srcTable, Context ctx) {<NEW_LINE>if (param == null) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("record" + mm.getMessage("function.missingParam"));<NEW_LINE>}<NEW_LINE>Expression srcExp;<NEW_LINE>int pos = 0;<NEW_LINE>if (param.isLeaf()) {<NEW_LINE>srcExp = param.getLeafExpression();<NEW_LINE>} else {<NEW_LINE>if (param.getSubSize() != 2) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("record" <MASK><NEW_LINE>}<NEW_LINE>IParam sub1 = param.getSub(0);<NEW_LINE>IParam sub2 = param.getSub(1);<NEW_LINE>if (sub1 == null || sub2 == null) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("record" + mm.getMessage("function.invalidParam"));<NEW_LINE>}<NEW_LINE>srcExp = sub1.getLeafExpression();<NEW_LINE>Object posObj = sub2.getLeafExpression().calculate(ctx);<NEW_LINE>if (!(posObj instanceof Number)) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("record" + mm.getMessage("function.paramTypeError"));<NEW_LINE>}<NEW_LINE>pos = ((Number) posObj).intValue();<NEW_LINE>}<NEW_LINE>Object src = srcExp.calculate(ctx);<NEW_LINE>if (src instanceof Sequence) {<NEW_LINE>return srcTable.record(pos, (Sequence) src, option);<NEW_LINE>} else if (src == null) {<NEW_LINE>return srcTable;<NEW_LINE>} else {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("record" + mm.getMessage("function.paramTypeError"));<NEW_LINE>}<NEW_LINE>} | + mm.getMessage("function.invalidParam")); |
1,784,956 | public static void shiftValueIntoFlags(final ITranslationEnvironment environment, final long offset, final String value, final OperandSize size, final List<ReilInstruction> instructions) throws IllegalArgumentException {<NEW_LINE>Preconditions.checkNotNull(environment, "Error: Argument environment can't be null");<NEW_LINE>Preconditions.checkNotNull(value, "Error: Argument value can't be null");<NEW_LINE>Preconditions.checkNotNull(size, "Error: Argument size can't be null");<NEW_LINE>Preconditions.checkNotNull(instructions, "Error: Argument instructions can't be null");<NEW_LINE>final <MASK><NEW_LINE>final String afInLsb = environment.getNextVariableString();<NEW_LINE>final String zfInLsb = environment.getNextVariableString();<NEW_LINE>final String sfInLsb = environment.getNextVariableString();<NEW_LINE>final String ofInLsb = environment.getNextVariableString();<NEW_LINE>instructions.add(ReilHelpers.createAnd(offset, size, value, size, "1", OperandSize.BYTE, Helpers.CARRY_FLAG));<NEW_LINE>instructions.add(ReilHelpers.createBsh(offset + 1, size, value, size, "-2", size, pfInLsb));<NEW_LINE>instructions.add(ReilHelpers.createAnd(offset + 2, size, pfInLsb, size, "1", OperandSize.BYTE, Helpers.PARITY_FLAG));<NEW_LINE>instructions.add(ReilHelpers.createBsh(offset + 3, size, value, size, "-4", size, afInLsb));<NEW_LINE>instructions.add(ReilHelpers.createAnd(offset + 4, size, afInLsb, size, "1", OperandSize.BYTE, Helpers.AUXILIARY_FLAG));<NEW_LINE>instructions.add(ReilHelpers.createBsh(offset + 5, size, value, size, "-6", size, zfInLsb));<NEW_LINE>instructions.add(ReilHelpers.createAnd(offset + 6, size, zfInLsb, size, "1", OperandSize.BYTE, Helpers.ZERO_FLAG));<NEW_LINE>instructions.add(ReilHelpers.createBsh(offset + 7, size, value, size, "-7", size, sfInLsb));<NEW_LINE>instructions.add(ReilHelpers.createAnd(offset + 8, size, sfInLsb, size, "1", OperandSize.BYTE, Helpers.SIGN_FLAG));<NEW_LINE>instructions.add(ReilHelpers.createBsh(offset + 9, size, value, size, "-11", size, ofInLsb));<NEW_LINE>instructions.add(ReilHelpers.createAnd(offset + 10, size, ofInLsb, size, "1", OperandSize.BYTE, Helpers.OVERFLOW_FLAG));<NEW_LINE>} | String pfInLsb = environment.getNextVariableString(); |
609,439 | public Object call(ExecutionContext context, Object self, Object... args) {<NEW_LINE>if (!(self instanceof DynDate)) {<NEW_LINE>throw new ThrowException(context, context.createTypeError("setYear(...) may only be used with Dates"));<NEW_LINE>}<NEW_LINE>DynDate dateObj = (DynDate) self;<NEW_LINE>long t = localTime(context, dateObj.getTimeValue());<NEW_LINE>Number y = Types.toNumber(context, args[0]);<NEW_LINE>if (Double.isNaN(y.doubleValue())) {<NEW_LINE>dateObj.setTimeValue(Double.NaN);<NEW_LINE>return Double.NaN;<NEW_LINE>}<NEW_LINE>long year = y.longValue() + 1900;<NEW_LINE>Number m = null;<NEW_LINE>if (args[1] != Types.UNDEFINED) {<NEW_LINE>m = Types.toNumber(context, args[1]);<NEW_LINE>} else {<NEW_LINE>m = monthFromTime(t);<NEW_LINE>}<NEW_LINE>Number dt = null;<NEW_LINE>if (args[1] != Types.UNDEFINED) {<NEW_LINE>dt = Types.toNumber<MASK><NEW_LINE>} else {<NEW_LINE>dt = dateFromTime(t);<NEW_LINE>}<NEW_LINE>Number newDate = makeDate(context, makeDay(context, year, m, dt), timeWithinDay(t));<NEW_LINE>Number u = timeClip(context, utc(context, newDate));<NEW_LINE>dateObj.setTimeValue(u);<NEW_LINE>return u;<NEW_LINE>} | (context, args[2]); |
1,467,092 | public Scorer scorer(LeafReaderContext context) throws IOException {<NEW_LINE>Sort segmentSort = context.reader()<MASK><NEW_LINE>if (EarlyTerminatingSortingCollector.canEarlyTerminate(sort, segmentSort) == false) {<NEW_LINE>throw new IOException("search sort :[" + sort.getSort() + "] does not match the index sort:[" + segmentSort + "]");<NEW_LINE>}<NEW_LINE>final int afterDoc = after.doc - context.docBase;<NEW_LINE>TopComparator comparator = getTopComparator(fieldComparators, reverseMuls, context, afterDoc);<NEW_LINE>final int maxDoc = context.reader().maxDoc();<NEW_LINE>final int firstDoc = searchAfterDoc(comparator, 0, context.reader().maxDoc());<NEW_LINE>if (firstDoc >= maxDoc) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final DocIdSetIterator disi = new MinDocQuery.MinDocIterator(firstDoc, maxDoc);<NEW_LINE>return new ConstantScoreScorer(this, score(), disi);<NEW_LINE>} | .getMetaData().getSort(); |
1,266,894 | /*<NEW_LINE>* @see com.linkedin.databus2.monitors.db.EventFactory#createEvent(long, long, java.sql.ResultSet)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public long createAndAppendEvent(long scn, long timestamp, GenericRecord record, ResultSet row, DbusEventBufferAppendable eventBuffer, boolean enableTracing, boolean isReplicated, DbusEventsStatisticsCollector dbusEventsStatisticsCollector) throws EventCreationException, UnsupportedKeyException {<NEW_LINE>if (!(eventBuffer instanceof BootstrapEventBuffer))<NEW_LINE>throw new RuntimeException("Expected BootstrapEventBuffer instance to be passed but received:" + eventBuffer);<NEW_LINE>BootstrapEventBuffer bEvb = (BootstrapEventBuffer) eventBuffer;<NEW_LINE>byte[] serializedValue = serializeEvent(record, scn, timestamp, <MASK><NEW_LINE>// Append the event to the databus event buffer<NEW_LINE>// DbusEventKey eventKey = new DbusEventKey(record.get("key"));<NEW_LINE>DbusEventKey eventKey = new DbusEventKey(record.get(keyColumnName));<NEW_LINE>DbusEventKey seederChunkKey = new DbusEventKey(record.get(_seederChunkKeyName));<NEW_LINE>short lPartitionId = _partitionFunction.getPartition(eventKey);<NEW_LINE>// short pPartitionId = PhysicalSourceConfig.DEFAULT_PHYSICAL_PARTITION.shortValue();<NEW_LINE>bEvb.appendEvent(eventKey, seederChunkKey, _pSourceId, lPartitionId, timestamp * 1000000, _sourceId, _schemaId, serializedValue, enableTracing, isReplicated, dbusEventsStatisticsCollector);<NEW_LINE>return serializedValue.length;<NEW_LINE>} | row, eventBuffer, enableTracing, dbusEventsStatisticsCollector); |
263,726 | private void applyPlotYAxisSpec(ProductPlot aPlot, XYSeriesCollection dataset, NumberAxis guiYAxis) {<NEW_LINE>// apply Plot Y Axis Label<NEW_LINE>// if no label provided, the Y variable name is used if they are all the same within the collection<NEW_LINE>if (aPlot.getYAxis() != null) {<NEW_LINE>guiYAxis.setLabel(aPlot.getYAxis().getLabel());<NEW_LINE>} else {<NEW_LINE>ProductVar theYVar = getYVarFromSeriesCollection(dataset);<NEW_LINE>if (theYVar != null) {<NEW_LINE>guiYAxis.setLabel(theYVar.getName());<NEW_LINE>guiYAxis.setFixedAutoRange(dataset.getSeries(0).getMaxY() - dataset.getSeries(0).getMinY());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Y Axis Format<NEW_LINE>if (aPlot.getYAxis() != null && aPlot.getYAxis().getFormat() != null && !aPlot.getYAxis().getFormat().isEmpty()) {<NEW_LINE>try {<NEW_LINE>DecimalFormat newFormat = new DecimalFormat(aPlot.getYAxis().getFormat());<NEW_LINE>newFormat.setRoundingMode(RoundingMode.HALF_UP);<NEW_LINE>guiYAxis.setNumberFormatOverride(newFormat);<NEW_LINE>} catch (IllegalArgumentException iae) {<NEW_LINE>// do nothing if the provided format is invalid<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (aPlot.getYMin() != null && aPlot.getYMax() != null) {<NEW_LINE>guiYAxis.setRange(aPlot.getYMin().doubleValue(), aPlot.<MASK><NEW_LINE>} else if (aPlot.getYMin() != null) {<NEW_LINE>guiYAxis.setRange(aPlot.getYMin().doubleValue(), guiYAxis.getUpperBound());<NEW_LINE>} else if (aPlot.getYMax() != null) {<NEW_LINE>guiYAxis.setRange(guiYAxis.getLowerBound(), aPlot.getYMax().doubleValue());<NEW_LINE>}<NEW_LINE>} | getYMax().doubleValue()); |
1,836,220 | private void processReceived(final Channel channel, final Command msg) {<NEW_LINE>final CommandType commandType = msg.getType();<NEW_LINE>if (CommandType.HEART_BEAT.equals(commandType)) {<NEW_LINE>if (logger.isDebugEnabled()) {<NEW_LINE>logger.debug("server receive heart beat from: host: {}", ChannelUtils.getRemoteAddress(channel));<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final Pair<NettyRequestProcessor, ExecutorService> pair = processors.get(commandType);<NEW_LINE>if (pair != null) {<NEW_LINE>Runnable r = () -> {<NEW_LINE>try {<NEW_LINE>pair.getLeft().process(channel, msg);<NEW_LINE>} catch (Exception ex) {<NEW_LINE>logger.error("process msg {} error", msg, ex);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>try {<NEW_LINE>pair.<MASK><NEW_LINE>} catch (RejectedExecutionException e) {<NEW_LINE>logger.warn("thread pool is full, discard msg {} from {}", msg, ChannelUtils.getRemoteAddress(channel));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>logger.warn("commandType {} not support", commandType);<NEW_LINE>}<NEW_LINE>} | getRight().submit(r); |
216,451 | public static List<String> searchFrequentItems(int k, Iterable<String> stream) {<NEW_LINE>// Finds the candidates which may occur > n / k times.<NEW_LINE>String buf = "";<NEW_LINE>Map<String, Integer> table = new HashMap<>();<NEW_LINE>// Counts the number of strings.<NEW_LINE>int n = 0;<NEW_LINE>Iterator<String> sequence = stream.iterator();<NEW_LINE>while (sequence.hasNext()) {<NEW_LINE>buf = sequence.next();<NEW_LINE>table.put(buf, table.getOrDefault<MASK><NEW_LINE>++n;<NEW_LINE>// Detecting k items in table, at least one of them must have exactly one<NEW_LINE>// in it. We will discard those k items by one for each.<NEW_LINE>if (table.size() == k) {<NEW_LINE>List<String> delKeys = new ArrayList<>();<NEW_LINE>for (Map.Entry<String, Integer> entry : table.entrySet()) {<NEW_LINE>if (entry.getValue() - 1 == 0) {<NEW_LINE>delKeys.add(entry.getKey());<NEW_LINE>} else {<NEW_LINE>table.put(entry.getKey(), entry.getValue() - 1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (String s : delKeys) {<NEW_LINE>table.remove(s);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Resets table for the following counting.<NEW_LINE>table = table.entrySet().stream().collect(Collectors.toMap(e -> e.getKey(), e -> 0));<NEW_LINE>// Counts the occurrence of each candidate word.<NEW_LINE>sequence = stream.iterator();<NEW_LINE>while (sequence.hasNext()) {<NEW_LINE>buf = sequence.next();<NEW_LINE>Integer it = table.get(buf);<NEW_LINE>if (it != null) {<NEW_LINE>table.put(buf, it + 1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final double threshold = (double) n / k;<NEW_LINE>// Selects the word which occurs > n / k times.<NEW_LINE>return table.entrySet().stream().filter(it -> threshold < (double) it.getValue()).map(it -> it.getKey()).collect(Collectors.toList());<NEW_LINE>} | (buf, 0) + 1); |
1,168,019 | final DescribeReservedInstanceOfferingsResult executeDescribeReservedInstanceOfferings(DescribeReservedInstanceOfferingsRequest describeReservedInstanceOfferingsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeReservedInstanceOfferingsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<DescribeReservedInstanceOfferingsRequest> request = null;<NEW_LINE>Response<DescribeReservedInstanceOfferingsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeReservedInstanceOfferingsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeReservedInstanceOfferingsRequest));<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, "OpenSearch");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeReservedInstanceOfferings");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeReservedInstanceOfferingsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeReservedInstanceOfferingsResultJsonUnmarshaller());<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); |
13,895 | public Result create(UUID customerUUID, UUID universeUUID) {<NEW_LINE>JsonNode requestBody = request()<MASK><NEW_LINE>SupportBundleFormData bundleData = formFactory.getFormDataOrBadRequest(requestBody, SupportBundleFormData.class);<NEW_LINE>Customer customer = Customer.getOrBadRequest(customerUUID);<NEW_LINE>Universe universe = Universe.getValidUniverseOrBadRequest(universeUUID, customer);<NEW_LINE>// Do not create support bundle when either backup, update, or universe is paused<NEW_LINE>if (universe.getUniverseDetails().backupInProgress || universe.getUniverseDetails().updateInProgress || universe.getUniverseDetails().universePaused) {<NEW_LINE>throw new PlatformServiceException(BAD_REQUEST, String.format("Cannot create support bundle since the universe %s" + "is currently in a locked/paused state or has backup running", universe.universeUUID));<NEW_LINE>}<NEW_LINE>// Temporarily cannot create for onprem or k8s properly. Will result in empty directories<NEW_LINE>CloudType cloudType = universe.getUniverseDetails().getPrimaryCluster().userIntent.providerType;<NEW_LINE>Boolean k8s_enabled = runtimeConfigFactory.globalRuntimeConf().getBoolean(K8S_ENABLED);<NEW_LINE>Boolean onprem_enabled = runtimeConfigFactory.globalRuntimeConf().getBoolean(ONPREM_ENABLED);<NEW_LINE>if ((cloudType == CloudType.onprem && !onprem_enabled) || (cloudType == CloudType.kubernetes && !k8s_enabled)) {<NEW_LINE>throw new PlatformServiceException(BAD_REQUEST, "Cannot currently create support bundle for onprem or k8s clusters");<NEW_LINE>}<NEW_LINE>SupportBundle supportBundle = SupportBundle.create(bundleData, universe);<NEW_LINE>SupportBundleTaskParams taskParams = new SupportBundleTaskParams(supportBundle, bundleData, customer, universe);<NEW_LINE>UUID taskUUID = commissioner.submit(TaskType.CreateSupportBundle, taskParams);<NEW_LINE>auditService().createAuditEntryWithReqBody(ctx(), Audit.TargetType.SupportBundle, Objects.toString(supportBundle.getBundleUUID(), null), Audit.ActionType.Create, requestBody, taskUUID);<NEW_LINE>return new YBPTask(taskUUID, supportBundle.getBundleUUID()).asResult();<NEW_LINE>} | .body().asJson(); |
1,687,625 | private static void testJsMethods() {<NEW_LINE>assertTrue(callFunByA(new A<String>(), "abc").equals("abc"));<NEW_LINE>assertTrue(callFunByA(new B(), "def").equals("defabc"));<NEW_LINE>assertTrue(callFunByA(new C(), 1).equals(new Integer(6)));<NEW_LINE>assertTrue(callFunByA(new D(), 2).equals(new Integer(8)));<NEW_LINE>assertTrue(callFunByA(new E(), "xyz").equals("xyzabc"));<NEW_LINE>// TODO(b/150876433): enable when fixed.<NEW_LINE>// assertThrowsClassCastException(() -> callFunByA(new B(), 1), String.class);<NEW_LINE>assertEquals("A-bar", callBarByA(new A<String>(), "abc"));<NEW_LINE>assertEquals("B-bar", callBarByA(new B(), "abc"));<NEW_LINE>assertEquals("A-bar", callBarByA(new C(), 1));<NEW_LINE>assertEquals("A-bar", callBarByA(new D(), 2));<NEW_LINE>assertEquals("B-bar", callBarByA(new E(), "xyz"));<NEW_LINE>assertEquals("F-bar", callBarByA(new F(), "abcd"));<NEW_LINE>assertThrowsClassCastException(() -> callBarByA(new B(), 1), String.class);<NEW_LINE>assertTrue(callFunByI(new D(), 2).equals(new Integer(8)));<NEW_LINE>// TODO(b/150876433): enable when fixed.<NEW_LINE>// assertThrowsClassCastException(() -> callFunByI(new D(), new Float(2.2)), Integer.class);<NEW_LINE>assertEquals("B-bar", callBarByJ(<MASK><NEW_LINE>assertThrowsClassCastException(() -> callBarByJ(new E(), new Object()), String.class);<NEW_LINE>assertTrue(new B().fun("def").equals("defabc"));<NEW_LINE>assertTrue(new C().fun(1) == 6);<NEW_LINE>assertTrue(new D().fun(10) == 16);<NEW_LINE>assertTrue(new E().fun("xyz").equals("xyzabc"));<NEW_LINE>assertEquals("A-bar", new A<>().bar(new Object()));<NEW_LINE>assertEquals("B-bar", new B().bar("abcd"));<NEW_LINE>assertEquals("A-bar", new C().bar(1));<NEW_LINE>assertEquals("A-bar", new D().bar(1));<NEW_LINE>assertEquals("B-bar", new E().bar("abcd"));<NEW_LINE>assertEquals("F-bar", new F().bar("abcd"));<NEW_LINE>assertTrue(callFun(new A<String>(), "abc").equals("abc"));<NEW_LINE>assertTrue(callFun(new B(), "abc").equals("abcabc"));<NEW_LINE>assertTrue(callFun(new C(), 1).equals(6));<NEW_LINE>assertTrue(callFun(new D(), 10).equals(16));<NEW_LINE>assertTrue(callFun(new E(), "xyz").equals("xyzabc"));<NEW_LINE>assertTrue(callBar(new B(), "abcd", "defg"));<NEW_LINE>assertTrue(callBar(new E(), "abcd", "defg"));<NEW_LINE>} | new E(), "xyz")); |
63,544 | public static Collection<org.netbeans.modules.cordova.platforms.spi.Device> parse(String output) throws IOException {<NEW_LINE>BufferedReader r = new BufferedReader(new StringReader(output));<NEW_LINE>// NOI18N<NEW_LINE>Pattern pattern = Pattern.compile("([-\\w]+)\\s+([\\w]+) *");<NEW_LINE>ArrayList<org.netbeans.modules.cordova.platforms.spi.Device> result = new ArrayList<org.netbeans.modules.cordova.<MASK><NEW_LINE>// ignore first line<NEW_LINE>String line = r.readLine();<NEW_LINE>while (((line = r.readLine()) != null)) {<NEW_LINE>Matcher m = pattern.matcher(line);<NEW_LINE>if (m.matches()) {<NEW_LINE>final String name = m.group(1);<NEW_LINE>// NOI18N<NEW_LINE>AndroidDevice device = new AndroidDevice(name, Browser.DEFAULT, name.startsWith("emulator"));<NEW_LINE>result.add(device);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | platforms.spi.Device>(); |
1,011,630 | List<ImapResponse> readStatusResponse(String tag, String commandToLog, String logId, UntaggedHandler untaggedHandler) throws IOException, NegativeImapResponseException {<NEW_LINE>List<ImapResponse> responses = new ArrayList<>();<NEW_LINE>ImapResponse response;<NEW_LINE>do {<NEW_LINE>response = readResponse();<NEW_LINE>if (K9MailLib.isDebug() && DEBUG_PROTOCOL_IMAP) {<NEW_LINE>Timber.v("%s<<<%s", logId, response);<NEW_LINE>}<NEW_LINE>if (response.getTag() != null && !response.getTag().equalsIgnoreCase(tag)) {<NEW_LINE>Timber.w("After sending tag %s, got tag response from previous command %s for %s", tag, response, logId);<NEW_LINE>Iterator<ImapResponse> responseIterator = responses.iterator();<NEW_LINE>while (responseIterator.hasNext()) {<NEW_LINE>ImapResponse delResponse = responseIterator.next();<NEW_LINE>if (delResponse.getTag() != null || delResponse.size() < 2 || (!equalsIgnoreCase(delResponse.get(1), Responses.EXISTS) && !equalsIgnoreCase(delResponse.get(1), Responses.EXPUNGE))) {<NEW_LINE>responseIterator.remove();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>response = null;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (response.getTag() == null && untaggedHandler != null) {<NEW_LINE>untaggedHandler.handleAsyncUntaggedResponse(response);<NEW_LINE>}<NEW_LINE>responses.add(response);<NEW_LINE>} while (response == null || <MASK><NEW_LINE>if (response.size() < 1 || !equalsIgnoreCase(response.get(0), Responses.OK)) {<NEW_LINE>String message = "Command: " + commandToLog + "; response: " + response.toString();<NEW_LINE>throw new NegativeImapResponseException(message, responses);<NEW_LINE>}<NEW_LINE>return responses;<NEW_LINE>} | response.getTag() == null); |
768,388 | public StartAvailabilityMonitorTestResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>StartAvailabilityMonitorTestResult startAvailabilityMonitorTestResult = new StartAvailabilityMonitorTestResult();<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 startAvailabilityMonitorTestResult;<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("GatewayARN", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>startAvailabilityMonitorTestResult.setGatewayARN(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 startAvailabilityMonitorTestResult;<NEW_LINE>} | JsonToken token = context.getCurrentToken(); |
526,061 | public void parseSelectFields(JoinInfo joinInfo) {<NEW_LINE>String sideTableName = joinInfo.getSideTableName();<NEW_LINE>String nonSideTableName = joinInfo.getNonSideTable();<NEW_LINE>List<String> fields = Lists.newArrayList();<NEW_LINE>int sideIndex = 0;<NEW_LINE>for (int i = 0; i < outFieldInfoList.size(); i++) {<NEW_LINE>FieldInfo fieldInfo = outFieldInfoList.get(i);<NEW_LINE>if (fieldInfo.getTable().equalsIgnoreCase(sideTableName)) {<NEW_LINE>fields.add(fieldInfo.getFieldName());<NEW_LINE><MASK><NEW_LINE>sideFieldNameIndex.put(i, fieldInfo.getFieldName());<NEW_LINE>sideIndex++;<NEW_LINE>} else if (fieldInfo.getTable().equalsIgnoreCase(nonSideTableName)) {<NEW_LINE>int nonSideIndex = rowTypeInfo.getFieldIndex(fieldInfo.getFieldName());<NEW_LINE>inFieldIndex.put(i, nonSideIndex);<NEW_LINE>} else {<NEW_LINE>throw new RuntimeException("unknown table " + fieldInfo.getTable());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (fields.size() == 0) {<NEW_LINE>throw new RuntimeException("select non field from table " + sideTableName);<NEW_LINE>}<NEW_LINE>// add join on condition field to select fields<NEW_LINE>SqlNode conditionNode = joinInfo.getCondition();<NEW_LINE>List<SqlNode> sqlNodeList = Lists.newArrayList();<NEW_LINE>ParseUtils.parseAnd(conditionNode, sqlNodeList);<NEW_LINE>for (SqlNode sqlNode : sqlNodeList) {<NEW_LINE>dealOneEqualCon(sqlNode, sideTableName);<NEW_LINE>}<NEW_LINE>if (CollectionUtils.isEmpty(equalFieldList)) {<NEW_LINE>throw new RuntimeException("no join condition found after table " + joinInfo.getLeftTableName());<NEW_LINE>}<NEW_LINE>for (String equalField : equalFieldList) {<NEW_LINE>if (fields.contains(equalField)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>fields.add(equalField);<NEW_LINE>}<NEW_LINE>sideSelectFields = String.join(",", fields);<NEW_LINE>} | sideFieldIndex.put(i, sideIndex); |
809,715 | public DatabaseInfo executeQuery(DatabaseConfiguration dbConfig, String query) throws DatabaseServiceException {<NEW_LINE>try {<NEW_LINE>Connection connection = SQLiteConnectionManager.getInstance().getConnection(dbConfig);<NEW_LINE>Statement statement = connection.createStatement();<NEW_LINE>ResultSet queryResult = statement.executeQuery(query);<NEW_LINE>ResultSetMetaData metadata = queryResult.getMetaData();<NEW_LINE>int columnCount = metadata.getColumnCount();<NEW_LINE>ArrayList<DatabaseColumn> columns = new ArrayList<>(columnCount);<NEW_LINE>for (int i = 1; i <= columnCount; i++) {<NEW_LINE>DatabaseColumn dc = new DatabaseColumn(metadata.getColumnName(i), metadata.getColumnLabel(i), DatabaseUtils.getDbColumnType(metadata.getColumnType(i)), metadata.getColumnDisplaySize(i));<NEW_LINE>columns.add(dc);<NEW_LINE>}<NEW_LINE>int index = 0;<NEW_LINE>List<DatabaseRow> rows = new ArrayList<>();<NEW_LINE>while (queryResult.next()) {<NEW_LINE>DatabaseRow row = new DatabaseRow();<NEW_LINE>row.setIndex(index);<NEW_LINE>List<String> values = new ArrayList<>(columnCount);<NEW_LINE>for (int i = 1; i <= columnCount; i++) {<NEW_LINE>values.add(queryResult.getString(i));<NEW_LINE>}<NEW_LINE>row.setValues(values);<NEW_LINE>rows.add(row);<NEW_LINE>index++;<NEW_LINE>}<NEW_LINE>DatabaseInfo dbInfo = new DatabaseInfo();<NEW_LINE>dbInfo.setColumns(columns);<NEW_LINE>dbInfo.setRows(rows);<NEW_LINE>return dbInfo;<NEW_LINE>} catch (SQLException e) {<NEW_LINE><MASK><NEW_LINE>throw new DatabaseServiceException(true, e.getSQLState(), e.getErrorCode(), e.getMessage());<NEW_LINE>} finally {<NEW_LINE>SQLiteConnectionManager.getInstance().shutdown();<NEW_LINE>}<NEW_LINE>} | logger.error("SQLException::", e); |
122,228 | // Draw at the given x/y (upper left corner of arrow area).<NEW_LINE>protected void drawRightHideArrow(GC gc, int x, int y) {<NEW_LINE>gc.setForeground(arrowColor);<NEW_LINE>y += ARROW_MARGIN;<NEW_LINE>gc.drawLine(x + 6, y, <MASK><NEW_LINE>gc.drawLine(x + 7, y, x + 7, y + 7);<NEW_LINE>gc.drawLine(x + 2, y, x + 5, y + 3);<NEW_LINE>gc.drawLine(x + 5, y + 4, x + 5, y + 4);<NEW_LINE>gc.drawLine(x + 4, y + 3, x + 4, y + 5);<NEW_LINE>gc.drawLine(x + 3, y + 1, x + 3, y + 6);<NEW_LINE>gc.drawLine(x + 2, y + 1, x + 2, y + 7);<NEW_LINE>} | x + 6, y + 7); |
160,737 | public ProcResult fetchResult() throws AnalysisException {<NEW_LINE>BaseProcResult result = new BaseProcResult();<NEW_LINE>result.setNames(TITLE_NAMES);<NEW_LINE>int totalFailedNum = 0;<NEW_LINE>int totalTaskNum = 0;<NEW_LINE>List<Long> backendIds = Catalog.getCurrentSystemInfo().getBackendIds(false);<NEW_LINE>for (Long backendId : backendIds) {<NEW_LINE>int failedNum = AgentTaskQueue.getTaskNum(backendId, type, true);<NEW_LINE>int taskNum = AgentTaskQueue.getTaskNum(backendId, type, false);<NEW_LINE>List<String> row = Lists.newArrayList();<NEW_LINE>row.add(backendId.toString());<NEW_LINE>row.add<MASK><NEW_LINE>row.add(String.valueOf(taskNum));<NEW_LINE>result.addRow(row);<NEW_LINE>totalFailedNum += failedNum;<NEW_LINE>totalTaskNum += taskNum;<NEW_LINE>}<NEW_LINE>List<String> sumRow = Lists.newArrayList();<NEW_LINE>sumRow.add("Total");<NEW_LINE>sumRow.add(String.valueOf(totalFailedNum));<NEW_LINE>sumRow.add(String.valueOf(totalTaskNum));<NEW_LINE>result.addRow(sumRow);<NEW_LINE>return result;<NEW_LINE>} | (String.valueOf(failedNum)); |
105,976 | protected void customLoadLogic(ParsedNode parsedNode, ResourceAccessor resourceAccessor) throws ParsedNodeException {<NEW_LINE>ParsedNode argsNode = <MASK><NEW_LINE>if (argsNode == null) {<NEW_LINE>argsNode = parsedNode;<NEW_LINE>}<NEW_LINE>for (ParsedNode arg : argsNode.getChildren(null, "arg")) {<NEW_LINE>addArg(arg.getChildValue(null, "value", String.class));<NEW_LINE>}<NEW_LINE>String passedValue = StringUtil.trimToNull(parsedNode.getChildValue(null, "os", String.class));<NEW_LINE>if (passedValue == null) {<NEW_LINE>this.os = new ArrayList<>();<NEW_LINE>} else {<NEW_LINE>List<String> os = StringUtil.splitAndTrim(StringUtil.trimToEmpty(parsedNode.getChildValue(null, "os", String.class)), ",");<NEW_LINE>if ((os.size() == 1) && ("".equals(os.get(0)))) {<NEW_LINE>this.os = null;<NEW_LINE>} else if (!os.isEmpty()) {<NEW_LINE>this.os = os;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | parsedNode.getChild(null, "args"); |
453,365 | public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {<NEW_LINE>builder.startObject("indexing_pressure");<NEW_LINE>builder.startObject("memory");<NEW_LINE>builder.startObject("current");<NEW_LINE>builder.humanReadableField(COMBINED_IN_BYTES, COMBINED, new ByteSizeValue(currentCombinedCoordinatingAndPrimaryBytes));<NEW_LINE>builder.humanReadableField(COORDINATING_IN_BYTES, COORDINATING, new ByteSizeValue(currentCoordinatingBytes));<NEW_LINE>builder.humanReadableField(PRIMARY_IN_BYTES, <MASK><NEW_LINE>builder.humanReadableField(REPLICA_IN_BYTES, REPLICA, new ByteSizeValue(currentReplicaBytes));<NEW_LINE>builder.humanReadableField(ALL_IN_BYTES, ALL, new ByteSizeValue(currentReplicaBytes + currentCombinedCoordinatingAndPrimaryBytes));<NEW_LINE>builder.endObject();<NEW_LINE>builder.startObject("total");<NEW_LINE>builder.humanReadableField(COMBINED_IN_BYTES, COMBINED, new ByteSizeValue(totalCombinedCoordinatingAndPrimaryBytes));<NEW_LINE>builder.humanReadableField(COORDINATING_IN_BYTES, COORDINATING, new ByteSizeValue(totalCoordinatingBytes));<NEW_LINE>builder.humanReadableField(PRIMARY_IN_BYTES, PRIMARY, new ByteSizeValue(totalPrimaryBytes));<NEW_LINE>builder.humanReadableField(REPLICA_IN_BYTES, REPLICA, new ByteSizeValue(totalReplicaBytes));<NEW_LINE>builder.humanReadableField(ALL_IN_BYTES, ALL, new ByteSizeValue(totalReplicaBytes + totalCombinedCoordinatingAndPrimaryBytes));<NEW_LINE>builder.field(COORDINATING_REJECTIONS, coordinatingRejections);<NEW_LINE>builder.field(PRIMARY_REJECTIONS, primaryRejections);<NEW_LINE>builder.field(REPLICA_REJECTIONS, replicaRejections);<NEW_LINE>builder.endObject();<NEW_LINE>builder.humanReadableField(LIMIT_IN_BYTES, LIMIT, new ByteSizeValue(memoryLimit));<NEW_LINE>builder.endObject();<NEW_LINE>return builder.endObject();<NEW_LINE>} | PRIMARY, new ByteSizeValue(currentPrimaryBytes)); |
335,958 | public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) {<NEW_LINE>Optional<AnnotatedElement> element = context.getElement();<NEW_LINE>MergedAnnotations annotations = MergedAnnotations.from(element.get(), MergedAnnotations.SearchStrategy.TYPE_HIERARCHY);<NEW_LINE>if (annotations.get(RabbitAvailable.class).isPresent()) {<NEW_LINE>RabbitAvailable rabbit = annotations.get(RabbitAvailable.class).synthesize();<NEW_LINE>try {<NEW_LINE>String[] queues = rabbit.queues();<NEW_LINE>BrokerRunningSupport brokerRunning = getStore(context).get(BROKER_RUNNING_BEAN, BrokerRunningSupport.class);<NEW_LINE>if (brokerRunning == null) {<NEW_LINE>if (rabbit.management()) {<NEW_LINE>brokerRunning = BrokerRunningSupport.isBrokerAndManagementRunningWithEmptyQueues(queues);<NEW_LINE>} else {<NEW_LINE>brokerRunning = BrokerRunningSupport.isRunningWithEmptyQueues(queues);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>brokerRunning.setPurgeAfterEach(rabbit.purgeAfterEach());<NEW_LINE>brokerRunning.test();<NEW_LINE>BROKER_RUNNING_HOLDER.set(brokerRunning);<NEW_LINE>Store store = getStore(context);<NEW_LINE><MASK><NEW_LINE>store.put("queuesToDelete", queues);<NEW_LINE>return ConditionEvaluationResult.enabled("RabbitMQ is available");<NEW_LINE>} catch (Exception e) {<NEW_LINE>if (BrokerRunningSupport.fatal()) {<NEW_LINE>throw new IllegalStateException("Required RabbitMQ is not available", e);<NEW_LINE>}<NEW_LINE>return ConditionEvaluationResult.disabled("Tests Ignored: RabbitMQ is not available");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return ENABLED;<NEW_LINE>} | store.put(BROKER_RUNNING_BEAN, brokerRunning); |
867,936 | public void saveSyncRecord(SyncRecord record) {<NEW_LINE>ContentValues values = new ContentValues();<NEW_LINE>if (record.getLocalPath() != null) {<NEW_LINE>values.put(KEY_SYNC_FILEPATH_ORI, encrypt(record.getLocalPath()));<NEW_LINE>}<NEW_LINE>if (record.getNewPath() != null) {<NEW_LINE>values.put(KEY_SYNC_FILEPATH_NEW, encrypt(record.getNewPath()));<NEW_LINE>}<NEW_LINE>if (record.getOriginFingerprint() != null) {<NEW_LINE>values.put(KEY_SYNC_FP_ORI, encrypt(record.getOriginFingerprint()));<NEW_LINE>}<NEW_LINE>if (record.getNewFingerprint() != null) {<NEW_LINE>values.put(KEY_SYNC_FP_NEW, encrypt(record.getNewFingerprint()));<NEW_LINE>}<NEW_LINE>if (record.getFileName() != null) {<NEW_LINE>values.put(KEY_SYNC_FILENAME, encrypt(record.getFileName()));<NEW_LINE>}<NEW_LINE>if (record.getNodeHandle() != null) {<NEW_LINE>values.put(KEY_SYNC_HANDLE, encrypt(String.valueOf(record.getNodeHandle())));<NEW_LINE>}<NEW_LINE>if (record.getTimestamp() != null) {<NEW_LINE>values.put(KEY_SYNC_TIMESTAMP, encrypt(String.valueOf(record.getTimestamp())));<NEW_LINE>}<NEW_LINE>if (record.isCopyOnly() != null) {<NEW_LINE>values.put(KEY_SYNC_COPYONLY, encrypt(String.valueOf(record.isCopyOnly())));<NEW_LINE>}<NEW_LINE>if (record.isSecondary() != null) {<NEW_LINE>values.put(KEY_SYNC_SECONDARY, encrypt(String.valueOf(<MASK><NEW_LINE>}<NEW_LINE>if (record.getLongitude() != null) {<NEW_LINE>values.put(KEY_SYNC_LONGITUDE, encrypt(String.valueOf(record.getLongitude())));<NEW_LINE>}<NEW_LINE>if (record.getLatitude() != null) {<NEW_LINE>values.put(KEY_SYNC_LATITUDE, encrypt(String.valueOf(record.getLatitude())));<NEW_LINE>}<NEW_LINE>values.put(KEY_SYNC_STATE, record.getStatus());<NEW_LINE>values.put(KEY_SYNC_TYPE, record.getType());<NEW_LINE>db.insert(TABLE_SYNC_RECORDS, null, values);<NEW_LINE>} | record.isSecondary()))); |
1,075,214 | public static void main(String[] args) {<NEW_LINE>QuickUnionPathCompression quickUnionPathCompression = new Exercise12_QuickUnionPathCompression().new QuickUnionPathCompression(10);<NEW_LINE>quickUnionPathCompression.union(0, 1);<NEW_LINE>quickUnionPathCompression.union(2, 3);<NEW_LINE>quickUnionPathCompression.union(3, 4);<NEW_LINE>quickUnionPathCompression.union(2, 4);<NEW_LINE>StdOut.println("Components: " + quickUnionPathCompression.count + " Expected: 7");<NEW_LINE>// Sequence of input pairs to produce a path of length 4:<NEW_LINE>// 0 1<NEW_LINE>// 2 3<NEW_LINE>// 4 5<NEW_LINE>// 6 7<NEW_LINE>// 6 4<NEW_LINE>// 4 2<NEW_LINE>// 4 0<NEW_LINE>// Path: 6 -> 7 -> 5 -> 3 -> 1<NEW_LINE>QuickUnionPathCompression quickUnionPathCompression2 = new Exercise12_QuickUnionPathCompression().new QuickUnionPathCompression(10);<NEW_LINE>quickUnionPathCompression2.union(0, 1);<NEW_LINE>quickUnionPathCompression2.union(2, 3);<NEW_LINE>quickUnionPathCompression2.union(4, 5);<NEW_LINE><MASK><NEW_LINE>quickUnionPathCompression2.union(6, 4);<NEW_LINE>quickUnionPathCompression2.union(4, 2);<NEW_LINE>quickUnionPathCompression2.union(4, 0);<NEW_LINE>StdOut.println("Components: " + quickUnionPathCompression2.count + " Expected: 3");<NEW_LINE>} | quickUnionPathCompression2.union(6, 7); |
1,690,533 | public void visitEnd() {<NEW_LINE>super.visitEnd();<NEW_LINE>if (visibleParamAnnotations != null) {<NEW_LINE>VisibilityParameterAnnotationTag tag = new VisibilityParameterAnnotationTag(visibleParamAnnotations.length, AnnotationConstants.RUNTIME_VISIBLE);<NEW_LINE>for (VisibilityAnnotationTag vat : visibleParamAnnotations) {<NEW_LINE>tag.addVisibilityAnnotation(vat);<NEW_LINE>}<NEW_LINE>method.addTag(tag);<NEW_LINE>}<NEW_LINE>if (invisibleParamAnnotations != null) {<NEW_LINE>VisibilityParameterAnnotationTag tag = new VisibilityParameterAnnotationTag(invisibleParamAnnotations.length, AnnotationConstants.RUNTIME_INVISIBLE);<NEW_LINE>for (VisibilityAnnotationTag vat : invisibleParamAnnotations) {<NEW_LINE>tag.addVisibilityAnnotation(vat);<NEW_LINE>}<NEW_LINE>method.addTag(tag);<NEW_LINE>}<NEW_LINE>if (visibleLocalVarAnnotations != null) {<NEW_LINE>VisibilityLocalVariableAnnotationTag tag = new VisibilityLocalVariableAnnotationTag(visibleLocalVarAnnotations.<MASK><NEW_LINE>for (VisibilityAnnotationTag vat : visibleLocalVarAnnotations) {<NEW_LINE>tag.addVisibilityAnnotation(vat);<NEW_LINE>}<NEW_LINE>method.addTag(tag);<NEW_LINE>}<NEW_LINE>if (invisibleLocalVarAnnotations != null) {<NEW_LINE>VisibilityLocalVariableAnnotationTag tag = new VisibilityLocalVariableAnnotationTag(invisibleLocalVarAnnotations.size(), AnnotationConstants.RUNTIME_INVISIBLE);<NEW_LINE>for (VisibilityAnnotationTag vat : invisibleLocalVarAnnotations) {<NEW_LINE>tag.addVisibilityAnnotation(vat);<NEW_LINE>}<NEW_LINE>method.addTag(tag);<NEW_LINE>}<NEW_LINE>if (!isFullyEmpty(parameterNames)) {<NEW_LINE>method.addTag(new ParamNamesTag(parameterNames));<NEW_LINE>}<NEW_LINE>if (method.isConcrete()) {<NEW_LINE>method.setSource(createAsmMethodSource(maxLocals, instructions, localVariables, tryCatchBlocks, scb.getKlass().moduleName));<NEW_LINE>}<NEW_LINE>} | size(), AnnotationConstants.RUNTIME_VISIBLE); |
1,090,519 | public AndroidElement findElement(By by) {<NEW_LINE>if (by instanceof ById) {<NEW_LINE>return findElementById(by.getElementLocator());<NEW_LINE>} else if (by instanceof ByTagName) {<NEW_LINE>return findElementByTagName(by.getElementLocator());<NEW_LINE>} else if (by instanceof ByLinkText) {<NEW_LINE>return findElementByText(by.getElementLocator());<NEW_LINE>} else if (by instanceof By.ByPartialLinkText) {<NEW_LINE>return findElementByPartialText(by.getElementLocator());<NEW_LINE>} else if (by instanceof ByClass) {<NEW_LINE>return findElementByClass(by.getElementLocator());<NEW_LINE>} else if (by instanceof ByName) {<NEW_LINE>return findElementByName(by.getElementLocator());<NEW_LINE>} else if (by instanceof ByXPath) {<NEW_LINE>return <MASK><NEW_LINE>}<NEW_LINE>throw new UnsupportedOperationException(String.format("By locator %s is curently not supported!", by.getClass().getSimpleName()));<NEW_LINE>} | findElementByXPath(by.getElementLocator()); |
1,097,711 | public void preparedData() {<NEW_LINE>AlterTableGroupMovePartition alterTableGroupMovePartition = (AlterTableGroupMovePartition) relDdl;<NEW_LINE>String tableGroupName = alterTableGroupMovePartition.getTableGroupName();<NEW_LINE>SqlAlterTableGroup sqlAlterTableGroup = (SqlAlterTableGroup) alterTableGroupMovePartition.getAst();<NEW_LINE>assert sqlAlterTableGroup.getAlters().size() == 1;<NEW_LINE>assert sqlAlterTableGroup.getAlters().get(0) instanceof SqlAlterTableGroupMovePartition;<NEW_LINE>List<GroupDetailInfoExRecord> candidateGroupDetailInfoExRecords = TableGroupLocation.getOrderedGroupList(schemaName);<NEW_LINE>// todo support move multi-groups in one shot<NEW_LINE>String storageInstId = alterTableGroupMovePartition.getTargetPartitions().entrySet().iterator().next().getKey();<NEW_LINE>preparedData = new AlterTableGroupMovePartitionPreparedData();<NEW_LINE>List<GroupDetailInfoExRecord> targetGroupDetailInfoExRecords = candidateGroupDetailInfoExRecords.stream().filter(o -> o.storageInstId.equalsIgnoreCase(storageInstId)).collect(Collectors.toList());<NEW_LINE>if (GeneralUtil.isEmpty(targetGroupDetailInfoExRecords)) {<NEW_LINE>candidateGroupDetailInfoExRecords = TableGroupLocation.getOrderedGroupList(schemaName, true);<NEW_LINE>targetGroupDetailInfoExRecords = candidateGroupDetailInfoExRecords.stream().filter(o -> o.storageInstId.equalsIgnoreCase(storageInstId)).collect(Collectors.toList());<NEW_LINE>if (GeneralUtil.isEmpty(targetGroupDetailInfoExRecords)) {<NEW_LINE>throw new TddlRuntimeException(ErrorCode.ERR_DN_IS_NOT_READY, String.format("the dn[%s] is not ready, please retry this command later", storageInstId));<NEW_LINE>} else {<NEW_LINE>throw new TddlRuntimeException(ErrorCode.ERR_PHYSICAL_TOPOLOGY_CHANGING, String.format("the physical group[%s] is changing, please retry this command later", targetGroupDetailInfoExRecords.get(0)));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>preparedData.setTargetGroupDetailInfoExRecords(targetGroupDetailInfoExRecords);<NEW_LINE>preparedData.setSchemaName(schemaName);<NEW_LINE>preparedData.setWithHint(targetTablesHintCache != null);<NEW_LINE>preparedData.setTableGroupName(tableGroupName);<NEW_LINE>preparedData.setTargetPartitionsLocation(alterTableGroupMovePartition.getTargetPartitions());<NEW_LINE>List<String> <MASK><NEW_LINE>for (Map.Entry<String, Set<String>> entry : alterTableGroupMovePartition.getTargetPartitions().entrySet()) {<NEW_LINE>newPartitionNames.addAll(entry.getValue());<NEW_LINE>}<NEW_LINE>preparedData.setNewPartitionNames(newPartitionNames);<NEW_LINE>preparedData.setOldPartitionNames(newPartitionNames);<NEW_LINE>preparedData.prepareInvisiblePartitionGroup();<NEW_LINE>preparedData.setTaskType(ComplexTaskMetaManager.ComplexTaskType.MOVE_PARTITION);<NEW_LINE>} | newPartitionNames = new ArrayList<>(); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.