idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
251,975 | // BlockFaceShape<NEW_LINE>@Override<NEW_LINE>@Nonnull<NEW_LINE>protected IShape<T> mkShape(@Nonnull BlockFaceShape allFaces) {<NEW_LINE>return new IShape<T>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>@Nonnull<NEW_LINE>public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull EnumFacing face, @Nonnull T te) {<NEW_LINE>IBlockState paintSource = te.getPaintSource();<NEW_LINE>if (paintSource != null) {<NEW_LINE>try {<NEW_LINE>return paintSource.<MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return IShape.super.getBlockFaceShape(worldIn, state, pos, face, te);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>@Nonnull<NEW_LINE>public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull IBlockState state, @Nonnull BlockPos pos, @Nonnull EnumFacing face) {<NEW_LINE>return allFaces;<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | getBlockFaceShape(worldIn, pos, face); |
1,757,263 | protected PreparedStatement fillPreparedStatementColumnType(PreparedStatement preparedStatement, int columnIndex, int columnSqlType, Column column) throws SQLException {<NEW_LINE>if (column == null || column.getRawData() == null) {<NEW_LINE>preparedStatement.setObject(columnIndex, null);<NEW_LINE>return preparedStatement;<NEW_LINE>}<NEW_LINE>if (columnSqlType == Types.TIMESTAMP) {<NEW_LINE>String tz;<NEW_LINE>String columnTypeName = (String) this.resultSetMetaData.get(columnIndex).get("typeName");<NEW_LINE>if (columnTypeName.startsWith("DateTime64(") && columnTypeName.contains(",")) {<NEW_LINE>tz = columnTypeName.substring(15, columnTypeName.length() - 2);<NEW_LINE>// setTimestamp is slow and not recommended<NEW_LINE>preparedStatement.setObject(columnIndex, column.asTimestamp());<NEW_LINE>} else if (columnTypeName.startsWith("DateTime(")) {<NEW_LINE>tz = columnTypeName.substring(10, columnTypeName.length() - 2);<NEW_LINE>preparedStatement.setObject(<MASK><NEW_LINE>} else {<NEW_LINE>preparedStatement.setString(columnIndex, column.asString());<NEW_LINE>}<NEW_LINE>return preparedStatement;<NEW_LINE>}<NEW_LINE>return super.fillPreparedStatementColumnType(preparedStatement, columnIndex, columnSqlType, column);<NEW_LINE>} | columnIndex, column.asTimestamp()); |
60,140 | public Properties jpaProperties() {<NEW_LINE>Properties extraProperties = new Properties();<NEW_LINE>// Regular Hibernate Settings<NEW_LINE>extraProperties.put("hibernate.dialect", HapiFhirH2Dialect.class.getName());<NEW_LINE>extraProperties.put("hibernate.format_sql", "true");<NEW_LINE>extraProperties.put("hibernate.show_sql", "false");<NEW_LINE>extraProperties.put("hibernate.hbm2ddl.auto", "update");<NEW_LINE>extraProperties.put("hibernate.jdbc.batch_size", "20");<NEW_LINE><MASK><NEW_LINE>extraProperties.put("hibernate.cache.use_second_level_cache", "false");<NEW_LINE>extraProperties.put("hibernate.cache.use_structured_entries", "false");<NEW_LINE>extraProperties.put("hibernate.cache.use_minimal_puts", "false");<NEW_LINE>extraProperties.put("hibernate.search.backend.type", "lucene");<NEW_LINE>// extraProperties.put(BackendSettings.backendKey(LuceneBackendSettings.ANALYSIS_CONFIGURER), HapiLuceneAnalysisConfigurer.class.getName());<NEW_LINE>// extraProperties.put(BackendSettings.backendKey(LuceneIndexSettings.DIRECTORY_TYPE), "local-filesystem");<NEW_LINE>// extraProperties.put(BackendSettings.backendKey(LuceneIndexSettings.DIRECTORY_ROOT), "target/lucenefiles");<NEW_LINE>// extraProperties.put(BackendSettings.backendKey(LuceneBackendSettings.LUCENE_VERSION), "LUCENE_CURRENT");<NEW_LINE>// if (System.getProperty("lowmem") != null) {<NEW_LINE>extraProperties.put(HibernateOrmMapperSettings.ENABLED, "false");<NEW_LINE>// }<NEW_LINE>return extraProperties;<NEW_LINE>} | extraProperties.put("hibernate.cache.use_query_cache", "false"); |
505,007 | // Get byte array with fixed length (value length + key length = recordLength)<NEW_LINE>private byte[] fillArray(byte[] key, byte[] line) {<NEW_LINE>int valueLength = recordLength - key.length;<NEW_LINE>byte[] valueByte;<NEW_LINE>if (valueLength > 0) {<NEW_LINE>valueByte = new byte[valueLength];<NEW_LINE>if (line.length < valueLength) {<NEW_LINE>// There is no enough content in line, fill rest space with 0<NEW_LINE>System.arraycopy(line, 0, valueByte, 0, line.length);<NEW_LINE>Arrays.fill(valueByte, line.length<MASK><NEW_LINE>} else {<NEW_LINE>System.arraycopy(line, 0, valueByte, 0, valueLength);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// recordLength is smaller than the length of key, return empty array.<NEW_LINE>valueByte = new byte[0];<NEW_LINE>}<NEW_LINE>return valueByte;<NEW_LINE>} | , valueLength, (byte) 0); |
1,080,502 | public void apply(final Project project) {<NEW_LINE>final TaskContainer tasks = project.getTasks();<NEW_LINE>// static classes are used for the actions to avoid implicitly dragging project/tasks into the model registry<NEW_LINE><MASK><NEW_LINE>tasks.register(ProjectInternal.HELP_TASK, Help.class, new HelpAction());<NEW_LINE>tasks.register(ProjectInternal.PROJECTS_TASK, ProjectReportTask.class, new ProjectReportTaskAction(projectName));<NEW_LINE>tasks.register(ProjectInternal.TASKS_TASK, TaskReportTask.class, new TaskReportTaskAction(projectName, project.getChildProjects().isEmpty()));<NEW_LINE>tasks.register(PROPERTIES_TASK, PropertyReportTask.class, new PropertyReportTaskAction(projectName));<NEW_LINE>tasks.register(DEPENDENCY_INSIGHT_TASK, DependencyInsightReportTask.class, new DependencyInsightReportTaskAction(projectName));<NEW_LINE>tasks.register(DEPENDENCIES_TASK, DependencyReportTask.class, new DependencyReportTaskAction(projectName));<NEW_LINE>tasks.register(BuildEnvironmentReportTask.TASK_NAME, BuildEnvironmentReportTask.class, new BuildEnvironmentReportTaskAction(projectName));<NEW_LINE>registerDeprecatedTasks(tasks, projectName);<NEW_LINE>tasks.register(OUTGOING_VARIANTS_TASK, OutgoingVariantsReportTask.class, task -> {<NEW_LINE>task.setDescription("Displays the outgoing variants of " + projectName + ".");<NEW_LINE>task.setGroup(HELP_GROUP);<NEW_LINE>task.setImpliesSubProjects(true);<NEW_LINE>task.getShowAll().convention(false);<NEW_LINE>});<NEW_LINE>tasks.register(RESOLVABLE_CONFIGURATIONS_TASK, ResolvableConfigurationsReportTask.class, task -> {<NEW_LINE>task.setDescription("Displays the configurations that can be resolved in " + projectName + ".");<NEW_LINE>task.setGroup(HELP_GROUP);<NEW_LINE>task.setImpliesSubProjects(true);<NEW_LINE>task.getShowAll().convention(false);<NEW_LINE>task.getRecursive().convention(false);<NEW_LINE>});<NEW_LINE>tasks.withType(TaskReportTask.class).configureEach(task -> {<NEW_LINE>task.getShowTypes().convention(false);<NEW_LINE>});<NEW_LINE>} | String projectName = project.toString(); |
74,321 | public static void main(final String[] args) throws IOException {<NEW_LINE>String executionPath = ReactAndroidCodeTransformer.class.getProtectionDomain().getCodeSource().getLocation().getPath();<NEW_LINE>String projectRoot = new File(executionPath + "../../../../../../").getCanonicalPath() + '/';<NEW_LINE>String sdkVersion;<NEW_LINE>try {<NEW_LINE>sdkVersion = args[0];<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new IllegalArgumentException("Invalid args passed in, expected one argument -- SDK version.");<NEW_LINE>}<NEW_LINE>// Don't want to mess up our original copy of ReactCommon and ReactAndroid if something goes wrong.<NEW_LINE>File reactCommonDestRoot = new File(projectRoot + REACT_COMMON_DEST_ROOT);<NEW_LINE>File reactAndroidDestRoot <MASK><NEW_LINE>// Always remove<NEW_LINE>FileUtils.deleteDirectory(reactCommonDestRoot);<NEW_LINE>reactCommonDestRoot = new File(projectRoot + REACT_COMMON_DEST_ROOT);<NEW_LINE>FileUtils.deleteDirectory(reactAndroidDestRoot);<NEW_LINE>reactAndroidDestRoot = new File(projectRoot + REACT_ANDROID_DEST_ROOT);<NEW_LINE>FileUtils.copyDirectory(new File(projectRoot + REACT_COMMON_SOURCE_ROOT), reactCommonDestRoot);<NEW_LINE>FileUtils.copyDirectory(new File(projectRoot + REACT_ANDROID_SOURCE_ROOT), reactAndroidDestRoot);<NEW_LINE>// Update maven publish information<NEW_LINE>replaceInFile(new File(projectRoot + REACT_ANDROID_DEST_ROOT + "/build.gradle"), "def AAR_OUTPUT_URL = \"file://${projectDir}/../android\"", "def AAR_OUTPUT_URL = \"file:${System.env.HOME}/.m2/repository\"");<NEW_LINE>replaceInFile(new File(projectRoot + REACT_ANDROID_DEST_ROOT + "/build.gradle"), "group = GROUP", "group = 'com.facebook.react'");<NEW_LINE>// This version also gets updated in android-tasks.js<NEW_LINE>replaceInFile(new File(projectRoot + REACT_ANDROID_DEST_ROOT + "/build.gradle"), "version = VERSION_NAME", "version = '" + sdkVersion + "'");<NEW_LINE>// RN uses a weird directory structure for soloader to build with Buck. Change this so that Android Studio doesn't complain.<NEW_LINE>replaceInFile(new File(projectRoot + REACT_ANDROID_DEST_ROOT + "/build.gradle"), "'src/main/libraries/soloader'", "'src/main/libraries/soloader/java'");<NEW_LINE>// Actually modify the files<NEW_LINE>String path = projectRoot + REACT_ANDROID_DEST_ROOT + '/' + SOURCE_PATH;<NEW_LINE>for (String fileName : FILES_TO_MODIFY.keySet()) {<NEW_LINE>try {<NEW_LINE>updateFile(path + fileName, FILES_TO_MODIFY.get(fileName));<NEW_LINE>} catch (ParseException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | = new File(projectRoot + REACT_ANDROID_DEST_ROOT); |
886,825 | final ChangePasswordResult executeChangePassword(ChangePasswordRequest changePasswordRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(changePasswordRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ChangePasswordRequest> request = null;<NEW_LINE>Response<ChangePasswordResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ChangePasswordRequestMarshaller().marshall(super.beforeMarshalling(changePasswordRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ChangePassword");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<ChangePasswordResult> responseHandler = new StaxResponseHandler<ChangePasswordResult>(new ChangePasswordResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.SERVICE_ID, "IAM"); |
765,563 | private void validateGraph(boolean throwPropertyException) {<NEW_LINE>try (Graph graph = new Graph()) {<NEW_LINE>graph.importGraphDef(graphDef);<NEW_LINE>for (String inputName : featureConverter.inputNamesSet()) {<NEW_LINE>if (graph.operation(inputName) == null) {<NEW_LINE>String msg = "Unable to find an input operation, expected an op with name '" + inputName + "'";<NEW_LINE>if (throwPropertyException) {<NEW_LINE>throw new PropertyException("", "featureConverter", msg);<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException(msg);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Operation <MASK><NEW_LINE>if (outputOp == null) {<NEW_LINE>String msg = "Unable to find the output operation, expected an op with name '" + outputName + "'";<NEW_LINE>if (throwPropertyException) {<NEW_LINE>throw new PropertyException("", "outputName", msg);<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException(msg);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Shape outputShape = outputOp.output(0).shape();<NEW_LINE>if (outputShape.numDimensions() != 2) {<NEW_LINE>String msg = "Expected a 2 dimensional output, found " + Arrays.toString(outputShape.asArray());<NEW_LINE>if (throwPropertyException) {<NEW_LINE>throw new PropertyException("", "outputName", msg);<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException(msg);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | outputOp = graph.operation(outputName); |
511,481 | /* (non-Javadoc)<NEW_LINE>* @see android.content.BroadcastReceiver#onReceive(android.content.Context, android.content.Intent)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public void onReceive(Context arg0, Intent receivedIntent) {<NEW_LINE>Bundle b = receivedIntent.getExtras();<NEW_LINE>// Extract the values associated with the return Intent<NEW_LINE>// File Transfer does not use return ID<NEW_LINE>String returnID = b.getString(FileTransferService.ReturnID);<NEW_LINE>final String returnValue = b.getString(FileTransferService.ReturnValue);<NEW_LINE>final String transferEvent = b.getString(FileTransferService.TransferEvent);<NEW_LINE>// NOTE: To match with Windows behavior<NEW_LINE>// If the return was positive (the transaction completed successfully)<NEW_LINE>if (returnID.equals(Video_TRANSFER_RETURN_ID)) {<NEW_LINE>mHandler.post(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>Logger.I(<MASK><NEW_LINE>// Navigate to the specified URL<NEW_LINE>if (transferEvent != null && returnValue != null) {<NEW_LINE>try {<NEW_LINE>navigate(transferEvent, "transferResult", returnValue);<NEW_LINE>} catch (NavigateException e) {<NEW_LINE>Logger.E(TAG, "Navigate Exception.. length is " + e.GetLength());<NEW_LINE>}<NEW_LINE>} else if (transferEvent != null)<NEW_LINE>navigate(transferEvent);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | TAG, transferEvent + " : " + returnValue); |
1,306,101 | public void execute(Map<String, List<String>> parameters, PrintWriter output) throws Exception {<NEW_LINE>final List<String> loggerNames = getLoggerNames(parameters);<NEW_LINE>final Level loggerLevel = getLoggerLevel(parameters);<NEW_LINE>final Duration duration = getDuration(parameters);<NEW_LINE>for (String loggerName : loggerNames) {<NEW_LINE>Logger logger = ((LoggerContext) loggerContext).getLogger(loggerName);<NEW_LINE>String message = String.format("Configured logging level for %s to %s", loggerName, loggerLevel);<NEW_LINE>if (loggerLevel != null && duration != null) {<NEW_LINE>final <MASK><NEW_LINE>getTimer().schedule(new TimerTask() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>logger.setLevel(null);<NEW_LINE>}<NEW_LINE>}, millis);<NEW_LINE>message += String.format(" for %s milliseconds", millis);<NEW_LINE>}<NEW_LINE>logger.setLevel(loggerLevel);<NEW_LINE>output.println(message);<NEW_LINE>output.flush();<NEW_LINE>}<NEW_LINE>} | long millis = duration.toMillis(); |
216,570 | private static NumberSortScript.LeafFactory newSortScript(Expression expr, SearchLookup lookup, @Nullable Map<String, Object> vars) {<NEW_LINE>// NOTE: if we need to do anything complicated with bindings in the future, we can just extend Bindings,<NEW_LINE>// instead of complicating SimpleBindings (which should stay simple)<NEW_LINE>SimpleBindings bindings = new SimpleBindings();<NEW_LINE>boolean needsScores = false;<NEW_LINE>for (String variable : expr.variables) {<NEW_LINE>try {<NEW_LINE>if (variable.equals("_score")) {<NEW_LINE>bindings.add("_score", DoubleValuesSource.SCORES);<NEW_LINE>needsScores = true;<NEW_LINE>} else if (vars != null && vars.containsKey(variable)) {<NEW_LINE>bindFromParams(vars, bindings, variable);<NEW_LINE>} else {<NEW_LINE>// delegate valuesource creation based on field's type<NEW_LINE>// there are three types of "fields" to expressions, and each one has a different "api" of variables and methods.<NEW_LINE>final DoubleValuesSource valueSource = getDocValueSource(variable, lookup);<NEW_LINE>needsScores |= valueSource.needsScores();<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>// we defer "binding" of variables until here: give context for that variable<NEW_LINE>throw convertToScriptException("link error", expr.sourceText, variable, e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new ExpressionNumberSortScript(expr, bindings, needsScores);<NEW_LINE>} | bindings.add(variable, valueSource); |
1,266,536 | private static Map<String, String> createDefaultCheckerSetMap() {<NEW_LINE>Map<String, String> folderMap = new HashMap<>();<NEW_LINE>folderMap.put(Tool.COVERITY.name(), "codecc_default_rules_" + Tool.COVERITY.name().toLowerCase());<NEW_LINE>folderMap.put(Tool.KLOCWORK.name(), "codecc_default_rules_" + Tool.KLOCWORK.name().toLowerCase());<NEW_LINE>folderMap.put(Tool.PINPOINT.name(), "codecc_default_rules_" + Tool.PINPOINT.name().toLowerCase());<NEW_LINE>folderMap.put(Tool.CPPLINT.name(), "codecc_default_rules_" + Tool.CPPLINT.name().toLowerCase());<NEW_LINE>folderMap.put(Tool.CHECKSTYLE.name(), "codecc_default_rules_" + Tool.CHECKSTYLE.name().toLowerCase());<NEW_LINE>folderMap.put(Tool.STYLECOP.name(), "codecc_default_rules_" + Tool.STYLECOP.name().toLowerCase());<NEW_LINE>folderMap.put(Tool.GOML.name(), "codecc_default_rules_" + Tool.GOML.name().toLowerCase());<NEW_LINE>folderMap.put(Tool.DETEKT.name(), "codecc_default_rules_" + Tool.DETEKT.name().toLowerCase());<NEW_LINE>folderMap.put(Tool.PYLINT.name(), "codecc_default_rules_" + Tool.PYLINT.name().toLowerCase());<NEW_LINE>folderMap.put(Tool.OCCHECK.name(), "codecc_default_rules_" + Tool.OCCHECK.<MASK><NEW_LINE>folderMap.put(ComConstants.PHPCSStandardCode.PSR2.name(), "codecc_default_psr2_rules");<NEW_LINE>folderMap.put(ComConstants.PHPCSStandardCode.PSR12.name(), "codecc_default_psr12_rules");<NEW_LINE>folderMap.put(ComConstants.PHPCSStandardCode.PSR1.name(), "codecc_default_psr1_rules");<NEW_LINE>folderMap.put(ComConstants.PHPCSStandardCode.PEAR.name(), "codecc_default_pear_rules");<NEW_LINE>folderMap.put(ComConstants.PHPCSStandardCode.Zend.name(), "codecc_default_zend_rules");<NEW_LINE>folderMap.put(ComConstants.PHPCSStandardCode.Squiz.name(), "codecc_default_squiz_rules");<NEW_LINE>folderMap.put(ComConstants.PHPCSStandardCode.MySource.name(), "codecc_default_mysource_rules");<NEW_LINE>folderMap.put(ComConstants.PHPCSStandardCode.Generic.name(), "codecc_default_generic_rules");<NEW_LINE>folderMap.put(ComConstants.EslintFrameworkType.react.name(), "codecc_default_react_rules");<NEW_LINE>folderMap.put(ComConstants.EslintFrameworkType.vue.name(), "codecc_default_vue_rules");<NEW_LINE>folderMap.put(ComConstants.EslintFrameworkType.standard.name(), "codecc_default_standard_rules");<NEW_LINE>folderMap.put(Tool.SENSITIVE.name(), "codecc_default_rules_" + Tool.SENSITIVE.name().toLowerCase());<NEW_LINE>folderMap.put(Tool.HORUSPY.name(), "codecc_v2_default_" + Tool.HORUSPY.name().toLowerCase());<NEW_LINE>folderMap.put(Tool.WOODPECKER_SENSITIVE.name(), "codecc_v2_default_" + Tool.WOODPECKER_SENSITIVE.name().toLowerCase());<NEW_LINE>folderMap.put(Tool.RIPS.name(), "codecc_v2_default_" + Tool.RIPS.name().toLowerCase());<NEW_LINE>return folderMap;<NEW_LINE>} | name().toLowerCase()); |
673,389 | public void onNext(T value) {<NEW_LINE>List<Value> path = dataFetchingEnvironment.getExecutionStepInfo().getPath().toList().stream().map(p -> p instanceof Number ? Value.newBuilder().setNumberValue(Double.parseDouble(p.toString())).build() : Value.newBuilder().setStringValue(p.toString()).build()).<MASK><NEW_LINE>ListValue pathListVale = ListValue.newBuilder().addAllValues(path).addValues(Value.newBuilder().setNumberValue(pathIndex.incrementAndGet())).build();<NEW_LINE>R graphQlResponse = getData(value, pathListVale);<NEW_LINE>rejoinerStreamingContext.responseStreamObserver().onNext(graphQlResponse);<NEW_LINE>try {<NEW_LINE>System.out.println("Streaming response as Json: " + JsonFormat.printer().print(graphQlResponse));<NEW_LINE>} catch (InvalidProtocolBufferException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>} | collect(ImmutableList.toImmutableList()); |
1,259,735 | public void handleRequest(HttpServerExchange exchange) throws Exception {<NEW_LINE>var registry = PluginsRegistryImpl.getInstance();<NEW_LINE>var path = exchange.getRequestPath();<NEW_LINE>var pi = registry.getPipelineInfo(path);<NEW_LINE>if (pi.getType() == PipelineInfo.PIPELINE_TYPE.SERVICE) {<NEW_LINE>var srv = registry.getServices().stream().filter(s -> s.getName().equals(pi.getName())).findAny();<NEW_LINE>if (srv.isPresent()) {<NEW_LINE>var response = (ServiceResponse) srv.get().getInstance().response().apply(exchange);<NEW_LINE>if (response.getStatusCode() > 0) {<NEW_LINE>exchange.setStatusCode(response.getStatusCode());<NEW_LINE>}<NEW_LINE>// send the content to the client<NEW_LINE>if (response.getCustomerSender() != null) {<NEW_LINE>// use the custom sender if it has been set<NEW_LINE>response<MASK><NEW_LINE>} else {<NEW_LINE>var content = response.readContent();<NEW_LINE>if (content != null) {<NEW_LINE>// send the content via default exchange response sender<NEW_LINE>exchange.getResponseSender().send(content);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (pi.getType() == PipelineInfo.PIPELINE_TYPE.PROXY) {<NEW_LINE>var response = ByteArrayProxyResponse.of(exchange);<NEW_LINE>if (!exchange.isResponseStarted() && response.getStatusCode() > 0) {<NEW_LINE>exchange.setStatusCode(response.getStatusCode());<NEW_LINE>}<NEW_LINE>if (response.isContentAvailable()) {<NEW_LINE>exchange.getResponseSender().send(ByteBuffer.wrap(response.readContent()));<NEW_LINE>}<NEW_LINE>exchange.endExchange();<NEW_LINE>}<NEW_LINE>next(exchange);<NEW_LINE>} | .getCustomerSender().run(); |
1,059,962 | protected JSONObject addBreadcrumbData(final HttpServletRequest request) throws JSONException {<NEW_LINE>final JSONObject breadcrumbObjects = new JSONObject();<NEW_LINE>breadcrumbObjects.put("@context", getStructuredDataContext());<NEW_LINE>breadcrumbObjects.put("@type", "BreadcrumbList");<NEW_LINE>final String requestUri = getRequestUri();<NEW_LINE>final Map<String, String[]> params = getRequestParams();<NEW_LINE>final List<BreadcrumbDTO> breadcrumbs = breadcrumbService.buildBreadcrumbDTOs(requestUri, params);<NEW_LINE>final JSONArray breadcrumbList = new JSONArray();<NEW_LINE>int index = 1;<NEW_LINE>for (final BreadcrumbDTO breadcrumb : breadcrumbs) {<NEW_LINE>final JSONObject listItem = new JSONObject();<NEW_LINE>listItem.put("@type", "ListItem");<NEW_LINE>listItem.put("position", index);<NEW_LINE>final JSONObject item = new JSONObject();<NEW_LINE>item.put("@id", getSiteBaseUrl() + breadcrumb.getLink());<NEW_LINE>item.put("name", breadcrumb.getText());<NEW_LINE>extensionManager.getProxy().addBreadcrumbItemData(request, item);<NEW_LINE>listItem.put("item", item);<NEW_LINE>extensionManager.getProxy(<MASK><NEW_LINE>breadcrumbList.put(listItem);<NEW_LINE>index++;<NEW_LINE>}<NEW_LINE>extensionManager.getProxy().addBreadcrumbData(request, breadcrumbObjects);<NEW_LINE>breadcrumbObjects.put("itemListElement", breadcrumbList);<NEW_LINE>return breadcrumbObjects;<NEW_LINE>} | ).addBreadcrumbListItemData(request, listItem); |
796,992 | public void onMouseDown(MouseDownEvent event) {<NEW_LINE>startX = event.getClientX();<NEW_LINE>startY = event.getClientY();<NEW_LINE>if (isDisabled() || event.getNativeButton() != NativeEvent.BUTTON_LEFT) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>clickTarget = Element.as(event.getNativeEvent().getEventTarget());<NEW_LINE>mouseMoveCanceled = false;<NEW_LINE>if (weekGrid.getCalendar().isEventMoveAllowed() || clickTargetsResize()) {<NEW_LINE>moveRegistration = addMouseMoveHandler(this);<NEW_LINE>setFocus(true);<NEW_LINE>try {<NEW_LINE>startYrelative = (int) ((double) event.getRelativeY(caption) % slotHeight);<NEW_LINE>startXrelative = (event.getRelativeX(weekGrid.getElement()) - weekGrid.timebar.getOffsetWidth()) % getDateCellWidth();<NEW_LINE>} catch (Exception e) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>mouseMoveStarted = false;<NEW_LINE>Style s = getElement().getStyle();<NEW_LINE>s.setZIndex(1000);<NEW_LINE>startDatetimeFrom = (Date) calendarEvent.getStartTime().clone();<NEW_LINE>startDatetimeTo = (Date) calendarEvent.getEndTime().clone();<NEW_LINE>Event.setCapture(getElement());<NEW_LINE>}<NEW_LINE>// make sure the right cursor is always displayed<NEW_LINE>if (clickTargetsResize()) {<NEW_LINE>addGlobalResizeStyle();<NEW_LINE>}<NEW_LINE>event.stopPropagation();<NEW_LINE>event.preventDefault();<NEW_LINE>} | GWT.log("Exception calculating relative start position", e); |
297,758 | public TYPE next(final String iFetchPlan) {<NEW_LINE>final Object value = underlying.next();<NEW_LINE>if (value == null)<NEW_LINE>return null;<NEW_LINE>if (value instanceof ORID && autoConvert2Object) {<NEW_LINE>currentElement = (OIdentifiable) value;<NEW_LINE>ORecord record = ((ODatabaseDocument) database.getUnderlying()).load<MASK><NEW_LINE>if (record == null) {<NEW_LINE>OLogManager.instance().warn(this, "Record " + ((OObjectProxyMethodHandler) sourceRecord.getHandler()).getDoc().getIdentity() + " references a deleted instance");<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>TYPE o = (TYPE) database.getUserObjectByRecord(record, iFetchPlan);<NEW_LINE>((OObjectProxyMethodHandler) (((ProxyObject) o)).getHandler()).setParentObject(sourceRecord);<NEW_LINE>return o;<NEW_LINE>} else if (value instanceof ODocument && autoConvert2Object) {<NEW_LINE>currentElement = (OIdentifiable) value;<NEW_LINE>TYPE o = (TYPE) database.getUserObjectByRecord((ODocument) value, iFetchPlan);<NEW_LINE>((OObjectProxyMethodHandler) (((ProxyObject) o)).getHandler()).setParentObject(sourceRecord);<NEW_LINE>return o;<NEW_LINE>} else {<NEW_LINE>currentElement = database.getRecordByUserObject(value, false);<NEW_LINE>}<NEW_LINE>if (OObjectEntitySerializer.isToSerialize(value.getClass()))<NEW_LINE>return (TYPE) OObjectEntitySerializer.deserializeFieldValue(value.getClass(), value);<NEW_LINE>return (TYPE) value;<NEW_LINE>} | ((ORID) value, iFetchPlan); |
1,389,042 | public CreateFilterResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>CreateFilterResult createFilterResult = new CreateFilterResult();<NEW_LINE>int originalDepth = context.getCurrentDepth();<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 createFilterResult;<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("filterArn", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>createFilterResult.setFilterArn(context.getUnmarshaller(String.<MASK><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 createFilterResult;<NEW_LINE>} | class).unmarshall(context)); |
1,630,089 | public static boolean shouldRun(Description desc) {<NEW_LINE>Class<?> c = desc == null ? KerberosPlatformRule.class : desc.getTestClass();<NEW_LINE>String m = (desc == null || desc.getMethodName() == null) ? "shouldRun" : desc.getMethodName();<NEW_LINE>// Kerberos is only supported on certain operating systems<NEW_LINE>// Skip the tests if we are not on one of the supported OSes<NEW_LINE>String os = System.getProperty("os.name", "UNKNOWN").toUpperCase();<NEW_LINE>if (!os.contains("LINUX") && !os.contains("MAC OS")) {<NEW_LINE>if (FATRunner.FAT_TEST_LOCALRUN) {<NEW_LINE>throw new RuntimeException("Running on an unsupported os: " + os);<NEW_LINE>} else {<NEW_LINE>Log.info(c, m, "Skipping test because of unsupported os: " + os);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Make sure the JDK we are on supports the keytab encryption type<NEW_LINE>JavaInfo java = JavaInfo.forCurrentVM();<NEW_LINE>if (java.majorVersion() == 8 && java.vendor() == Vendor.SUN_ORACLE) {<NEW_LINE>File keytabFile = new File(System.getProperty("user.dir") + "/publish/servers/com.ibm.ws.jdbc.fat.krb5/security/krb5.keytab");<NEW_LINE>KerberosPrincipal princ = new KerberosPrincipal(DB2KerberosTest.<MASK><NEW_LINE>KeyTab kt = KeyTab.getInstance(princ, keytabFile);<NEW_LINE>Log.info(c, m, "Loaded keytab: " + kt);<NEW_LINE>KerberosKey[] kks = kt.getKeys(princ);<NEW_LINE>Log.info(c, m, "Loaded " + kks.length + " Kerberos keys");<NEW_LINE>if (kks.length == 0) {<NEW_LINE>Log.info(c, m, "Skipping test because this JVM does not support the keytab encoding we are using");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | KRB5_USER + "@" + KerberosContainer.KRB5_REALM); |
1,335,209 | public void exceptionThrown(BreakpointInfo info, Object currentThread, Object exception, CallFrame[] callFrames) {<NEW_LINE>if (connection == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>PacketStream stream = new PacketStream().commandPacket().commandSet(64).command(100);<NEW_LINE>CallFrame top = callFrames[0];<NEW_LINE>stream.writeByte(info.getSuspendPolicy());<NEW_LINE>// # events in reply<NEW_LINE>stream.writeInt(1);<NEW_LINE>stream.writeByte(RequestedJDWPEvents.EXCEPTION);<NEW_LINE>stream.writeInt(info.getRequestId());<NEW_LINE>stream.writeLong(ids.getIdAsLong(currentThread));<NEW_LINE>// location<NEW_LINE>stream.writeByte(top.getTypeTag());<NEW_LINE>stream.writeLong(top.getClassId());<NEW_LINE>stream.writeLong(ids.getIdAsLong(top.getMethod()));<NEW_LINE>stream.writeLong(top.getCodeIndex());<NEW_LINE>// exception<NEW_LINE>stream.writeByte(TagConstants.OBJECT);<NEW_LINE>stream.writeLong(context.getIds().getIdAsLong(exception));<NEW_LINE>// catch-location<NEW_LINE>boolean caught = false;<NEW_LINE>for (CallFrame callFrame : callFrames) {<NEW_LINE>MethodRef method = callFrame.getMethod();<NEW_LINE>int catchLocation = context.getCatchLocation(method, exception, (int) callFrame.getCodeIndex());<NEW_LINE>if (catchLocation != -1) {<NEW_LINE>stream.writeByte(callFrame.getTypeTag());<NEW_LINE>stream.writeLong(callFrame.getClassId());<NEW_LINE>stream.<MASK><NEW_LINE>stream.writeLong(catchLocation);<NEW_LINE>caught = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!caught) {<NEW_LINE>stream.writeByte((byte) 1);<NEW_LINE>stream.writeLong(0);<NEW_LINE>stream.writeLong(0);<NEW_LINE>stream.writeLong(0);<NEW_LINE>}<NEW_LINE>if (holdEvents) {<NEW_LINE>heldEvents.add(stream);<NEW_LINE>} else {<NEW_LINE>connection.queuePacket(stream);<NEW_LINE>}<NEW_LINE>} | writeLong(callFrame.getMethodId()); |
82,827 | private void initNacosServiceBeanBuilderMap(ConfigurableListableBeanFactory beanFactory) {<NEW_LINE>Class<AbstractNacosServiceBeanBuilder> builderClass = AbstractNacosServiceBeanBuilder.class;<NEW_LINE>String[] beanNames = BeanUtils.getBeanNames(beanFactory, builderClass);<NEW_LINE>if (beanNames.length == 0) {<NEW_LINE>throw new NoSuchBeanDefinitionException(builderClass, format("Please check the BeanDefinition of %s in Spring BeanFactory", builderClass));<NEW_LINE>}<NEW_LINE>Collection<AbstractNacosServiceBeanBuilder> serviceBeanBuilders = new ArrayList<AbstractNacosServiceBeanBuilder>(beanNames.length);<NEW_LINE>for (String beanName : beanNames) {<NEW_LINE>serviceBeanBuilders.add(beanFactory.getBean(beanName, builderClass));<NEW_LINE>}<NEW_LINE>if (serviceBeanBuilders.isEmpty()) {<NEW_LINE>throw new NoSuchBeanDefinitionException(builderClass<MASK><NEW_LINE>}<NEW_LINE>Map<Class<?>, AbstractNacosServiceBeanBuilder> builderMap = new HashMap<Class<?>, AbstractNacosServiceBeanBuilder>(serviceBeanBuilders.size());<NEW_LINE>for (AbstractNacosServiceBeanBuilder serviceBeanBuilder : serviceBeanBuilders) {<NEW_LINE>Class<?> type = serviceBeanBuilder.getType();<NEW_LINE>builderMap.put(type, serviceBeanBuilder);<NEW_LINE>}<NEW_LINE>// Should not be modified in future<NEW_LINE>this.nacosServiceBeanBuilderMap = unmodifiableMap(builderMap);<NEW_LINE>} | , format("Please check the BeanDefinition of %s in Spring BeanFactory", builderClass)); |
448,940 | /*<NEW_LINE>* Write the token length in the same way as in tWAS to ensure compatibility.<NEW_LINE>*/<NEW_LINE>private static void writeTokenLength(ByteArrayOutputStream baos, int tokenLength) {<NEW_LINE>if (tokenLength < 128) {<NEW_LINE>baos.write((byte) tokenLength);<NEW_LINE>} else if (tokenLength < (1 << 8)) {<NEW_LINE>baos.write((byte) 0x081);<NEW_LINE>baos.write((byte) tokenLength);<NEW_LINE>} else if (tokenLength < (1 << 16)) {<NEW_LINE>baos.write((byte) 0x082);<NEW_LINE>baos.write((byte) (tokenLength >> 8));<NEW_LINE>baos.write((byte) tokenLength);<NEW_LINE>} else if (tokenLength < (1 << 24)) {<NEW_LINE>baos.write((byte) 0x083);<NEW_LINE>baos.write((byte) (tokenLength >> 16));<NEW_LINE>baos.write((byte) (tokenLength >> 8));<NEW_LINE>baos<MASK><NEW_LINE>} else {<NEW_LINE>baos.write((byte) 0x084);<NEW_LINE>baos.write((byte) (tokenLength >> 24));<NEW_LINE>baos.write((byte) (tokenLength >> 16));<NEW_LINE>baos.write((byte) (tokenLength >> 8));<NEW_LINE>baos.write((byte) tokenLength);<NEW_LINE>}<NEW_LINE>} | .write((byte) tokenLength); |
1,633,458 | private void implementList(ClassCreator classCreator, DataAccessImplementor dataAccessImplementor) {<NEW_LINE>MethodCreator methodCreator = classCreator.getMethodCreator("list", Uni.class, Page.class, Sort.class);<NEW_LINE>ResultHandle page = methodCreator.getMethodParam(0);<NEW_LINE>ResultHandle sort = methodCreator.getMethodParam(1);<NEW_LINE>ResultHandle columns = methodCreator.invokeVirtualMethod(ofMethod(Sort.class, "getColumns", List.class), sort);<NEW_LINE>ResultHandle isEmptySort = methodCreator.invokeInterfaceMethod(ofMethod(List.class, "isEmpty", boolean.class), columns);<NEW_LINE>BranchResult isEmptySortBranch = methodCreator.ifTrue(isEmptySort);<NEW_LINE>isEmptySortBranch.trueBranch().returnValue(dataAccessImplementor.findAll(isEmptySortBranch.trueBranch(), page));<NEW_LINE>isEmptySortBranch.falseBranch().returnValue(dataAccessImplementor.findAll(isEmptySortBranch.falseBranch<MASK><NEW_LINE>methodCreator.close();<NEW_LINE>} | (), page, sort)); |
1,631,162 | private ClassTree insertSecurityFetaureField(WorkingCopy workingCopy, TreeMaker make, ClassTree javaClass, TypeElement classElement) {<NEW_LINE>for (VariableElement var : ElementFilter.fieldsIn(classElement.getEnclosedElements())) {<NEW_LINE>TypeMirror varType = var.asType();<NEW_LINE>if (!varType.getKind().equals(TypeKind.ARRAY)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (var.getSimpleName().contentEquals(PolicyManager.SECURITY_FEATURE)) {<NEW_LINE>return javaClass;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Set<Modifier> modifiers = new HashSet<Modifier>();<NEW_LINE>modifiers.add(Modifier.PRIVATE);<NEW_LINE>modifiers.add(Modifier.STATIC);<NEW_LINE><MASK><NEW_LINE>ModifiersTree modifiersTree = make.Modifiers(modifiers);<NEW_LINE>Tree typeTree = manager.createSecurityFeatureType(workingCopy, make);<NEW_LINE>ExpressionTree initializer = manager.createSecurityFeatureInitializer(workingCopy, make);<NEW_LINE>VariableTree securityFeature = make.Variable(modifiersTree, PolicyManager.SECURITY_FEATURE, typeTree, initializer);<NEW_LINE>if (manager.isSupported()) {<NEW_LINE>manager.modifySecurityFeatureAttribute(securityFeature, workingCopy, make);<NEW_LINE>}<NEW_LINE>return make.insertClassMember(javaClass, 0, securityFeature);<NEW_LINE>} | modifiers.add(Modifier.FINAL); |
1,592,292 | public static QueryFaceDeviceGroupsByDeviceResponse unmarshall(QueryFaceDeviceGroupsByDeviceResponse queryFaceDeviceGroupsByDeviceResponse, UnmarshallerContext _ctx) {<NEW_LINE>queryFaceDeviceGroupsByDeviceResponse.setRequestId(_ctx.stringValue("QueryFaceDeviceGroupsByDeviceResponse.RequestId"));<NEW_LINE>queryFaceDeviceGroupsByDeviceResponse.setSuccess(_ctx.booleanValue("QueryFaceDeviceGroupsByDeviceResponse.Success"));<NEW_LINE>queryFaceDeviceGroupsByDeviceResponse.setCode(_ctx.stringValue("QueryFaceDeviceGroupsByDeviceResponse.Code"));<NEW_LINE>queryFaceDeviceGroupsByDeviceResponse.setErrorMessage(_ctx.stringValue("QueryFaceDeviceGroupsByDeviceResponse.ErrorMessage"));<NEW_LINE>Data data = new Data();<NEW_LINE>data.setTotal(_ctx.integerValue("QueryFaceDeviceGroupsByDeviceResponse.Data.Total"));<NEW_LINE>data.setPageNo(_ctx.integerValue("QueryFaceDeviceGroupsByDeviceResponse.Data.PageNo"));<NEW_LINE>data.setPageSize(_ctx.integerValue("QueryFaceDeviceGroupsByDeviceResponse.Data.PageSize"));<NEW_LINE>List<DeviceGroupListItem> deviceGroupList <MASK><NEW_LINE>for (int i = 0; i < _ctx.lengthValue("QueryFaceDeviceGroupsByDeviceResponse.Data.DeviceGroupList.Length"); i++) {<NEW_LINE>DeviceGroupListItem deviceGroupListItem = new DeviceGroupListItem();<NEW_LINE>deviceGroupListItem.setDeviceGroupId(_ctx.stringValue("QueryFaceDeviceGroupsByDeviceResponse.Data.DeviceGroupList[" + i + "].DeviceGroupId"));<NEW_LINE>deviceGroupListItem.setDeviceGroupName(_ctx.stringValue("QueryFaceDeviceGroupsByDeviceResponse.Data.DeviceGroupList[" + i + "].DeviceGroupName"));<NEW_LINE>deviceGroupListItem.setModifiedTime(_ctx.stringValue("QueryFaceDeviceGroupsByDeviceResponse.Data.DeviceGroupList[" + i + "].ModifiedTime"));<NEW_LINE>deviceGroupList.add(deviceGroupListItem);<NEW_LINE>}<NEW_LINE>data.setDeviceGroupList(deviceGroupList);<NEW_LINE>queryFaceDeviceGroupsByDeviceResponse.setData(data);<NEW_LINE>return queryFaceDeviceGroupsByDeviceResponse;<NEW_LINE>} | = new ArrayList<DeviceGroupListItem>(); |
1,218,686 | public Set<UUID> possibleTargets(UUID sourceControllerId, Game game) {<NEW_LINE>Set<UUID> possibleTargets = new HashSet<>();<NEW_LINE>for (StackObject stackObject : game.getStack()) {<NEW_LINE>if (game.getState().getPlayersInRange(sourceControllerId, game).contains(stackObject.getControllerId()) && Objects.equals(stackObject.getControllerId(), sourceControllerId)) {<NEW_LINE>possibleTargets.add(stackObject.getId());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Permanent permanent : game.getBattlefield().getActivePermanents(sourceControllerId, game)) {<NEW_LINE>if (Objects.equals(permanent.getControllerId(), sourceControllerId)) {<NEW_LINE>possibleTargets.add(permanent.getId());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Player player : game.getPlayers().values()) {<NEW_LINE>if (Objects.equals(player, game.getPlayer(sourceControllerId))) {<NEW_LINE>for (Card card : player.getGraveyard().getCards(game)) {<NEW_LINE>possibleTargets.<MASK><NEW_LINE>}<NEW_LINE>// 108.4a If anything asks for the controller of a card that doesn't have one (because it's not a permanent or spell), use its owner instead.<NEW_LINE>for (Card card : game.getExile().getAllCards(game)) {<NEW_LINE>if (Objects.equals(card.getOwnerId(), sourceControllerId)) {<NEW_LINE>possibleTargets.add(card.getId());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return possibleTargets;<NEW_LINE>} | add(card.getId()); |
1,380,791 | void dump(Reindexing reindexing) {<NEW_LINE>reindexing.status().forEach((type, status) -> {<NEW_LINE>Reindexing.State state = status.state();<NEW_LINE>metric.set("reindexing.progress", status.progress().map(ProgressToken::percentFinished).map(percentage -> percentage * 1e-2).orElse(status.state() == SUCCESSFUL ? 1.0 : 0.0), metric.createContext(Map.of("clusterid", cluster, "documenttype", type.getName(), "state", toString(state))));<NEW_LINE>// Set metric value to -1 for all states not currently active, so we only have one value >= 0 at any given time.<NEW_LINE>for (Reindexing.State unset : EnumSet.complementOf(EnumSet.of(state))) metric.set("reindexing.progress", -1, metric.createContext(Map.of("clusterid", cluster, "documenttype", type.getName(), "state"<MASK><NEW_LINE>});<NEW_LINE>} | , toString(unset)))); |
371,700 | public static String selectServerDialog(J2eeModule.Type[] moduleTypes, Profile j2eeProfile, String title, String description) {<NEW_LINE>NoSelectedServerWarning panel = new NoSelectedServerWarning(moduleTypes, j2eeProfile);<NEW_LINE>Object[] options = new Object[] { DialogDescriptor.OK_OPTION, DialogDescriptor.CANCEL_OPTION };<NEW_LINE>final DialogDescriptor desc = new DialogDescriptor(panel, title, true, options, DialogDescriptor.OK_OPTION, <MASK><NEW_LINE>desc.setMessageType(DialogDescriptor.WARNING_MESSAGE);<NEW_LINE>Dialog dlg = null;<NEW_LINE>try {<NEW_LINE>dlg = DialogDisplayer.getDefault().createDialog(desc);<NEW_LINE>dlg.getAccessibleContext().setAccessibleDescription(description);<NEW_LINE>panel.addPropertyChangeListener(new PropertyChangeListener() {<NEW_LINE><NEW_LINE>public void propertyChange(PropertyChangeEvent evt) {<NEW_LINE>if (evt.getPropertyName().equals(NoSelectedServerWarning.OK_ENABLED)) {<NEW_LINE>Object newvalue = evt.getNewValue();<NEW_LINE>if ((newvalue != null) && (newvalue instanceof Boolean)) {<NEW_LINE>desc.setValid(((Boolean) newvalue));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>desc.setValid(panel.getSelectedInstance() != null);<NEW_LINE>panel.setSize(panel.getPreferredSize());<NEW_LINE>dlg.pack();<NEW_LINE>dlg.setVisible(true);<NEW_LINE>} finally {<NEW_LINE>if (dlg != null) {<NEW_LINE>dlg.dispose();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return desc.getValue() == DialogDescriptor.OK_OPTION ? panel.getSelectedInstance() : null;<NEW_LINE>} | DialogDescriptor.DEFAULT_ALIGN, null, null); |
1,097,160 | /* STOCKMOVE OnClick */<NEW_LINE>public void showClientMyLastDelivery(ActionRequest request, ActionResponse response) {<NEW_LINE>try {<NEW_LINE>ClientViewService clientViewService = <MASK><NEW_LINE>User clientUser = clientViewService.getClientUser();<NEW_LINE>if (clientUser.getPartner() == null) {<NEW_LINE>response.setError(I18n.get(ITranslation.CLIENT_PORTAL_NO_PARTNER));<NEW_LINE>} else {<NEW_LINE>Filter filter = clientViewService.getLastDeliveryOfUser(clientUser).get(0);<NEW_LINE>if (filter != null) {<NEW_LINE>StockMove stockMove = Beans.get(StockMoveRepository.class).all().filter(filter.getQuery()).fetchOne();<NEW_LINE>if (stockMove != null) {<NEW_LINE>response.setView(ActionView.define(I18n.get("Last delivery")).model(StockMove.class.getName()).add("form", "stock-move-form").context("_showRecord", stockMove.getId()).map());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>TraceBackService.trace(response, e);<NEW_LINE>}<NEW_LINE>} | Beans.get(ClientViewService.class); |
783,593 | protected JFreeChart createXyLineChart() throws JRException {<NEW_LINE>JFreeChart jfreeChart = super.createXyLineChart();<NEW_LINE>XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();<NEW_LINE>XYLineAndShapeRenderer lineRenderer = (XYLineAndShapeRenderer) jfreeChart.getXYPlot().getRenderer();<NEW_LINE>XYLine3DRenderer line3DRenderer = new XYLine3DRenderer();<NEW_LINE>line3DRenderer.setBaseToolTipGenerator(lineRenderer.getBaseToolTipGenerator());<NEW_LINE>line3DRenderer.setURLGenerator(lineRenderer.getURLGenerator());<NEW_LINE>line3DRenderer.setBaseStroke(new BasicStroke(2, BasicStroke<MASK><NEW_LINE>line3DRenderer.setBaseLinesVisible(lineRenderer.getBaseLinesVisible());<NEW_LINE>line3DRenderer.setBaseShapesVisible(lineRenderer.getBaseShapesVisible());<NEW_LINE>Stroke stroke = new BasicStroke(2f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);<NEW_LINE>XYDataset xyDataset = xyPlot.getDataset();<NEW_LINE>if (xyDataset != null) {<NEW_LINE>for (int i = 0; i < xyDataset.getSeriesCount(); i++) {<NEW_LINE>line3DRenderer.setSeriesStroke(i, stroke);<NEW_LINE>line3DRenderer.setSeriesLinesVisible(i, lineRenderer.getBaseLinesVisible());<NEW_LINE>line3DRenderer.setSeriesShapesVisible(i, lineRenderer.getBaseShapesVisible());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>line3DRenderer.setXOffset(2);<NEW_LINE>line3DRenderer.setYOffset(2);<NEW_LINE>line3DRenderer.setWallPaint(ChartThemesConstants.GRAY_PAINT_134);<NEW_LINE>xyPlot.setRenderer(line3DRenderer);<NEW_LINE>return jfreeChart;<NEW_LINE>} | .CAP_ROUND, BasicStroke.JOIN_ROUND)); |
931,095 | private void collectHUTransactionCandidate(final IHUTransactionCandidate huTransaction) {<NEW_LINE>final I_M_HU hu = huTransaction.getM_HU();<NEW_LINE>if (hu == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final Quantity quantity = huTransaction.getQuantity();<NEW_LINE>if (quantity.isZero()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final I_M_HU topLevelHU = handlingUnitsBL.getTopLevelParent(hu);<NEW_LINE>final LocatorId effectiveLocatorId = CoalesceUtil.coalesceSuppliers(() -> locatorId, huTransaction::getLocatorId, () <MASK><NEW_LINE>if (effectiveLocatorId == null) {<NEW_LINE>throw new AdempiereException("Cannot figure out on which locator to receive.").setParameter("providedLocatorId", locatorId).setParameter("huTransaction", huTransaction).setParameter("topLevelHU", topLevelHU).appendParametersToMessage();<NEW_LINE>}<NEW_LINE>final AggregationKey key = AggregationKey.builder().locatorId(effectiveLocatorId).topLevelHUId(HuId.ofRepoId(topLevelHU.getM_HU_ID())).productId(huTransaction.getProductId()).build();<NEW_LINE>requests.computeIfAbsent(key, this::createReceiptCandidateRequestBuilder).addQtyToReceive(quantity);<NEW_LINE>} | -> IHandlingUnitsBL.extractLocatorIdOrNull(topLevelHU)); |
921,752 | private void bindAreaVisibilityToSelection() {<NEW_LINE>ReadOnlyBooleanProperty selectionExists = getSkinnable().hasSelectionProperty();<NEW_LINE>ReadOnlyBooleanProperty selectionActive = getSkinnable().selectionActiveProperty();<NEW_LINE>BooleanBinding existsAndActive = Bindings.and(selectionExists, selectionActive);<NEW_LINE>selectedArea.visibleProperty().bind(existsAndActive);<NEW_LINE>unselectedArea.visibleProperty().bind(existsAndActive);<NEW_LINE>// UGLY WORKAROUND AHEAD!<NEW_LINE>// The clipper should be created in 'styleAreas' but due to the problem explained in 'Clipper.setClip(Node)'<NEW_LINE>// it has to be created here where the visibility is determined.<NEW_LINE>// clip the unselected area according to the view's property - this is done by a designated inner class<NEW_LINE>new Clipper(getSkinnable(), unselectedArea, () -> unselectedArea.visibleProperty<MASK><NEW_LINE>} | ().bind(existsAndActive)); |
1,568,810 | private void recalculateGeometry() {<NEW_LINE>// This geometry must match the 3D printed feeder. So this code must remain in sync with the OpenSCAD file.<NEW_LINE>// @see /openpnp/src/main/resources/org/openpnp/machine/reference/feeder/BlindsFeeder-Library.scad<NEW_LINE>// and search for "recalculateGeometry()".<NEW_LINE>// The fiducials give us the first and last sprocket hole positions directly (in feeder-local X-coordinates).<NEW_LINE>// The pockets are then aligned to the sprocket holes according to the EIA 481-C-2003 standard.<NEW_LINE>// According to the EIA-481-C, pockets align with the mid-point between two sprocket holes,<NEW_LINE>// however for the 2mm pitch tapes (0402 and smaller) obviously the pockets also directly<NEW_LINE>// align with sprocket holes.<NEW_LINE>// This means that for 2mm pitch parts we can accommodate one more pocket in the tape i.e.<NEW_LINE>// the first one aligns with the sprocket instead of half the sprocket pitch away.<NEW_LINE>if (pocketPitch.getValue() > 0.0) {<NEW_LINE>boolean isSmallPitch = isSmallPitch();<NEW_LINE>setPocketCount((int) (Math.floor(tapeLength.divide(pocketPitch))) + (isSmallPitch ? 1 : 0));<NEW_LINE>// The wanted pocket center position relative to the pocket pitch is 0.25 for blinds covers,<NEW_LINE>// but 0.5 for all other cover types where the part can be larger than half the pitch.<NEW_LINE>double pitchRelativePosition = (coverType == <MASK><NEW_LINE>// Align the pocket center to the nearest sprocketPitch. Make sure to round 0.5 downwards<NEW_LINE>// (hence the -0.001).<NEW_LINE>Length pocketAlign = sprocketPitch.multiply(Math.round(pocketPitch.multiply(pitchRelativePosition).divide(sprocketPitch) - 0.001));<NEW_LINE>// Now shift that to a mid-point between two sprocket holes (unless it is small pitch)<NEW_LINE>setPocketDistance(sprocketPitch.multiply(isSmallPitch ? 0.0 : 0.5).add(pocketAlign));<NEW_LINE>}<NEW_LINE>} | CoverType.BlindsCover ? 0.25 : 0.5); |
1,336,814 | public double correlation(final KernelDensityEstimate other, final int positionsToShiftOther) {<NEW_LINE>assert other.size() == size() : "The kde size should be the same!";<NEW_LINE>double correlation;<NEW_LINE>double matchingArea = 0.0;<NEW_LINE>double biggestKDEArea = Math.max(getSumFreq(), other.getSumFreq());<NEW_LINE>// an if, else to prevent modulo calculation<NEW_LINE>if (positionsToShiftOther == 0) {<NEW_LINE>for (int i = 0; i < accumulator.length; i++) {<NEW_LINE>matchingArea += Math.min(accumulator[i], other.accumulator[i]);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>for (int i = 0; i < accumulator.length; i++) {<NEW_LINE>int otherIndex = (i + <MASK><NEW_LINE>matchingArea += Math.min(accumulator[i], other.accumulator[otherIndex]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (matchingArea == 0.0) {<NEW_LINE>correlation = 0.0;<NEW_LINE>} else {<NEW_LINE>correlation = matchingArea / biggestKDEArea;<NEW_LINE>}<NEW_LINE>return correlation;<NEW_LINE>} | positionsToShiftOther) % other.size(); |
1,210,678 | private static CuratorTransactionFinal modifyZkRules(CuratorTransactionFinal transactionFinal, String ruleName, List<String> newDataNodes) throws Exception {<NEW_LINE><MASK><NEW_LINE>String rulePath = ZKUtils.getZKBasePath() + "rules/function";<NEW_LINE>JSONArray jsonArray = JSON.parseArray(new String(client.getData().forPath(rulePath), "UTF-8"));<NEW_LINE>for (Object obj : jsonArray) {<NEW_LINE>JSONObject func = (JSONObject) obj;<NEW_LINE>if (ruleName.equalsIgnoreCase(func.getString("name"))) {<NEW_LINE>JSONArray property = func.getJSONArray("property");<NEW_LINE>for (Object o : property) {<NEW_LINE>JSONObject count = (JSONObject) o;<NEW_LINE>if ("count".equals(count.getString("name"))) {<NEW_LINE>Integer xcount = Integer.parseInt(count.getString("value"));<NEW_LINE>count.put("value", String.valueOf(xcount + newDataNodes.size()));<NEW_LINE>if (transactionFinal == null) {<NEW_LINE>transactionFinal = ZKUtils.getConnection().inTransaction().setData().forPath(rulePath, JSON.toJSONBytes(jsonArray)).and();<NEW_LINE>} else {<NEW_LINE>transactionFinal.setData().forPath(rulePath, JSON.toJSONBytes(jsonArray));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return transactionFinal;<NEW_LINE>} | CuratorFramework client = ZKUtils.getConnection(); |
289,139 | private static void processOutputLimitedViewLastCodegen(ResultSetProcessorRowForAllForge forge, CodegenClassScope classScope, CodegenMethod method, CodegenInstanceAux instance) {<NEW_LINE>CodegenMethod getSelectListEventSingle = getSelectListEventSingleCodegen(forge, classScope, instance);<NEW_LINE>method.getBlock().declareVar(EventBean.EPTYPE, "lastOldEvent", constantNull()).declareVar(EventBean.EPTYPE, "lastNewEvent", constantNull()).declareVar(EventBean.EPTYPEARRAY, "eventsPerStream", newArrayByLength(EventBean.EPTYPE, constant(1)));<NEW_LINE>{<NEW_LINE>CodegenBlock forEach = method.getBlock().forEach(UniformPair.EPTYPE, "pair", REF_VIEWEVENTSLIST);<NEW_LINE>if (forge.isSelectRStream()) {<NEW_LINE>forEach.ifCondition(equalsNull(ref("lastOldEvent"))).assignRef("lastOldEvent", localMethod(getSelectListEventSingle, constantFalse()<MASK><NEW_LINE>}<NEW_LINE>forEach.staticMethod(ResultSetProcessorUtil.class, METHOD_APPLYAGGVIEWRESULT, MEMBER_AGGREGATIONSVC, MEMBER_EXPREVALCONTEXT, cast(EventBean.EPTYPEARRAY, exprDotMethod(ref("pair"), "getFirst")), cast(EventBean.EPTYPEARRAY, exprDotMethod(ref("pair"), "getSecond")), ref("eventsPerStream"));<NEW_LINE>forEach.assignRef("lastNewEvent", localMethod(getSelectListEventSingle, constantTrue(), REF_ISSYNTHESIZE));<NEW_LINE>}<NEW_LINE>{<NEW_LINE>CodegenBlock ifEmpty = method.getBlock().ifCondition(exprDotMethod(REF_VIEWEVENTSLIST, "isEmpty"));<NEW_LINE>if (forge.isSelectRStream()) {<NEW_LINE>ifEmpty.assignRef("lastOldEvent", localMethod(getSelectListEventSingle, constantFalse(), REF_ISSYNTHESIZE)).assignRef("lastNewEvent", ref("lastOldEvent"));<NEW_LINE>} else {<NEW_LINE>ifEmpty.assignRef("lastNewEvent", localMethod(getSelectListEventSingle, constantTrue(), REF_ISSYNTHESIZE));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>method.getBlock().declareVar(EventBean.EPTYPEARRAY, "lastNew", staticMethod(CollectionUtil.class, METHOD_TOARRAYMAYNULL, ref("lastNewEvent"))).declareVar(EventBean.EPTYPEARRAY, "lastOld", staticMethod(CollectionUtil.class, METHOD_TOARRAYMAYNULL, ref("lastOldEvent"))).ifCondition(and(equalsNull(ref("lastNew")), equalsNull(ref("lastOld")))).blockReturn(constantNull()).methodReturn(newInstance(UniformPair.EPTYPE, ref("lastNew"), ref("lastOld")));<NEW_LINE>} | , REF_ISSYNTHESIZE)).blockEnd(); |
1,239,543 | static Matcher extractPrefixFromOr(Matcher matcher) {<NEW_LINE>if (matcher instanceof OrMatcher) {<NEW_LINE>// Get the prefix for the first condition<NEW_LINE>List<Matcher> matchers = matcher.<OrMatcher>as().matchers();<NEW_LINE>if (matchers.isEmpty()) {<NEW_LINE>return matcher;<NEW_LINE>}<NEW_LINE>Matcher prefix = PatternUtils.getPrefix(matchers.get(0));<NEW_LINE>if (prefix.alwaysMatches()) {<NEW_LINE>return matcher;<NEW_LINE>}<NEW_LINE>List<Matcher> <MASK><NEW_LINE>ms.add(PatternUtils.getSuffix(matchers.get(0)));<NEW_LINE>// Verify all OR conditions have the same prefix<NEW_LINE>for (Matcher m : matchers.subList(1, matchers.size())) {<NEW_LINE>Matcher p = PatternUtils.getPrefix(m);<NEW_LINE>if (!prefix.equals(p)) {<NEW_LINE>return matcher;<NEW_LINE>}<NEW_LINE>ms.add(PatternUtils.getSuffix(m));<NEW_LINE>}<NEW_LINE>return SeqMatcher.create(prefix, OrMatcher.create(ms));<NEW_LINE>}<NEW_LINE>return matcher;<NEW_LINE>} | ms = new ArrayList<>(); |
1,208,237 | private ResponseAssertion responseAssertion(MsAssertionRegex assertionRegex) {<NEW_LINE>ResponseAssertion assertion = null;<NEW_LINE>if (StringUtils.startsWith(assertionRegex.getDescription(), "Check Error report:")) {<NEW_LINE>this.setName("ErrorReportAssertion");<NEW_LINE>assertion = new ErrorReportAssertion();<NEW_LINE>} else {<NEW_LINE>assertion = new ResponseAssertion();<NEW_LINE>}<NEW_LINE>assertion.setEnabled(this.isEnable());<NEW_LINE>if (StringUtils.isNotEmpty(assertionRegex.getDescription())) {<NEW_LINE>assertion.setName(this.getName() + delimiter + assertionRegex.getDescription());<NEW_LINE>} else {<NEW_LINE>assertion.setName(this.getName() + delimiter + "AssertionRegex");<NEW_LINE>}<NEW_LINE>assertion.setProperty(TestElement.TEST_CLASS, ResponseAssertion.class.getName());<NEW_LINE>assertion.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("AssertionGui"));<NEW_LINE>assertion.<MASK><NEW_LINE>assertion.addTestString(assertionRegex.getExpression());<NEW_LINE>assertion.setToContainsType();<NEW_LINE>if (assertionRegex.getTestType() != 2) {<NEW_LINE>assertion.setProperty("Assertion.test_type", assertionRegex.getTestType());<NEW_LINE>}<NEW_LINE>switch(assertionRegex.getSubject()) {<NEW_LINE>case "Response Code":<NEW_LINE>assertion.setTestFieldResponseCode();<NEW_LINE>break;<NEW_LINE>case "Response Headers":<NEW_LINE>assertion.setTestFieldResponseHeaders();<NEW_LINE>break;<NEW_LINE>case "Response Data":<NEW_LINE>assertion.setTestFieldResponseData();<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>return assertion;<NEW_LINE>} | setAssumeSuccess(assertionRegex.isAssumeSuccess()); |
1,713,880 | public CompletableFuture<Void> lock(final Resource resource, final TaskData taskData, final String owner, final String tag, final String oldOwner, final String oldTag) {<NEW_LINE>return CompletableFuture.supplyAsync(() -> {<NEW_LINE>Preconditions.checkNotNull(resource);<NEW_LINE>Preconditions.checkNotNull(taskData);<NEW_LINE>Preconditions.checkNotNull(owner);<NEW_LINE>Preconditions.checkArgument(!owner.isEmpty());<NEW_LINE>Preconditions.checkNotNull(tag);<NEW_LINE>Preconditions.checkArgument(!tag.isEmpty());<NEW_LINE>Preconditions.checkArgument((oldOwner == null && oldTag == null) || (oldOwner != null && oldTag != null));<NEW_LINE>Preconditions.checkArgument(oldOwner == null || !oldOwner.isEmpty());<NEW_LINE>Preconditions.checkArgument(oldTag == null <MASK><NEW_LINE>if (oldOwner == null) {<NEW_LINE>return acquireLock(resource, taskData, owner, tag);<NEW_LINE>} else {<NEW_LINE>return transferLock(resource, owner, tag, oldOwner, oldTag);<NEW_LINE>}<NEW_LINE>}, executor);<NEW_LINE>} | || !oldTag.isEmpty()); |
381,887 | public void loadAnchors() {<NEW_LINE>this.anchors = new HashMap<String, Location>();<NEW_LINE>this.anchorConfig = YamlConfiguration.loadConfiguration(new File(this.plugin<MASK><NEW_LINE>this.ensureConfigIsPrepared();<NEW_LINE>ConfigurationSection anchorsSection = this.anchorConfig.getConfigurationSection("anchors");<NEW_LINE>Set<String> anchorKeys = anchorsSection.getKeys(false);<NEW_LINE>for (String key : anchorKeys) {<NEW_LINE>// world:x,y,z:pitch:yaw<NEW_LINE>Location anchorLocation = plugin.getLocationManipulation().stringToLocation(anchorsSection.getString(key, ""));<NEW_LINE>if (anchorLocation != null) {<NEW_LINE>Logging.config("Loading anchor: '%s'...", key);<NEW_LINE>this.anchors.put(key, anchorLocation);<NEW_LINE>} else {<NEW_LINE>Logging.warning("The location for anchor '%s' is INVALID.", key);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .getDataFolder(), "anchors.yml")); |
1,294,600 | protected void reload() {<NEW_LINE>// -AWLOCKED<NEW_LINE>clear();<NEW_LINE>try (DataInputStream is = new DataInputStream(new FileInputStream(file))) {<NEW_LINE>long maxRecid = 0;<NEW_LINE>// load records<NEW_LINE>long recCount = IO.readLong(is);<NEW_LINE>for (long i = 0; i < recCount; i++) {<NEW_LINE>long recid = IO.readLong(is);<NEW_LINE>int size = IO.readInt(is);<NEW_LINE>byte[] b = size == -1 ? PREALLOC_RECORD : IO.readByteArray(is, size);<NEW_LINE>records.put(recid, b);<NEW_LINE>maxRecid = <MASK><NEW_LINE>}<NEW_LINE>// restore free recids<NEW_LINE>for (long recid = 0; recid < maxRecid; recid++) {<NEW_LINE>if (!records.containsKey(recid)) {<NEW_LINE>freeRecids.add(recid);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (FileNotFoundException e) {<NEW_LINE>return;<NEW_LINE>} catch (IOException e) {<NEW_LINE>clear();<NEW_LINE>throw new IOError(e);<NEW_LINE>}<NEW_LINE>} | Math.max(maxRecid, recid); |
655,386 | public IPacket deserialize(byte[] data, int offset, int length) throws PacketParsingException {<NEW_LINE>ByteBuffer bb = ByteBuffer.wrap(data, offset, length);<NEW_LINE>// short will be signed, pos or neg<NEW_LINE>this.sourcePort = TransportPort.of((int) (bb.getShort() & 0xffff));<NEW_LINE>// convert range 0 to 65534, not -32768 to 32767<NEW_LINE>this.destinationPort = TransportPort.of((int) (bb.getShort() & 0xffff));<NEW_LINE>this.length = bb.getShort();<NEW_LINE>this.checksum = bb.getShort();<NEW_LINE>// Grab a snapshot of the first four bytes of the UDP payload.<NEW_LINE>// We will use these to see if the payload is SPUD, without<NEW_LINE>// disturbing the existing byte buffer's offsets.<NEW_LINE>ByteBuffer bb_spud = bb.slice();<NEW_LINE>byte[] maybe_spud_bytes = new byte[SPUD.MAGIC_CONSTANT.length];<NEW_LINE>if (bb_spud.remaining() >= SPUD.MAGIC_CONSTANT.length) {<NEW_LINE>bb_spud.get(maybe_spud_bytes, 0, SPUD.MAGIC_CONSTANT.length);<NEW_LINE>}<NEW_LINE>if (UDP.decodeMap.containsKey(this.destinationPort)) {<NEW_LINE>try {<NEW_LINE>this.payload = UDP.decodeMap.get(this.destinationPort)<MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuntimeException("Failure instantiating class", e);<NEW_LINE>}<NEW_LINE>} else if (UDP.decodeMap.containsKey(this.sourcePort)) {<NEW_LINE>try {<NEW_LINE>this.payload = UDP.decodeMap.get(this.sourcePort).getConstructor().newInstance();<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuntimeException("Failure instantiating class", e);<NEW_LINE>}<NEW_LINE>} else if (Arrays.equals(maybe_spud_bytes, SPUD.MAGIC_CONSTANT) && bb.remaining() >= SPUD.HEADER_LENGTH) {<NEW_LINE>this.payload = new SPUD();<NEW_LINE>} else {<NEW_LINE>this.payload = new Data();<NEW_LINE>}<NEW_LINE>this.payload = payload.deserialize(data, bb.position(), bb.limit() - bb.position());<NEW_LINE>this.payload.setParent(this);<NEW_LINE>return this;<NEW_LINE>} | .getConstructor().newInstance(); |
1,351,294 | public static void grayToBuffered(GrayF32 src, DataBufferInt buffer, WritableRaster dst) {<NEW_LINE>final float[] srcData = src.data;<NEW_LINE>final int[] dstData = buffer.getData();<NEW_LINE>final int numBands = dst.getNumBands();<NEW_LINE>if (numBands == 3) {<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, src.height, y -> {<NEW_LINE>for (int y = 0; y < src.height; y++) {<NEW_LINE>int indexSrc = src.startIndex + y * src.stride;<NEW_LINE>int indexDst = y * src.width;<NEW_LINE>for (int x = 0; x < src.width; x++) {<NEW_LINE>int v = (int) srcData[indexSrc++];<NEW_LINE>dstData[indexDst++] = v << 16 | v << 8 | v;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} else if (numBands == 4) {<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, src.height, y -> {<NEW_LINE>for (int y = 0; y < src.height; y++) {<NEW_LINE>int indexSrc = src.startIndex + y * src.stride;<NEW_LINE>int indexDst = y * src.width;<NEW_LINE>for (int x = 0; x < src.width; x++) {<NEW_LINE>int v = <MASK><NEW_LINE>dstData[indexDst++] = 0xFF << 24 | v << 16 | v << 8 | v;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} else {<NEW_LINE>throw new RuntimeException("Code more here");<NEW_LINE>}<NEW_LINE>} | (int) srcData[indexSrc++]; |
8,041 | public Page<ConfigInfo> findAllConfigInfo(final int pageNo, final int pageSize, final String tenant) {<NEW_LINE>String tenantTmp = StringUtils.isBlank(tenant) ? StringUtils.EMPTY : tenant;<NEW_LINE>String sqlCountRows = "SELECT count(*) FROM config_info";<NEW_LINE>String sqlFetchRows = " SELECT t.id,data_id,group_id,tenant_id,app_name,content,md5 " + " FROM ( SELECT id FROM config_info WHERE tenant_id LIKE ? ORDER BY id LIMIT ?,? )" + " g, config_info t WHERE g.id = t.id ";<NEW_LINE>PaginationHelper<ConfigInfo> helper = createPaginationHelper();<NEW_LINE>return helper.fetchPageLimit(sqlCountRows, sqlFetchRows, new Object[] { generateLikeArgument(tenantTmp), (pageNo - 1) * pageSize, pageSize <MASK><NEW_LINE>} | }, pageNo, pageSize, CONFIG_INFO_ROW_MAPPER); |
307,272 | protected MeasureValue[][][] retrieveTotals(List<Bucket> vals, List<BucketMap> bucketMaps) {<NEW_LINE>MeasureValue[][][] totals = new MeasureValue[rowBucketCount + 1][colBucketCount + 1][];<NEW_LINE>for (int row = rowRetrTotalMax; row >= rowRetrTotalMin; --row) {<NEW_LINE>if (!rowRetrTotals[row]) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>BucketMap <MASK><NEW_LINE>for (int i = row; rowMap != null && i < rowBucketCount; ++i) {<NEW_LINE>MapEntry totalEntry = rowMap.getTotalEntry();<NEW_LINE>rowMap = totalEntry == null ? null : (BucketMap) totalEntry.getValue();<NEW_LINE>}<NEW_LINE>for (int col = 0; col <= rowRetrColMax[row]; ++col) {<NEW_LINE>BucketMap colMap = rowMap;<NEW_LINE>if (col < colBucketCount - 1) {<NEW_LINE>if (row == rowBucketCount) {<NEW_LINE>rowMap = bucketMaps.get(rowBucketCount + col + 1);<NEW_LINE>} else if (rowMap != null) {<NEW_LINE>rowMap = (BucketMap) rowMap.get(vals.get(rowBucketCount + col));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!retrieveTotal[row][col]) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>for (int i = col + 1; colMap != null && i < colBucketCount; ++i) {<NEW_LINE>colMap = (BucketMap) colMap.getTotalEntry().getValue();<NEW_LINE>}<NEW_LINE>if (colMap != null) {<NEW_LINE>if (col == colBucketCount) {<NEW_LINE>MeasureValue[] measureValues = (MeasureValue[]) colMap.get(vals.get(rowBucketCount + colBucketCount - 1));<NEW_LINE>if (measureValues != null) {<NEW_LINE>totals[row][col] = getUserMeasureValues(measureValues);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>MapEntry totalEntry = colMap.getTotalEntry();<NEW_LINE>if (totalEntry != null) {<NEW_LINE>MeasureValue[] totalValues = (MeasureValue[]) totalEntry.getValue();<NEW_LINE>totals[row][col] = getUserMeasureValues(totalValues);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (totals[row][col] == null) {<NEW_LINE>totals[row][col] = zeroUserMeasureValues;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return totals;<NEW_LINE>} | rowMap = bucketMaps.get(row); |
1,795,278 | private void addAccountApiRoles(RealmModel realm) {<NEW_LINE>ClientModel accountClient = realm.getClientByClientId(Constants.ACCOUNT_MANAGEMENT_CLIENT_ID);<NEW_LINE>RoleModel viewAppRole = accountClient.addRole(AccountRoles.VIEW_APPLICATIONS);<NEW_LINE>viewAppRole.setDescription("${role_" + AccountRoles.VIEW_APPLICATIONS + "}");<NEW_LINE>LOG.debugf("Added the role %s to the '%s' client.", AccountRoles.VIEW_APPLICATIONS, Constants.ACCOUNT_MANAGEMENT_CLIENT_ID);<NEW_LINE>RoleModel viewConsentRole = accountClient.addRole(AccountRoles.VIEW_CONSENT);<NEW_LINE>viewConsentRole.setDescription("${role_" + AccountRoles.VIEW_CONSENT + "}");<NEW_LINE>LOG.debugf("Added the role %s to the '%s' client.", AccountRoles.VIEW_CONSENT, Constants.ACCOUNT_MANAGEMENT_CLIENT_ID);<NEW_LINE>RoleModel manageConsentRole = accountClient.addRole(AccountRoles.MANAGE_CONSENT);<NEW_LINE>manageConsentRole.setDescription(<MASK><NEW_LINE>LOG.debugf("Added the role %s to the '%s' client.", AccountRoles.MANAGE_CONSENT, Constants.ACCOUNT_MANAGEMENT_CLIENT_ID);<NEW_LINE>manageConsentRole.addCompositeRole(viewConsentRole);<NEW_LINE>LOG.debugf("Added the %s role as a composite role to %s", AccountRoles.VIEW_CONSENT, AccountRoles.MANAGE_CONSENT);<NEW_LINE>} | "${role_" + AccountRoles.MANAGE_CONSENT + "}"); |
1,177,429 | protected static void receiveArg(ThreadContext context, Instr i, Operation operation, IRubyObject[] args, boolean usesKeywords, boolean ruby2Keywords, DynamicScope currDynScope, Object[] temp, Object exception, Block blockArg) {<NEW_LINE>Object result;<NEW_LINE>ResultInstr instr = (ResultInstr) i;<NEW_LINE>switch(operation) {<NEW_LINE>case RECV_PRE_REQD_ARG:<NEW_LINE>int argIndex = ((ReceivePreReqdArgInstr) instr).getArgIndex();<NEW_LINE>result = IRRuntimeHelpers.getPreArgSafe(context, args, argIndex);<NEW_LINE>setResult(temp, currDynScope, instr.getResult(), result);<NEW_LINE>return;<NEW_LINE>case RECV_POST_REQD_ARG:<NEW_LINE>result = ((ReceivePostReqdArgInstr) instr).receivePostReqdArg(context, args, usesKeywords);<NEW_LINE>setResult(temp, currDynScope, instr.getResult(), result);<NEW_LINE>return;<NEW_LINE>case RECV_RUBY_EXC:<NEW_LINE>setResult(temp, currDynScope, instr.getResult(), IRRuntimeHelpers.unwrapRubyException(exception));<NEW_LINE>return;<NEW_LINE>case RECV_JRUBY_EXC:<NEW_LINE>setResult(temp, currDynScope, instr.getResult(), exception);<NEW_LINE>return;<NEW_LINE>case LOAD_IMPLICIT_CLOSURE:<NEW_LINE>setResult(temp, currDynScope, instr.getResult(), blockArg);<NEW_LINE>return;<NEW_LINE>default:<NEW_LINE>result = ((ReceiveArgBase) instr).receiveArg(context, args, usesKeywords);<NEW_LINE>setResult(temp, currDynScope, <MASK><NEW_LINE>}<NEW_LINE>} | instr.getResult(), result); |
200,576 | protected static CsvWriterSettings createSettings(CsvWriteOptions options) {<NEW_LINE>CsvWriterSettings settings = new CsvWriterSettings();<NEW_LINE>// Sets the character sequence to write for the values that are null.<NEW_LINE>settings.setNullValue(nullValue);<NEW_LINE>if (options.separator() != null) {<NEW_LINE>settings.getFormat().setDelimiter(options.separator());<NEW_LINE>}<NEW_LINE>if (options.quoteChar() != null) {<NEW_LINE>settings.getFormat().<MASK><NEW_LINE>}<NEW_LINE>if (options.escapeChar() != null) {<NEW_LINE>settings.getFormat().setQuoteEscape(options.escapeChar());<NEW_LINE>}<NEW_LINE>if (options.lineEnd() != null) {<NEW_LINE>settings.getFormat().setLineSeparator(options.lineEnd());<NEW_LINE>}<NEW_LINE>settings.setIgnoreLeadingWhitespaces(options.ignoreLeadingWhitespaces());<NEW_LINE>settings.setIgnoreTrailingWhitespaces(options.ignoreTrailingWhitespaces());<NEW_LINE>// writes empty lines as well.<NEW_LINE>settings.setSkipEmptyLines(false);<NEW_LINE>settings.setQuoteAllFields(options.quoteAllFields());<NEW_LINE>return settings;<NEW_LINE>} | setQuote(options.quoteChar()); |
598,744 | public static Annotation<?> of(int key, Object value) {<NEW_LINE>if (value == null) {<NEW_LINE>return newNullAnnotation(key);<NEW_LINE>}<NEW_LINE>if (value instanceof String) {<NEW_LINE>return new StringAnnotation(key, (String) value);<NEW_LINE>}<NEW_LINE>if (value instanceof DataType) {<NEW_LINE>return new DataTypeAnnotation(key, (DataType) value);<NEW_LINE>}<NEW_LINE>if (value instanceof Integer) {<NEW_LINE>return new IntAnnotation<MASK><NEW_LINE>}<NEW_LINE>if (value instanceof Long) {<NEW_LINE>return new LongAnnotation(key, (Long) value);<NEW_LINE>}<NEW_LINE>if (value instanceof Double) {<NEW_LINE>return new DoubleAnnotation(key, (Double) value);<NEW_LINE>}<NEW_LINE>if (value instanceof Boolean) {<NEW_LINE>return new BooleanAnnotation(key, (Boolean) value);<NEW_LINE>}<NEW_LINE>if (value instanceof byte[]) {<NEW_LINE>return new BytesAnnotation(key, (byte[]) value);<NEW_LINE>}<NEW_LINE>if (value instanceof Byte) {<NEW_LINE>return new ByteAnnotation(key, (byte) value);<NEW_LINE>}<NEW_LINE>if (value instanceof Float) {<NEW_LINE>return new DoubleAnnotation(key, (Float) value);<NEW_LINE>}<NEW_LINE>if (value instanceof Short) {<NEW_LINE>return new ShortAnnotation(key, (Short) value);<NEW_LINE>}<NEW_LINE>return new ObjectAnnotation(key, value);<NEW_LINE>} | (key, (Integer) value); |
780,268 | // public void textSize(float size)<NEW_LINE>// public float textWidth(char c)<NEW_LINE>// public float textWidth(String str)<NEW_LINE>// protected float textWidthImpl(char buffer[], int start, int stop)<NEW_LINE>// ////////////////////////////////////////////////////////////<NEW_LINE>// TEXT IMPL<NEW_LINE>@Override<NEW_LINE>public void text(char c, float x, float y) {<NEW_LINE>if (textFont == null) {<NEW_LINE>defaultFontOrDeath("text");<NEW_LINE>}<NEW_LINE>int sign = cameraUp ? -1 : +1;<NEW_LINE>if (textAlignY == CENTER) {<NEW_LINE>y <MASK><NEW_LINE>} else if (textAlignY == TOP) {<NEW_LINE>y += sign * textAscent();<NEW_LINE>} else if (textAlignY == BOTTOM) {<NEW_LINE>y -= sign * textDescent();<NEW_LINE>// } else if (textAlignY == BASELINE) {<NEW_LINE>// do nothing<NEW_LINE>}<NEW_LINE>textBuffer[0] = c;<NEW_LINE>textLineAlignImpl(textBuffer, 0, 1, x, y);<NEW_LINE>} | += sign * textAscent() / 2; |
73,361 | private Map<String, org.terracotta.statistics.ValueStatistic<?>> createKnownStatistics(String tierName) {<NEW_LINE>Map<String, org.terracotta.statistics.ValueStatistic<?>> knownStatistics = new HashMap<>(7);<NEW_LINE>addIfPresent(knownStatistics, tierName + ":HitCount", get, this::getHits);<NEW_LINE>addIfPresent(knownStatistics, tierName + ":MissCount", get, this::getMisses);<NEW_LINE>addIfPresent(knownStatistics, tierName + ":PutCount", put, this::getPuts);<NEW_LINE>addIfPresent(knownStatistics, tierName + ":RemovalCount", remove, this::getRemovals);<NEW_LINE>// These two a special because they are used by the cache so they should always be there<NEW_LINE>knownStatistics.put(tierName + ":EvictionCount", ValueStatistics.counter(this::getEvictions));<NEW_LINE>knownStatistics.put(tierName + ":ExpirationCount", ValueStatistics.counter(this::getExpirations));<NEW_LINE>mapping.ifPresent(longValueStatistic -> knownStatistics.put(tierName + ":MappingCount", ValueStatistics.gauge(this::getMappings)));<NEW_LINE>allocatedMemory.ifPresent(longValueStatistic -> knownStatistics.put(tierName + ":AllocatedByteSize", ValueStatistics.<MASK><NEW_LINE>occupiedMemory.ifPresent(longValueStatistic -> knownStatistics.put(tierName + ":OccupiedByteSize", ValueStatistics.gauge(this::getOccupiedByteSize)));<NEW_LINE>return knownStatistics;<NEW_LINE>} | gauge(this::getAllocatedByteSize))); |
516,351 | public static Map toMap(final Object[] array) {<NEW_LINE>if (array == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final Map map = new HashMap((int) (array.length * 1.5));<NEW_LINE>for (int i = 0; i < array.length; i++) {<NEW_LINE>Object object = array[i];<NEW_LINE>if (object instanceof Entry) {<NEW_LINE>Entry entry = (Entry) object;<NEW_LINE>map.put(entry.getKey(), entry.getValue());<NEW_LINE>} else if (object instanceof Object[]) {<NEW_LINE>Object[] entry = (Object[]) object;<NEW_LINE>if (entry.length < 2) {<NEW_LINE>throw new IllegalArgumentException("Array element " + i + ", '" + object + "', has a length less than 2");<NEW_LINE>}<NEW_LINE>map.put(entry[0], entry[1]);<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("Array element " + <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return map;<NEW_LINE>} | i + ", '" + object + "', is neither of type Map.Entry nor an Array"); |
647,824 | public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {<NEW_LINE>if (args.length == 0) {<NEW_LINE>throw new NotEnoughArgumentsException();<NEW_LINE>}<NEW_LINE>User target = user;<NEW_LINE>if (args.length > 1 && user.isAuthorized("essentials.unlimited.others")) {<NEW_LINE>target = getPlayer(server, user, args, 1);<NEW_LINE>}<NEW_LINE>if (args[0].equalsIgnoreCase("list")) {<NEW_LINE>user<MASK><NEW_LINE>} else if (args[0].equalsIgnoreCase("clear")) {<NEW_LINE>for (final Material m : new HashSet<>(target.getUnlimited())) {<NEW_LINE>if (m == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>toggleUnlimited(user, target, m.toString());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>toggleUnlimited(user, target, args[0]);<NEW_LINE>}<NEW_LINE>} | .sendMessage(getList(target)); |
907,702 | protected final Metadata fromKeyValues(Map<String, Object> keyValues) {<NEW_LINE>Map<String, List<String>> mdAsMap = (Map<String, List<String>>) keyValues.get("metadata");<NEW_LINE>Metadata metadata = new Metadata();<NEW_LINE>if (mdAsMap != null) {<NEW_LINE>Iterator<Entry<String, List<String>>> mdIter = mdAsMap.entrySet().iterator();<NEW_LINE>while (mdIter.hasNext()) {<NEW_LINE>Entry<String, List<String>> mdEntry = mdIter.next();<NEW_LINE>String key = mdEntry.getKey();<NEW_LINE>// periods are not allowed in ES2 - replace with %2E<NEW_LINE>key = <MASK><NEW_LINE>Object mdValObj = mdEntry.getValue();<NEW_LINE>// single value<NEW_LINE>if (mdValObj instanceof String) {<NEW_LINE>metadata.addValue(key, (String) mdValObj);<NEW_LINE>} else // multi valued<NEW_LINE>{<NEW_LINE>metadata.addValues(key, (List<String>) mdValObj);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return metadata;<NEW_LINE>} | key.replaceAll("%2E", "\\."); |
886,625 | public void marshall(AwsApiGatewayRestApiDetails awsApiGatewayRestApiDetails, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (awsApiGatewayRestApiDetails == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(awsApiGatewayRestApiDetails.getId(), ID_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(awsApiGatewayRestApiDetails.getDescription(), DESCRIPTION_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsApiGatewayRestApiDetails.getCreatedDate(), CREATEDDATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsApiGatewayRestApiDetails.getVersion(), VERSION_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsApiGatewayRestApiDetails.getBinaryMediaTypes(), BINARYMEDIATYPES_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsApiGatewayRestApiDetails.getMinimumCompressionSize(), MINIMUMCOMPRESSIONSIZE_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsApiGatewayRestApiDetails.getApiKeySource(), APIKEYSOURCE_BINDING);<NEW_LINE>protocolMarshaller.marshall(awsApiGatewayRestApiDetails.getEndpointConfiguration(), ENDPOINTCONFIGURATION_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | awsApiGatewayRestApiDetails.getName(), NAME_BINDING); |
1,822,776 | public RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {<NEW_LINE>// we piggyback verbosity on "human" output<NEW_LINE>boolean verbose = <MASK><NEW_LINE>// In 7.x, there was an opt-in flag to show "enterprise" licenses. In 8.0 the flag is deprecated and can only be true<NEW_LINE>// TODO Remove this from 9.0<NEW_LINE>if (request.hasParam("accept_enterprise")) {<NEW_LINE>deprecationLogger.warn(DeprecationCategory.API, "get_license_accept_enterprise", "Including [accept_enterprise] in get license requests is deprecated." + " The parameter will be removed in the next major version");<NEW_LINE>if (request.paramAsBoolean("accept_enterprise", true) == false && request.getRestApiVersion().matches(onOrAfter(RestApiVersion.V_8))) {<NEW_LINE>throw new IllegalArgumentException("The [accept_enterprise] parameters may not be false");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>EnumSet<XPackInfoRequest.Category> categories = XPackInfoRequest.Category.toSet(request.paramAsStringArray("categories", new String[] { "_all" }));<NEW_LINE>return channel -> new XPackInfoRequestBuilder(client).setVerbose(verbose).setCategories(categories).execute(new RestToXContentListener<>(channel));<NEW_LINE>} | request.paramAsBoolean("human", true); |
1,244,003 | private BLangExpression createConditionForErrorBindingPattern(BLangErrorBindingPattern errorBindingPattern, BLangSimpleVarRef matchExprVarRef) {<NEW_LINE>BType bindingPatternType = errorBindingPattern.getBType();<NEW_LINE>Location pos = errorBindingPattern.pos;<NEW_LINE>BLangSimpleVariableDef resultVarDef = createVarDef("errorBindingPatternResult$", symTable.booleanType, null, pos);<NEW_LINE>BLangSimpleVarRef resultVarRef = ASTBuilderUtil.createVariableRef(pos, resultVarDef.var.symbol);<NEW_LINE>BLangBlockStmt mainBlockStmt = ASTBuilderUtil.createBlockStmt(pos);<NEW_LINE>mainBlockStmt.addStatement(resultVarDef);<NEW_LINE>if (bindingPatternType == symTable.noType) {<NEW_LINE>return createConditionForUnmatchedPattern(resultVarRef, mainBlockStmt);<NEW_LINE>}<NEW_LINE>BLangAssignment failureResult = ASTBuilderUtil.createAssignmentStmt(pos, resultVarRef, getBooleanLiteral(false));<NEW_LINE>BLangAssignment successResult = ASTBuilderUtil.createAssignmentStmt(pos, resultVarRef, getBooleanLiteral(true));<NEW_LINE>mainBlockStmt.addStatement(failureResult);<NEW_LINE>BLangExpression typeCheckCondition = createIsLikeExpression(pos, matchExprVarRef, bindingPatternType);<NEW_LINE>BLangExpression typeConvertedExpr = addConversionExprIfRequired(matchExprVarRef, bindingPatternType);<NEW_LINE>BLangSimpleVariableDef tempCastVarDef = createVarDef("$castTemp$", bindingPatternType, typeConvertedExpr, pos);<NEW_LINE>BLangSimpleVarRef tempCastVarRef = ASTBuilderUtil.createVariableRef(pos, tempCastVarDef.var.symbol);<NEW_LINE>BLangBlockStmt ifBlock = ASTBuilderUtil.createBlockStmt(pos);<NEW_LINE>ifBlock.addStatement(tempCastVarDef);<NEW_LINE>BLangIf ifStmt = ASTBuilderUtil.createIfElseStmt(pos, typeCheckCondition, ifBlock, null);<NEW_LINE>mainBlockStmt.addStatement(ifStmt);<NEW_LINE>BLangBlockStmt <MASK><NEW_LINE>BLangExpression condition = createConditionForErrorArgListBindingPattern(errorBindingPattern, ifBlock, tempBlockStmt, tempCastVarRef, pos);<NEW_LINE>tempBlockStmt.addStatement(successResult);<NEW_LINE>BLangIf ifStmtForMatchPatterns = ASTBuilderUtil.createIfElseStmt(pos, condition, tempBlockStmt, null);<NEW_LINE>ifBlock.addStatement(ifStmtForMatchPatterns);<NEW_LINE>BLangStatementExpression statementExpression = ASTBuilderUtil.createStatementExpression(mainBlockStmt, resultVarRef);<NEW_LINE>statementExpression.setBType(symTable.booleanType);<NEW_LINE>return statementExpression;<NEW_LINE>} | tempBlockStmt = ASTBuilderUtil.createBlockStmt(pos); |
229,036 | public boolean onHover(View view, MotionEvent event) {<NEW_LINE>int position = (int) view.getTag(R.string.position_tag);<NEW_LINE>if (!isEnabled(position)) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (mItems.size() <= position) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>MenuItem item = mItems.get(position);<NEW_LINE>if (item.mCallback == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>TextView label = view.<MASK><NEW_LINE>switch(event.getActionMasked()) {<NEW_LINE>case MotionEvent.ACTION_HOVER_ENTER:<NEW_LINE>label.setShadowLayer(label.getShadowRadius(), label.getShadowDx(), label.getShadowDy(), mContext.getColor(R.color.text_shadow_light));<NEW_LINE>return false;<NEW_LINE>case MotionEvent.ACTION_HOVER_EXIT:<NEW_LINE>label.setShadowLayer(label.getShadowRadius(), label.getShadowDx(), label.getShadowDy(), mContext.getColor(R.color.text_shadow));<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | findViewById(R.id.listItemText); |
104,847 | public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.GetTokenRequest request, Qos1PublishHandler.IMCallback callback) {<NEW_LINE>MemorySessionStore.Session session = m_sessionsStore.updateOrCreateUserSession(fromUser, clientID, request.getPlatform());<NEW_LINE>WFCMessage.User userInfo = m_messagesStore.getUserInfo(fromUser);<NEW_LINE>if (userInfo != null && userInfo.getType() == 1) {<NEW_LINE>return ErrorCode.ERROR_CODE_ROBOT_NO_TOKEN;<NEW_LINE>}<NEW_LINE>TokenAuthenticator authenticator = new TokenAuthenticator();<NEW_LINE>String strToken = authenticator.generateToken(fromUser);<NEW_LINE>String result = strToken + "|" + session.getSecret() <MASK><NEW_LINE>byte[] data = result.getBytes();<NEW_LINE>ackPayload.ensureWritable(data.length).writeBytes(data);<NEW_LINE>return ErrorCode.ERROR_CODE_SUCCESS;<NEW_LINE>} | + "|" + session.getDbSecret(); |
1,040,809 | final GetPortalResult executeGetPortal(GetPortalRequest getPortalRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getPortalRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetPortalRequest> request = null;<NEW_LINE>Response<GetPortalResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetPortalRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getPortalRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "WorkSpaces Web");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetPortal");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetPortalResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetPortalResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); |
995,698 | public void findAllCycles(EdgeWeightedDigraphInterface edgeWeightedDigraph) {<NEW_LINE>blockedVerticesSet = new HashSet<>();<NEW_LINE>blockedVerticesMap = new SeparateChainingHashTable<>();<NEW_LINE>stack = new ArrayDeque<>();<NEW_LINE>allCyclesByVertices = new ArrayList<>();<NEW_LINE>stackOfEdges = new ArrayDeque<>();<NEW_LINE>allCyclesByEdges = new ArrayList<>();<NEW_LINE>verticesCount = edgeWeightedDigraph.vertices();<NEW_LINE>KosarajuSharirSCCWeighted kosarajuSharirSCCWeighted = new KosarajuSharirSCCWeighted(edgeWeightedDigraph);<NEW_LINE>List<Integer>[] stronglyConnectedComponents = kosarajuSharirSCCWeighted.getSCCs();<NEW_LINE>for (List<Integer> stronglyConnectedComponent : stronglyConnectedComponents) {<NEW_LINE>if (stronglyConnectedComponent.size() == 1) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>EdgeWeightedDigraphInterface sccSubGraph = createSubGraphFromSCC(edgeWeightedDigraph, stronglyConnectedComponent);<NEW_LINE>for (int vertexToProcess : stronglyConnectedComponent) {<NEW_LINE>if (sccSubGraph.outdegree(vertexToProcess) == 0) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// Clear blockedVerticesSet and blockedVerticesMap<NEW_LINE>blockedVerticesSet = new HashSet<>();<NEW_LINE>blockedVerticesMap = new SeparateChainingHashTable<>();<NEW_LINE>findCycles(<MASK><NEW_LINE>sccSubGraph = createSubGraphByRemovingVertex(sccSubGraph, vertexToProcess);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | sccSubGraph, vertexToProcess, vertexToProcess, null); |
151,102 | public void encodeMessage(byte[] data) {<NEW_LINE>super.encodeMessage(data);<NEW_LINE>subType = SubType.fromByte(super.subType);<NEW_LINE>sensorId = (data[4] & 0xFF) << 8 | (data[5] & 0xFF);<NEW_LINE>// dateTime = "yyyy-MM-dd'T'HH:mm:ss";<NEW_LINE>yy = data[6] & 0xFF;<NEW_LINE>MM = data[7] & 0xFF;<NEW_LINE>dd = data[8] & 0xFF;<NEW_LINE>dow = data[9] & 0xFF;<NEW_LINE>HH = data[10] & 0xFF;<NEW_LINE><MASK><NEW_LINE>ss = data[12] & 0xFF;<NEW_LINE>dateTime = "20" + yy;<NEW_LINE>dateTime += "-" + MM;<NEW_LINE>dateTime += "-" + dd;<NEW_LINE>dateTime += "T" + HH;<NEW_LINE>dateTime += ":" + mm;<NEW_LINE>dateTime += ":" + ss;<NEW_LINE>signalLevel = (byte) ((data[13] & 0xF0) >> 4);<NEW_LINE>batteryLevel = (byte) (data[13] & 0x0F);<NEW_LINE>} | mm = data[11] & 0xFF; |
529,024 | public void marshall(ChannelResponse channelResponse, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (channelResponse == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(channelResponse.getApplicationId(), APPLICATIONID_BINDING);<NEW_LINE>protocolMarshaller.marshall(channelResponse.getCreationDate(), CREATIONDATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(channelResponse.getEnabled(), ENABLED_BINDING);<NEW_LINE>protocolMarshaller.marshall(channelResponse.getHasCredential(), HASCREDENTIAL_BINDING);<NEW_LINE>protocolMarshaller.marshall(channelResponse.getId(), ID_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(channelResponse.getLastModifiedBy(), LASTMODIFIEDBY_BINDING);<NEW_LINE>protocolMarshaller.marshall(channelResponse.getLastModifiedDate(), LASTMODIFIEDDATE_BINDING);<NEW_LINE>protocolMarshaller.marshall(channelResponse.getVersion(), VERSION_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | channelResponse.getIsArchived(), ISARCHIVED_BINDING); |
1,164,714 | public void onPlayerPostLogin(PostLoginEvent e) {<NEW_LINE>final <MASK><NEW_LINE>final User user = this.plugin.getUserManager().getIfLoaded(e.getPlayer().getUniqueId());<NEW_LINE>if (this.plugin.getConfiguration().get(ConfigKeys.DEBUG_LOGINS)) {<NEW_LINE>this.plugin.getLogger().info("Processing post-login for " + player.getUniqueId() + " - " + player.getName());<NEW_LINE>}<NEW_LINE>if (user == null) {<NEW_LINE>if (!getUniqueConnections().contains(player.getUniqueId())) {<NEW_LINE>this.plugin.getLogger().warn("User " + player.getUniqueId() + " - " + player.getName() + " doesn't have data pre-loaded, they have never been processed during pre-login in this session.");<NEW_LINE>} else {<NEW_LINE>this.plugin.getLogger().warn("User " + player.getUniqueId() + " - " + player.getName() + " doesn't currently have data pre-loaded, but they have been processed before in this session.");<NEW_LINE>}<NEW_LINE>if (this.plugin.getConfiguration().get(ConfigKeys.CANCEL_FAILED_LOGINS)) {<NEW_LINE>// disconnect the user<NEW_LINE>Component reason = TranslationManager.render(Message.LOADING_DATABASE_ERROR.build());<NEW_LINE>e.getPlayer().disconnect(BungeeComponentSerializer.get().serialize(reason));<NEW_LINE>} else {<NEW_LINE>// just send a message<NEW_LINE>this.plugin.getBootstrap().getProxy().getScheduler().schedule(this.plugin.getLoader(), () -> {<NEW_LINE>if (!player.isConnected()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Message.LOADING_STATE_ERROR.send(this.plugin.getSenderFactory().wrap(player));<NEW_LINE>}, 1, TimeUnit.SECONDS);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ProxiedPlayer player = e.getPlayer(); |
526,299 | protected Void run() throws Exception {<NEW_LINE>GitLabWebHookCause cause = run.getCause(GitLabWebHookCause.class);<NEW_LINE>if (cause != null) {<NEW_LINE>MergeRequest mergeRequest = cause.getData().getMergeRequest();<NEW_LINE>if (mergeRequest != null) {<NEW_LINE>GitLabClient client = getClient(run);<NEW_LINE>if (client == null) {<NEW_LINE>println("No GitLab connection configured");<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>client.acceptMergeRequest(mergeRequest, getCommitMessage<MASK><NEW_LINE>} catch (WebApplicationException | ProcessingException e) {<NEW_LINE>printf("Failed to accept merge request for project '%s': %s%n", mergeRequest.getProjectId(), e.getMessage());<NEW_LINE>LOGGER.log(Level.SEVERE, String.format("Failed to accept merge request for project '%s'", mergeRequest.getProjectId()), e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | (mergeRequest), step.removeSourceBranch); |
1,100,952 | public TestSuite buildTestSuite() throws Exception {<NEW_LINE>TestSuite suite = new TestSuite();<NEW_LINE>final ArrayList<URL> urlList = new ArrayList<URL>();<NEW_LINE>urlList.add(<MASK><NEW_LINE>if (classpath != null) {<NEW_LINE>StringTokenizer tok = new StringTokenizer(classpath, File.pathSeparator);<NEW_LINE>while (tok.hasMoreTokens()) {<NEW_LINE>urlList.add(new URL("file:" + tok.nextToken()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ClassLoader cl = AccessController.doPrivileged(new PrivilegedExceptionAction<URLClassLoader>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public URLClassLoader run() throws Exception {<NEW_LINE>return new URLClassLoader(urlList.toArray(new URL[urlList.size()]));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>Class<junit.framework.TestCase> testCaseClass = getTestCase(cl);<NEW_LINE>try (JarFile jarFile = new JarFile(jarFileName)) {<NEW_LINE>Enumeration<JarEntry> e = jarFile.entries();<NEW_LINE>while (e.hasMoreElements()) {<NEW_LINE>JarEntry entry = e.nextElement();<NEW_LINE>String entryName = entry.getName();<NEW_LINE>if (entryName.endsWith(".class")) {<NEW_LINE>String className = entryName.substring(0, entryName.length() - ".class".length()).replace('/', '.');<NEW_LINE>if (!className.endsWith("Test")) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>System.out.println("Loading test class: " + className);<NEW_LINE>System.out.flush();<NEW_LINE>Class<?> jarClass = cl.loadClass(className);<NEW_LINE>if (testCaseClass.isAssignableFrom(jarClass)) {<NEW_LINE>suite.addTestSuite(testCaseClass.asSubclass(testCaseClass));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return suite;<NEW_LINE>} | new URL("file:" + jarFileName)); |
1,275,021 | private Method findSuperclassMethod(@DottedClassName String superclassName, Method subclassMethod) throws ClassNotFoundException {<NEW_LINE>String methodName = subclassMethod.getName();<NEW_LINE>Type[] subArgs = null;<NEW_LINE>JavaClass superClass = Repository.lookupClass(superclassName);<NEW_LINE>Method[] methods = superClass.getMethods();<NEW_LINE>outer: for (Method m : methods) {<NEW_LINE>if (m.getName().equals(methodName)) {<NEW_LINE>if (subArgs == null) {<NEW_LINE>subArgs = Type.getArgumentTypes(subclassMethod.getSignature());<NEW_LINE>}<NEW_LINE>Type[] superArgs = Type.getArgumentTypes(m.getSignature());<NEW_LINE>if (subArgs.length == superArgs.length) {<NEW_LINE>for (int j = 0; j < subArgs.length; j++) {<NEW_LINE>if (!superArgs[j].equals(subArgs[j])) {<NEW_LINE>continue outer;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return m;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!"Object".equals(superclassName)) {<NEW_LINE>@DottedClassName<NEW_LINE><MASK><NEW_LINE>if (superSuperClassName.equals(superclassName)) {<NEW_LINE>throw new ClassNotFoundException("superclass of " + superclassName + " is itself");<NEW_LINE>}<NEW_LINE>return findSuperclassMethod(superSuperClassName, subclassMethod);<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | String superSuperClassName = superClass.getSuperclassName(); |
1,038,675 | // ------------------ Serialization<NEW_LINE>public Slime toSlime(Application application) {<NEW_LINE>Slime slime = new Slime();<NEW_LINE>Cursor root = slime.setObject();<NEW_LINE>root.setString(idField, application.id().serialized());<NEW_LINE>root.setLong(createdAtField, application.createdAt().toEpochMilli());<NEW_LINE>root.setString(deploymentSpecField, application.deploymentSpec().xmlForm());<NEW_LINE>root.setString(validationOverridesField, application.validationOverrides().xmlForm());<NEW_LINE>application.projectId().ifPresent(projectId -> root.setLong(projectIdField, projectId));<NEW_LINE>application.deploymentIssueId().ifPresent(jiraIssueId -> root.setString(deploymentIssueField, jiraIssueId.value()));<NEW_LINE>application.ownershipIssueId().ifPresent(issueId -> root.setString(ownershipIssueIdField, issueId.value()));<NEW_LINE>application.owner().ifPresent(owner -> root.setString(ownerField, owner.username()));<NEW_LINE>application.majorVersion().ifPresent(majorVersion -> root.setLong(majorVersionField, majorVersion));<NEW_LINE>root.setDouble(queryQualityField, application.metrics().queryServiceQuality());<NEW_LINE>root.setDouble(writeQualityField, application.<MASK><NEW_LINE>deployKeysToSlime(application.deployKeys(), root.setArray(pemDeployKeysField));<NEW_LINE>application.latestVersion().ifPresent(version -> toSlime(version, root.setObject(latestVersionField)));<NEW_LINE>versionsToSlime(application, root.setArray(versionsField));<NEW_LINE>instancesToSlime(application, root.setArray(instancesField));<NEW_LINE>return slime;<NEW_LINE>} | metrics().writeServiceQuality()); |
1,648,576 | public static <T> SerializedValue serialize(Class<T> javaType, T value) {<NEW_LINE>if (value == null) {<NEW_LINE>return new SerializedValue(null, null, null);<NEW_LINE>}<NEW_LINE>if (JodaBeanUtils.stringConverter().isConvertible(javaType)) {<NEW_LINE>String str = JodaBeanUtils.stringConverter().convertToString(javaType, value);<NEW_LINE>return new SerializedValue(str, null, null);<NEW_LINE>}<NEW_LINE>if (value instanceof Bean) {<NEW_LINE>byte[] bytes = JodaBeanSer.COMPACT.binWriter().write((Bean) value, false);<NEW_LINE>return new SerializedValue(null, bytes, null);<NEW_LINE>}<NEW_LINE>if (value instanceof Serializable) {<NEW_LINE>try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {<NEW_LINE>try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {<NEW_LINE>oos.writeObject(value);<NEW_LINE>oos.flush();<NEW_LINE>}<NEW_LINE>return new SerializedValue(null, <MASK><NEW_LINE>} catch (IOException ex) {<NEW_LINE>throw new UncheckedIOException(ex);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>throw new IllegalArgumentException("Value must be a Joda-Convert type, Joda-Bean or Serializable");<NEW_LINE>}<NEW_LINE>} | null, baos.toByteArray()); |
461,280 | private boolean projectBuild(Project project, String socketId) {<NEW_LINE>StringBuilder builder = tailBuffer.get(project.getId());<NEW_LINE>int code = CommandUtils.execute(project.getMavenWorkHome(), Arrays.asList(project.getMavenArgs()), (line) -> {<NEW_LINE>builder.append(line).append("\n");<NEW_LINE>if (tailOutMap.containsKey(project.getId())) {<NEW_LINE>if (tailBeginning.containsKey(project.getId())) {<NEW_LINE>tailBeginning.<MASK><NEW_LINE>Arrays.stream(builder.toString().split("\n")).forEach(out -> WebSocketEndpoint.writeMessage(socketId, out));<NEW_LINE>}<NEW_LINE>WebSocketEndpoint.writeMessage(socketId, line);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>closeBuildLog(project.getId());<NEW_LINE>log.info(builder.toString());<NEW_LINE>tailBuffer.remove(project.getId());<NEW_LINE>return code == 0;<NEW_LINE>} | remove(project.getId()); |
1,603,389 | public String compact(@CliOption(key = { "parallelism" }, mandatory = true, help = "Parallelism for hoodie compaction") final String parallelism, @CliOption(key = "schemaFilePath", mandatory = true, help = "Path for Avro schema file") final String schemaFilePath, @CliOption(key = "sparkMaster", unspecifiedDefaultValue = "local", help = "Spark Master") String master, @CliOption(key = "sparkMemory", unspecifiedDefaultValue = "4G", help = "Spark executor memory") final String sparkMemory, @CliOption(key = "retry", unspecifiedDefaultValue = "1", help = "Number of retries") final String retry, @CliOption(key = "compactionInstant", help = "Base path for the target hoodie table") String compactionInstantTime, @CliOption(key = "propsFilePath", help = "path to properties file on localfs or dfs with configurations for hoodie client for compacting", unspecifiedDefaultValue = "") final String propsFilePath, @CliOption(key = "hoodieConfigs", help = "Any configuration that can be set in the properties file can be passed here in the form of an array", unspecifiedDefaultValue = "") final String[] configs) throws Exception {<NEW_LINE>HoodieTableMetaClient client = checkAndGetMetaClient();<NEW_LINE>boolean initialized = HoodieCLI.initConf();<NEW_LINE>HoodieCLI.initFS(initialized);<NEW_LINE>if (null == compactionInstantTime) {<NEW_LINE>// pick outstanding one with lowest timestamp<NEW_LINE>Option<String> firstPendingInstant = client.reloadActiveTimeline().filterCompletedAndCompactionInstants().filter(instant -> instant.getAction().equals(HoodieTimeline.COMPACTION_ACTION)).firstInstant().map(HoodieInstant::getTimestamp);<NEW_LINE>if (!firstPendingInstant.isPresent()) {<NEW_LINE>return "NO PENDING COMPACTION TO RUN";<NEW_LINE>}<NEW_LINE>compactionInstantTime = firstPendingInstant.get();<NEW_LINE>}<NEW_LINE>String sparkPropertiesPath = Utils.getDefaultPropertiesFile(scala.collection.JavaConversions.propertiesAsScalaMap(System.getProperties()));<NEW_LINE>SparkLauncher sparkLauncher = SparkUtil.initLauncher(sparkPropertiesPath);<NEW_LINE>sparkLauncher.addAppArgs(SparkCommand.COMPACT_RUN.toString(), master, sparkMemory, client.getBasePath(), client.getTableConfig().getTableName(), compactionInstantTime, parallelism, schemaFilePath, retry, propsFilePath);<NEW_LINE>UtilHelpers.validateAndAddProperties(configs, sparkLauncher);<NEW_LINE>Process process = sparkLauncher.launch();<NEW_LINE>InputStreamConsumer.captureOutput(process);<NEW_LINE><MASK><NEW_LINE>if (exitCode != 0) {<NEW_LINE>return "Failed to run compaction for " + compactionInstantTime;<NEW_LINE>}<NEW_LINE>return "Compaction successfully completed for " + compactionInstantTime;<NEW_LINE>} | int exitCode = process.waitFor(); |
1,499,067 | public void converge(NodeAgentContext context, Supplier<Map<String, Object>> nodeAttributesSupplier, boolean throwIfCoreBeingWritten) {<NEW_LINE>ContainerPath containerCrashPath = context.<MASK><NEW_LINE>ContainerPath containerProcessingPath = containerCrashPath.resolve(PROCESSING_DIRECTORY_NAME);<NEW_LINE>updateMetrics(context, containerCrashPath);<NEW_LINE>if (throwIfCoreBeingWritten) {<NEW_LINE>List<String> pendingCores = FileFinder.files(containerCrashPath).match(fileAttributes -> !isReadyForProcessing(fileAttributes)).maxDepth(1).stream().map(FileFinder.FileAttributes::filename).collect(Collectors.toUnmodifiableList());<NEW_LINE>if (!pendingCores.isEmpty())<NEW_LINE>throw new ConvergenceException(String.format("Cannot process %s coredumps: Still being written", pendingCores.size() < 5 ? pendingCores : pendingCores.size()));<NEW_LINE>}<NEW_LINE>// Check if we have already started to process a core dump or we can enqueue a new core one<NEW_LINE>getCoredumpToProcess(containerCrashPath, containerProcessingPath).ifPresent(path -> processAndReportSingleCoredump(context, path, nodeAttributesSupplier));<NEW_LINE>} | paths().of(crashPatchInContainer); |
1,725,002 | public CommandFuture<?> migrate(BeaconMigrationRequest migrationRequest) {<NEW_LINE>logger.debug("[migrate][{}] begin", migrationRequest.getClusterName());<NEW_LINE>SequenceCommandChain migrateSequenceCmd = new SequenceCommandChain();<NEW_LINE>migrateSequenceCmd.add(new MigrationPreCheckCmd(migrationRequest, checker, configService, clusterService, dcCache, beaconMetaService));<NEW_LINE>migrateSequenceCmd.add(new MigrationFetchProcessingEventCmd(migrationRequest, clusterService, migrationClusterDao, dcCache));<NEW_LINE>migrateSequenceCmd.add(new MigrationChooseTargetDcCmd(migrationRequest, dcCache, dcClusterService));<NEW_LINE>migrateSequenceCmd.add(new MigrationBuildEventCmd(migrationRequest, migrationEventDao, migrationEventManager));<NEW_LINE>migrateSequenceCmd.add(new MigrationDoExecuteCmd(migrationRequest, migrationEventManager, migrationExecutors));<NEW_LINE>CommandFuture<?> future = migrateSequenceCmd.execute(prepareExecutors);<NEW_LINE>long timeoutMilli = config.getMigrationTimeoutMilli();<NEW_LINE>ScheduledFuture<?> scheduledFuture = scheduled.schedule(() -> {<NEW_LINE>if (future.isDone()) {<NEW_LINE>// already done, do nothing<NEW_LINE>} else if (migrateSequenceCmd.executeCount() <= 0) {<NEW_LINE>logger.info("[migrate][{}] timeout", migrationRequest.getClusterName());<NEW_LINE>future.cancel(false);<NEW_LINE>} else {<NEW_LINE>logger.info("[migrate][{}] timeout but already running, continue", migrationRequest.getClusterName());<NEW_LINE>}<NEW_LINE>}, timeoutMilli, TimeUnit.MILLISECONDS);<NEW_LINE>future.addListener(commandFuture -> {<NEW_LINE>boolean cancelTimeout = true;<NEW_LINE>if (commandFuture.isSuccess()) {<NEW_LINE>// do nothing<NEW_LINE>} else if (commandFuture.isCancelled()) {<NEW_LINE>// already timeout<NEW_LINE>cancelTimeout = false;<NEW_LINE>} else if (!(commandFuture.cause() instanceof CommandChainException)) {<NEW_LINE>logger.info("[migrate][{}] unexpected exception", migrationRequest.getClusterName(), commandFuture.cause());<NEW_LINE>} else if (commandFuture.cause().getCause() instanceof UnexpectMigrationDataException) {<NEW_LINE>alertManager.alert(migrationRequest.getClusterName(), null, null, ALERT_TYPE.MIGRATION_DATA_CONFLICT, commandFuture.<MASK><NEW_LINE>}<NEW_LINE>if (cancelTimeout) {<NEW_LINE>scheduledFuture.cancel(false);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return future;<NEW_LINE>} | cause().getMessage()); |
450,070 | public static KeyValuePart[] split(MatrixMeta matrixMeta, int rowId, int[] keys, int[] values) {<NEW_LINE>PartitionKey[] matrixParts = matrixMeta.getPartitionKeys();<NEW_LINE>int matrixPartNumMinus1 = matrixParts.length - 1;<NEW_LINE>KeyValuePart[] keyValueParts = new KeyValuePart[matrixParts.length];<NEW_LINE>int avgPartElemNum = keys.length / matrixParts.length;<NEW_LINE>for (int i = 0; i < keyValueParts.length; i++) {<NEW_LINE>keyValueParts[i] = new HashIntKeysIntValuesPart(rowId, avgPartElemNum);<NEW_LINE>}<NEW_LINE>int[] hashCodes = computeHashCode(matrixMeta, keys);<NEW_LINE>if (isPow2(matrixParts.length)) {<NEW_LINE>for (int i = 0; i < hashCodes.length; i++) {<NEW_LINE>int partIndex = hashCodes[i] & (matrixPartNumMinus1);<NEW_LINE>((HashIntKeysIntValuesPart) keyValueParts[partIndex]).add(keys[i], values[i]);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>for (int i = 0; i < hashCodes.length; i++) {<NEW_LINE>int partIndex = <MASK><NEW_LINE>((HashIntKeysIntValuesPart) keyValueParts[partIndex]).add(keys[i], values[i]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return keyValueParts;<NEW_LINE>} | hashCodes[i] % matrixParts.length; |
547,061 | void initDeleteStatsGaugesIfNeeded() {<NEW_LINE>if (deleteStatsGaugeInitialized.compareAndSet(false, true)) {<NEW_LINE>Gauge<Long> expiredDeleteTombstoneCount = () -> aggregatedDeleteTombstoneStats.get().getExpiredDeleteTombstoneCount();<NEW_LINE>registry.register(MetricRegistry.name(StatsManager<MASK><NEW_LINE>Gauge<Long> expiredDeleteTombstoneSize = () -> aggregatedDeleteTombstoneStats.get().getExpiredDeleteTombstoneSize();<NEW_LINE>registry.register(MetricRegistry.name(StatsManager.class, "ExpiredDeleteTombstoneSize"), expiredDeleteTombstoneSize);<NEW_LINE>Gauge<Long> permanentDeleteTombstoneCount = () -> aggregatedDeleteTombstoneStats.get().getPermanentDeleteTombstoneCount();<NEW_LINE>registry.register(MetricRegistry.name(StatsManager.class, "PermanentDeleteTombstoneCount"), permanentDeleteTombstoneCount);<NEW_LINE>Gauge<Long> permanentDeleteTombstoneSize = () -> aggregatedDeleteTombstoneStats.get().getPermanentDeleteTombstoneSize();<NEW_LINE>registry.register(MetricRegistry.name(StatsManager.class, "PermanentDeleteTombstoneSize"), permanentDeleteTombstoneSize);<NEW_LINE>}<NEW_LINE>} | .class, "ExpiredDeleteTombstoneCount"), expiredDeleteTombstoneCount); |
1,237,405 | void calc(FastDistanceSparseData left, FastDistanceSparseData right, double[] res) {<NEW_LINE>Arrays.fill(res, 0.0);<NEW_LINE>int[][] leftIndices = left.getIndices();<NEW_LINE>int[][] rightIndices = right.getIndices();<NEW_LINE>double[][] leftValues = left.getValues();<NEW_LINE>double[][] rightValues = right.getValues();<NEW_LINE>Preconditions.checkArgument(leftIndices.length == rightIndices.length, "VectorSize not equal!");<NEW_LINE>for (int i = 0; i < leftIndices.length; i++) {<NEW_LINE>int[] leftIndicesList = leftIndices[i];<NEW_LINE>int[] rightIndicesList = rightIndices[i];<NEW_LINE>double[] leftValuesList = leftValues[i];<NEW_LINE>double[] rightValuesList = rightValues[i];<NEW_LINE>if (null != leftIndicesList) {<NEW_LINE>for (int j = 0; j < leftIndicesList.length; j++) {<NEW_LINE>double leftValue = leftValuesList[j];<NEW_LINE>int startIndex = leftIndicesList[j] * right.vectorNum;<NEW_LINE>if (null != rightIndicesList) {<NEW_LINE>for (int k = 0; k < rightIndicesList.length; k++) {<NEW_LINE>res[startIndex + rightIndicesList[k]] -= 2 * rightValuesList[k] * leftValue;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int leftCnt = 0;<NEW_LINE>int rightCnt = 0;<NEW_LINE>int numRow = right.vectorNum;<NEW_LINE>double[] leftNormL2Square = left.label.getData();<NEW_LINE>double[] rightNormL2Square <MASK><NEW_LINE>for (int i = 0; i < res.length; i++) {<NEW_LINE>if (rightCnt == numRow) {<NEW_LINE>rightCnt = 0;<NEW_LINE>leftCnt++;<NEW_LINE>}<NEW_LINE>res[i] = Math.sqrt(Math.abs(res[i] + rightNormL2Square[rightCnt++] + leftNormL2Square[leftCnt]));<NEW_LINE>}<NEW_LINE>} | = right.label.getData(); |
322,420 | public boolean visit(ClassInstanceCreation node) {<NEW_LINE>int lParen = this.tm.firstIndexAfter(node.getType(), TokenNameLPAREN);<NEW_LINE>int rParen = node.getAnonymousClassDeclaration() == null ? this.tm.lastIndexIn(node, TokenNameRPAREN) : this.tm.firstIndexBefore(node.getAnonymousClassDeclaration(), TokenNameRPAREN);<NEW_LINE>handleParenthesesPositions(lParen, rParen, this.options.parenthesis_positions_in_method_invocation);<NEW_LINE>AnonymousClassDeclaration anonymousClass = node.getAnonymousClassDeclaration();<NEW_LINE>if (anonymousClass != null) {<NEW_LINE>forceContinuousWrapping(anonymousClass, this.tm.firstIndexIn(node, TokenNamenew));<NEW_LINE>}<NEW_LINE>int wrappingOption = node.getExpression() != null ? this.options<MASK><NEW_LINE>handleArguments(node.arguments(), wrappingOption);<NEW_LINE>handleTypeArguments(node.typeArguments());<NEW_LINE>return true;<NEW_LINE>} | .alignment_for_arguments_in_qualified_allocation_expression : this.options.alignment_for_arguments_in_allocation_expression; |
1,257,193 | public static boolean callTaichiContentProvider(@NonNull Context context) {<NEW_LINE>try {<NEW_LINE>ContentResolver contentResolver = context.getContentResolver();<NEW_LINE>Uri uri = Uri.parse("content://me.weishu.exposed.CP/");<NEW_LINE>Bundle result = new Bundle();<NEW_LINE>try {<NEW_LINE>result = contentResolver.call(uri, "active", null, null);<NEW_LINE>} catch (RuntimeException e) {<NEW_LINE>// TaiChi is killed, try invoke<NEW_LINE>try {<NEW_LINE>Intent intent = new Intent("me.weishu.exp.ACTION_ACTIVE");<NEW_LINE>intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);<NEW_LINE>context.startActivity(intent);<NEW_LINE>} catch (ActivityNotFoundException anfe) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (result == null) {<NEW_LINE>result = contentResolver.call(uri, "active", null, null);<NEW_LINE>}<NEW_LINE>if (result == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return <MASK><NEW_LINE>} catch (Exception e) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | result.getBoolean("active", false); |
1,425,737 | public static GetEntityTagRelationResponse unmarshall(GetEntityTagRelationResponse getEntityTagRelationResponse, UnmarshallerContext _ctx) {<NEW_LINE>getEntityTagRelationResponse.setRequestId(_ctx.stringValue("GetEntityTagRelationResponse.RequestId"));<NEW_LINE>getEntityTagRelationResponse.setMessage(_ctx.stringValue("GetEntityTagRelationResponse.Message"));<NEW_LINE>getEntityTagRelationResponse.setCode(_ctx.stringValue("GetEntityTagRelationResponse.Code"));<NEW_LINE>getEntityTagRelationResponse.setSuccess(_ctx.booleanValue("GetEntityTagRelationResponse.Success"));<NEW_LINE>List<DataItem> data = new ArrayList<DataItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("GetEntityTagRelationResponse.Data.Length"); i++) {<NEW_LINE>DataItem dataItem = new DataItem();<NEW_LINE>dataItem.setTagName(_ctx.stringValue("GetEntityTagRelationResponse.Data[" + i + "].TagName"));<NEW_LINE>dataItem.setTagGroupCode(_ctx.stringValue("GetEntityTagRelationResponse.Data[" + i + "].TagGroupCode"));<NEW_LINE>dataItem.setEntityId(_ctx.stringValue("GetEntityTagRelationResponse.Data[" + i + "].EntityId"));<NEW_LINE>dataItem.setTagCode(_ctx.stringValue("GetEntityTagRelationResponse.Data[" + i + "].TagCode"));<NEW_LINE>dataItem.setEntityType(_ctx.stringValue<MASK><NEW_LINE>dataItem.setTagGroupName(_ctx.stringValue("GetEntityTagRelationResponse.Data[" + i + "].TagGroupName"));<NEW_LINE>data.add(dataItem);<NEW_LINE>}<NEW_LINE>getEntityTagRelationResponse.setData(data);<NEW_LINE>return getEntityTagRelationResponse;<NEW_LINE>} | ("GetEntityTagRelationResponse.Data[" + i + "].EntityType")); |
485,592 | public static DescribeAppResponse unmarshall(DescribeAppResponse describeAppResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeAppResponse.setRequestId(_ctx.stringValue("DescribeAppResponse.requestId"));<NEW_LINE>Result result = new Result();<NEW_LINE>result.setId(_ctx.stringValue("DescribeAppResponse.result.id"));<NEW_LINE>result.setDescription(_ctx.stringValue("DescribeAppResponse.result.description"));<NEW_LINE>result.setStatus(_ctx.stringValue("DescribeAppResponse.result.status"));<NEW_LINE>result.setType(_ctx.stringValue("DescribeAppResponse.result.type"));<NEW_LINE>result.setClusterName(_ctx.stringValue("DescribeAppResponse.result.clusterName"));<NEW_LINE>result.setAlgoDeploymentId(_ctx.integerValue("DescribeAppResponse.result.algoDeploymentId"));<NEW_LINE>result.setCreated(_ctx.integerValue("DescribeAppResponse.result.created"));<NEW_LINE>result.setAutoSwitch(_ctx.booleanValue("DescribeAppResponse.result.autoSwitch"));<NEW_LINE>result.setProgressPercent(_ctx.integerValue("DescribeAppResponse.result.progressPercent"));<NEW_LINE>result.setSchema(_ctx.mapValue("DescribeAppResponse.result.schema"));<NEW_LINE>List<String> fetchFields = new ArrayList<String>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeAppResponse.result.fetchFields.Length"); i++) {<NEW_LINE>fetchFields.add(_ctx.stringValue("DescribeAppResponse.result.fetchFields[" + i + "]"));<NEW_LINE>}<NEW_LINE>result.setFetchFields(fetchFields);<NEW_LINE>Quota quota = new Quota();<NEW_LINE>quota.setDocSize(_ctx.integerValue("DescribeAppResponse.result.quota.docSize"));<NEW_LINE>quota.setComputeResource(_ctx.integerValue("DescribeAppResponse.result.quota.computeResource"));<NEW_LINE>quota.setQps(_ctx.integerValue("DescribeAppResponse.result.quota.qps"));<NEW_LINE>quota.setSpec(_ctx.stringValue("DescribeAppResponse.result.quota.spec"));<NEW_LINE>result.setQuota(quota);<NEW_LINE>Domain domain = new Domain();<NEW_LINE>domain.setName(_ctx.stringValue("DescribeAppResponse.result.domain.name"));<NEW_LINE>domain.setCategory(_ctx.stringValue("DescribeAppResponse.result.domain.category"));<NEW_LINE>Functions functions = new Functions();<NEW_LINE>List<String> qp <MASK><NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeAppResponse.result.domain.functions.qp.Length"); i++) {<NEW_LINE>qp.add(_ctx.stringValue("DescribeAppResponse.result.domain.functions.qp[" + i + "]"));<NEW_LINE>}<NEW_LINE>functions.setQp(qp);<NEW_LINE>List<String> algo = new ArrayList<String>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeAppResponse.result.domain.functions.algo.Length"); i++) {<NEW_LINE>algo.add(_ctx.stringValue("DescribeAppResponse.result.domain.functions.algo[" + i + "]"));<NEW_LINE>}<NEW_LINE>functions.setAlgo(algo);<NEW_LINE>List<String> service = new ArrayList<String>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeAppResponse.result.domain.functions.service.Length"); i++) {<NEW_LINE>service.add(_ctx.stringValue("DescribeAppResponse.result.domain.functions.service[" + i + "]"));<NEW_LINE>}<NEW_LINE>functions.setService(service);<NEW_LINE>domain.setFunctions(functions);<NEW_LINE>result.setDomain(domain);<NEW_LINE>describeAppResponse.setResult(result);<NEW_LINE>return describeAppResponse;<NEW_LINE>} | = new ArrayList<String>(); |
31,569 | public ListFindingsFiltersResult unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>ListFindingsFiltersResult listFindingsFiltersResult = new ListFindingsFiltersResult();<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 listFindingsFiltersResult;<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("findingsFilterListItems", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listFindingsFiltersResult.setFindingsFilterListItems(new ListUnmarshaller<FindingsFilterListItem>(FindingsFilterListItemJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>}<NEW_LINE>if (context.testExpression("nextToken", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>listFindingsFiltersResult.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 listFindingsFiltersResult;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
841,852 | private void load() {<NEW_LINE>final ArrayList<Pack> values = new ArrayList<Pack>();<NEW_LINE>TcpProxy tcp = TcpProxy.getTcpProxy(serverId);<NEW_LINE>try {<NEW_LINE>MapPack param = new MapPack();<NEW_LINE><MASK><NEW_LINE>param.put("eDate", eDate);<NEW_LINE>param.put("objType", objType);<NEW_LINE>param.put("counter", counter);<NEW_LINE>tcp.process(RequestCmd.COUNTER_PAST_LONGDATE_ALL, param, new INetReader() {<NEW_LINE><NEW_LINE>public void process(DataInputX in) throws IOException {<NEW_LINE>Pack pack = in.readPack();<NEW_LINE>values.add(pack);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} catch (Throwable t) {<NEW_LINE>ConsoleProxy.errorSafe(t.toString());<NEW_LINE>} finally {<NEW_LINE>TcpProxy.putTcpProxy(tcp);<NEW_LINE>}<NEW_LINE>final Map<Long, Double> valueMap = ScouterUtil.getLoadTotalMap(counter, values, mode, TimeTypeEnum.FIVE_MIN);<NEW_LINE>ExUtil.exec(this.canvas, new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>try {<NEW_LINE>traceDataProvider.clearTrace();<NEW_LINE>Set<Long> timeSet = valueMap.keySet();<NEW_LINE>for (long time : timeSet) {<NEW_LINE>traceDataProvider.addSample(new Sample(CastUtil.cdouble(time), CastUtil.cdouble(valueMap.get(time))));<NEW_LINE>}<NEW_LINE>} catch (Throwable t) {<NEW_LINE>ConsoleProxy.error(t.toString());<NEW_LINE>}<NEW_LINE>if (CounterUtil.isPercentValue(objType, counter)) {<NEW_LINE>xyGraph.primaryYAxis.setRange(0, 100);<NEW_LINE>} else {<NEW_LINE>double max = ChartUtil.getMax(traceDataProvider.iterator());<NEW_LINE>xyGraph.primaryYAxis.setRange(0, max);<NEW_LINE>}<NEW_LINE>redraw();<NEW_LINE>applyBtn.setEnabled(true);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | param.put("sDate", sDate); |
1,018,103 | protected void onNewResultImpl(@Nullable EncodedImage newResult, @Status int status) {<NEW_LINE>if (mIsCancelled) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>boolean isLast = isLast(status);<NEW_LINE>if (newResult == null) {<NEW_LINE>if (isLast) {<NEW_LINE>getConsumer().<MASK><NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ImageFormat imageFormat = newResult.getImageFormat();<NEW_LINE>TriState shouldTransform = shouldTransform(mProducerContext.getImageRequest(), newResult, Preconditions.checkNotNull(mImageTranscoderFactory.createImageTranscoder(imageFormat, mIsResizingEnabled)));<NEW_LINE>// ignore the intermediate result if we don't know what to do with it<NEW_LINE>if (!isLast && shouldTransform == TriState.UNSET) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// just forward the result if we know that it shouldn't be transformed<NEW_LINE>if (shouldTransform != TriState.YES) {<NEW_LINE>forwardNewResult(newResult, status, imageFormat);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// we know that the result should be transformed, hence schedule it<NEW_LINE>if (!mJobScheduler.updateJob(newResult, status)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (isLast || mProducerContext.isIntermediateResultExpected()) {<NEW_LINE>mJobScheduler.scheduleJob();<NEW_LINE>}<NEW_LINE>} | onNewResult(null, Consumer.IS_LAST); |
1,252,123 | /* Sample generated code:<NEW_LINE>*<NEW_LINE>* @com.ibm.j9ddr.GeneratedFieldAccessor(offsetFieldName="_permOffset_", declaredType="J9Permission")<NEW_LINE>* public J9PermissionPointer perm() throws CorruptDataException {<NEW_LINE>* return J9PermissionPointer.cast(nonNullFieldEA(J9FileStat._permOffset_));<NEW_LINE>* }<NEW_LINE>*/<NEW_LINE>private void doStructureMethod(FieldDescriptor field) {<NEW_LINE>String fieldType = removeTypeTags(field.getType());<NEW_LINE>String returnType = "void".equals(fieldType) ? "Void" : fieldType;<NEW_LINE>String qualifiedReturnType = qualifyPointerType(returnType);<NEW_LINE>Type objectType = Type.getObjectType(qualifiedReturnType);<NEW_LINE>String returnDesc = Type.getMethodDescriptor(objectType);<NEW_LINE>String castDesc = Type.getMethodDescriptor(objectType, Type.LONG_TYPE);<NEW_LINE>MethodVisitor method = beginAnnotatedMethod(field, field.getName(), returnDesc);<NEW_LINE>method.visitCode();<NEW_LINE>if (checkPresent(field, method)) {<NEW_LINE>method.visitVarInsn(ALOAD, 0);<NEW_LINE>loadLong(method, field.getOffset());<NEW_LINE>method.visitMethodInsn(INVOKEVIRTUAL, <MASK><NEW_LINE>method.visitMethodInsn(INVOKESTATIC, qualifiedReturnType, "cast", castDesc, false);<NEW_LINE>method.visitInsn(ARETURN);<NEW_LINE>}<NEW_LINE>method.visitMaxs(3, 1);<NEW_LINE>method.visitEnd();<NEW_LINE>doEAMethod("Pointer", field);<NEW_LINE>} | className, "nonNullFieldEA", longFromLong, false); |
1,225,534 | public void sanityCheck() {<NEW_LINE>var trackSet = new TLongHashSet();<NEW_LINE>for (int frameIdx = 0; frameIdx < frames.size; frameIdx++) {<NEW_LINE>BFrame bf = frames.get(frameIdx);<NEW_LINE>for (int trackIdx = 0; trackIdx < bf.tracks.size; trackIdx++) {<NEW_LINE>BTrack bt = <MASK><NEW_LINE>trackSet.add(bt.id);<NEW_LINE>if (!bt.isObservedBy(bf)) {<NEW_LINE>throw new RuntimeException("Frame's track list is out of date. frame.id=" + bf.id + " track.id=" + bt.id + " obs.size " + bt.observations.size);<NEW_LINE>} else {<NEW_LINE>if (tracks.isUnused((T) bt)) {<NEW_LINE>throw new RuntimeException("BUG! Track is in unused list. frame.id=" + bf.id + " track.id=" + bt.id);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// TODO check to see if all observations are in a frame<NEW_LINE>// if( trackSet.size() != tracks.size )<NEW_LINE>// throw new IllegalArgumentException("Number of unique tracks in all frames: "+<NEW_LINE>// trackSet.size()+" vs track.size "+tracks.size);<NEW_LINE>} | bf.tracks.get(trackIdx); |
519,573 | public void marshall(CreateSimulationJobRequest createSimulationJobRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (createSimulationJobRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(createSimulationJobRequest.getClientRequestToken(), CLIENTREQUESTTOKEN_BINDING);<NEW_LINE>protocolMarshaller.marshall(createSimulationJobRequest.getOutputLocation(), OUTPUTLOCATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(createSimulationJobRequest.getLoggingConfig(), LOGGINGCONFIG_BINDING);<NEW_LINE>protocolMarshaller.marshall(createSimulationJobRequest.getMaxJobDurationInSeconds(), MAXJOBDURATIONINSECONDS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createSimulationJobRequest.getIamRole(), IAMROLE_BINDING);<NEW_LINE>protocolMarshaller.marshall(createSimulationJobRequest.getFailureBehavior(), FAILUREBEHAVIOR_BINDING);<NEW_LINE>protocolMarshaller.marshall(createSimulationJobRequest.getRobotApplications(), ROBOTAPPLICATIONS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createSimulationJobRequest.getSimulationApplications(), SIMULATIONAPPLICATIONS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createSimulationJobRequest.getDataSources(), DATASOURCES_BINDING);<NEW_LINE>protocolMarshaller.marshall(createSimulationJobRequest.getTags(), TAGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(createSimulationJobRequest.getCompute(), COMPUTE_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | createSimulationJobRequest.getVpcConfig(), VPCCONFIG_BINDING); |
1,155,458 | public <T> GeoResults<T> geoNear(NearQuery near, Class<?> domainType, String collectionName, Class<T> returnType) {<NEW_LINE>if (near == null) {<NEW_LINE>throw new InvalidDataAccessApiUsageException("NearQuery must not be null!");<NEW_LINE>}<NEW_LINE>if (domainType == null) {<NEW_LINE>throw new InvalidDataAccessApiUsageException("Entity class must not be null!");<NEW_LINE>}<NEW_LINE>Assert.notNull(collectionName, "CollectionName must not be null!");<NEW_LINE>Assert.notNull(returnType, "ReturnType must not be null!");<NEW_LINE>String collection = StringUtils.hasText(collectionName) ? collectionName : getCollectionName(domainType);<NEW_LINE>String <MASK><NEW_LINE>Aggregation $geoNear = TypedAggregation.newAggregation(domainType, Aggregation.geoNear(near, distanceField)).withOptions(AggregationOptions.builder().collation(near.getCollation()).build());<NEW_LINE>AggregationResults<Document> results = aggregate($geoNear, collection, Document.class);<NEW_LINE>EntityProjection<T, ?> projection = operations.introspectProjection(returnType, domainType);<NEW_LINE>DocumentCallback<GeoResult<T>> callback = new GeoNearResultDocumentCallback<>(distanceField, new ProjectingReadCallback<>(mongoConverter, projection, collection), near.getMetric());<NEW_LINE>List<GeoResult<T>> result = new ArrayList<>();<NEW_LINE>BigDecimal aggregate = BigDecimal.ZERO;<NEW_LINE>for (Document element : results) {<NEW_LINE>GeoResult<T> geoResult = callback.doWith(element);<NEW_LINE>aggregate = aggregate.add(BigDecimal.valueOf(geoResult.getDistance().getValue()));<NEW_LINE>result.add(geoResult);<NEW_LINE>}<NEW_LINE>Distance avgDistance = new Distance(result.size() == 0 ? 0 : aggregate.divide(new BigDecimal(result.size()), RoundingMode.HALF_UP).doubleValue(), near.getMetric());<NEW_LINE>return new GeoResults<>(result, avgDistance);<NEW_LINE>} | distanceField = operations.nearQueryDistanceFieldName(domainType); |
1,418,785 | public void applyFromCellItem(WidgetItem item, WidgetPreviewLoader loader) {<NEW_LINE>applyPreviewOnAppWidgetHostView(item);<NEW_LINE>Context context = getContext();<NEW_LINE>mItem = item;<NEW_LINE>mWidgetName.setText(mItem.label);<NEW_LINE>mWidgetName.setContentDescription(context.getString(R.string.widget_preview_context_description, mItem.label));<NEW_LINE>mWidgetDims.setText(context.getString(R.string.widget_dims_format, mItem<MASK><NEW_LINE>mWidgetDims.setContentDescription(context.getString(R.string.widget_accessible_dims_format, mItem.spanX, mItem.spanY));<NEW_LINE>if (ATLEAST_S && mItem.widgetInfo != null) {<NEW_LINE>CharSequence description = mItem.widgetInfo.loadDescription(context);<NEW_LINE>if (description != null && description.length() > 0) {<NEW_LINE>mWidgetDescription.setText(description);<NEW_LINE>mWidgetDescription.setVisibility(VISIBLE);<NEW_LINE>} else {<NEW_LINE>mWidgetDescription.setVisibility(GONE);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>mWidgetPreviewLoader = loader;<NEW_LINE>if (item.activityInfo != null) {<NEW_LINE>setTag(new PendingAddShortcutInfo(item.activityInfo));<NEW_LINE>} else {<NEW_LINE>setTag(new PendingAddWidgetInfo(item.widgetInfo, mSourceContainer));<NEW_LINE>}<NEW_LINE>} | .spanX, mItem.spanY)); |
1,677,780 | protected List<? extends JComponent> createPreviewElements() {<NEW_LINE>final JButton basic = new JButton();<NEW_LINE>basic.putClientProperty(StyleId.STYLE_PROPERTY, getStyleId());<NEW_LINE>UILanguageManager.registerComponent(basic, getExampleLanguageKey("styled.text.basic"));<NEW_LINE>final JButton group1 = new JButton();<NEW_LINE>group1.putClientProperty(<MASK><NEW_LINE>UILanguageManager.registerComponent(group1, getExampleLanguageKey("styled.text.group1"));<NEW_LINE>final JButton group2 = new JButton();<NEW_LINE>group2.putClientProperty(StyleId.STYLE_PROPERTY, getStyleId());<NEW_LINE>UILanguageManager.registerComponent(group2, getExampleLanguageKey("styled.text.group2"));<NEW_LINE>final JButton group3 = new JButton();<NEW_LINE>group3.putClientProperty(StyleId.STYLE_PROPERTY, getStyleId());<NEW_LINE>UILanguageManager.registerComponent(group3, getExampleLanguageKey("styled.text.group3"));<NEW_LINE>final JButton icon = new JButton(WebLookAndFeel.getIcon(16));<NEW_LINE>icon.putClientProperty(StyleId.STYLE_PROPERTY, getStyleId());<NEW_LINE>UILanguageManager.registerComponent(icon, getExampleLanguageKey("styled.text.icon"));<NEW_LINE>return CollectionUtils.asList(basic, new GroupPane(group1, group2, group3), icon);<NEW_LINE>} | StyleId.STYLE_PROPERTY, getStyleId()); |
897,738 | protected JPanel positionTab() {<NEW_LINE>JPanel panel = new JPanel(new MigLayout("gap rel unrel", "[][65lp::][30lp::]", ""));<NEW_LINE>// // Radial position<NEW_LINE>// // Radial distance:<NEW_LINE>panel.add(new JLabel(trans.get("StreamerCfg.lbl.Radialdistance")));<NEW_LINE>DoubleModel m = new DoubleModel(component, "RadialPosition", UnitGroup.UNITS_LENGTH, 0);<NEW_LINE>JSpinner spin = new JSpinner(m.getSpinnerModel());<NEW_LINE>spin.setEditor(new SpinnerEditor(spin));<NEW_LINE>panel.add(spin, "growx");<NEW_LINE>panel.add(new UnitSelector(m), "growx");<NEW_LINE>panel.add(new BasicSlider(m.getSliderModel(0, 0.1, 1.0)), "w 100lp, wrap");<NEW_LINE>// // Radial direction<NEW_LINE>// // Radial direction:<NEW_LINE>panel.add(new JLabel(<MASK><NEW_LINE>m = new DoubleModel(component, "RadialDirection", UnitGroup.UNITS_ANGLE);<NEW_LINE>spin = new JSpinner(m.getSpinnerModel());<NEW_LINE>spin.setEditor(new SpinnerEditor(spin));<NEW_LINE>panel.add(spin, "growx");<NEW_LINE>panel.add(new UnitSelector(m), "growx");<NEW_LINE>panel.add(new BasicSlider(m.getSliderModel(-Math.PI, Math.PI)), "w 100lp, wrap");<NEW_LINE>// // Reset button<NEW_LINE>JButton button = new SelectColorButton(trans.get("StreamerCfg.but.Reset"));<NEW_LINE>button.addActionListener(new ActionListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerformed(ActionEvent e) {<NEW_LINE>((Streamer) component).setRadialDirection(0.0);<NEW_LINE>((Streamer) component).setRadialPosition(0.0);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>panel.add(button, "spanx, right");<NEW_LINE>return panel;<NEW_LINE>} | trans.get("StreamerCfg.lbl.Radialdirection"))); |
412,135 | public void configureImportedPaymentTable(IMiniTable miniTable) {<NEW_LINE>miniTable.setKeyColumnIndex(0);<NEW_LINE>// 0-Selection<NEW_LINE>miniTable.setColumnClass(0, IDColumn.class, true, getImportedPaymentColumnNames().get(0));<NEW_LINE>// 1-TrxDate<NEW_LINE>miniTable.setColumnClass(1, Timestamp.class, true);<NEW_LINE>// 2-IsReceipt<NEW_LINE>miniTable.setColumnClass(2, Boolean.class, true);<NEW_LINE>// 3-ReferenceNo<NEW_LINE>miniTable.setColumnClass(3, String.class, true);<NEW_LINE>// 4-C_BPartner_ID<NEW_LINE>miniTable.setColumnClass(4, String.class, true);<NEW_LINE>// 4-C_Currency_ID<NEW_LINE>miniTable.setColumnClass(5, String.class, true);<NEW_LINE>// 5-Amount<NEW_LINE>miniTable.setColumnClass(<MASK><NEW_LINE>// 6-Description<NEW_LINE>miniTable.setColumnClass(7, String.class, true);<NEW_LINE>// Table UI<NEW_LINE>miniTable.autoSize();<NEW_LINE>} | 6, BigDecimal.class, true); |
1,130,060 | public <T extends SkylarkContext<T>> void run(ActionContext<T> context) throws ValidationException, RepoException {<NEW_LINE>SkylarkContext<T> actionContext = context.withParams(params);<NEW_LINE>try (Mutability mu = Mutability.create("dynamic_action")) {<NEW_LINE>StarlarkThread thread = new StarlarkThread(mu, StarlarkSemantics.DEFAULT);<NEW_LINE>thread.setPrintHandler(printHandler);<NEW_LINE>Object result = Starlark.call(thread, function, ImmutableList.of(actionContext), /*kwargs=*/<NEW_LINE>ImmutableMap.of());<NEW_LINE>context.onFinish(result, actionContext);<NEW_LINE>} catch (EvalException e) {<NEW_LINE>Throwable cause = e.getCause();<NEW_LINE>String error = String.format("Error while executing the skylark transformation %s: %s.", function.getName(), e.getMessageWithStack());<NEW_LINE>if (cause instanceof RepoException) {<NEW_LINE>throw new RepoException(error, cause);<NEW_LINE>}<NEW_LINE>throw new ValidationException(error, cause);<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>Thread<MASK><NEW_LINE>throw new RuntimeException("This should not happen.", e);<NEW_LINE>}<NEW_LINE>} | .currentThread().interrupt(); |
1,188,290 | public static void registerThreadPoolMetric(String poolName, ThreadPoolExecutor threadPool) {<NEW_LINE>for (String poolMetricType : poolMerticTypes) {<NEW_LINE>GaugeMetric<Integer> gauge = new GaugeMetric<Integer>("thread_pool", MetricUnit.NOUNIT, "thread_pool statistics") {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Integer getValue() {<NEW_LINE>String metricType = this.getLabels().get(1).getValue();<NEW_LINE>switch(metricType) {<NEW_LINE>case "pool_size":<NEW_LINE>return threadPool.getPoolSize();<NEW_LINE>case "active_thread_num":<NEW_LINE>return threadPool.getActiveCount();<NEW_LINE>case "task_in_queue":<NEW_LINE>return threadPool<MASK><NEW_LINE>default:<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>};<NEW_LINE>gauge.addLabel(new MetricLabel("name", poolName)).addLabel(new MetricLabel("type", poolMetricType));<NEW_LINE>MetricRepo.addMetric(gauge);<NEW_LINE>}<NEW_LINE>} | .getQueue().size(); |
167,724 | public List<String> validateValue(final PwmSetting pwmSetting) {<NEW_LINE>final int maxBodyChars = 500_000;<NEW_LINE>if (pwmSetting.isRequired()) {<NEW_LINE>if (values == null || values.isEmpty() || values.values().iterator().next() == null) {<NEW_LINE>return Collections.singletonList("required value missing");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (final Map.Entry<String, EmailItemBean> entry : values.entrySet()) {<NEW_LINE>final String loopLocale = entry.getKey();<NEW_LINE>final <MASK><NEW_LINE>final Supplier<String> localeMsg = () -> loopLocale.length() > 0 ? " for locale " + loopLocale : "";<NEW_LINE>if (emailItemBean.getSubject() == null || emailItemBean.getSubject().length() < 1) {<NEW_LINE>return Collections.singletonList("subject field is required " + localeMsg.get());<NEW_LINE>}<NEW_LINE>if (emailItemBean.getFrom() == null || emailItemBean.getFrom().length() < 1) {<NEW_LINE>return Collections.singletonList("from field is required" + localeMsg.get());<NEW_LINE>}<NEW_LINE>if (StringUtil.isEmpty(emailItemBean.getBodyPlain())) {<NEW_LINE>return Collections.singletonList("plain body field is required" + localeMsg.get());<NEW_LINE>} else if (emailItemBean.getBodyPlain().length() > maxBodyChars) {<NEW_LINE>return Collections.singletonList("plain body field is too large" + localeMsg.get() + ", chars=" + emailItemBean.getBodyPlain().length() + ", max=" + maxBodyChars);<NEW_LINE>}<NEW_LINE>if (emailItemBean.getBodyHtml() != null && emailItemBean.getBodyHtml().length() > maxBodyChars) {<NEW_LINE>return Collections.singletonList("html body field is too large" + localeMsg.get() + ", chars=" + emailItemBean.getBodyHtml().length() + ", max=" + maxBodyChars);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return Collections.emptyList();<NEW_LINE>} | EmailItemBean emailItemBean = entry.getValue(); |
439,451 | public void visualizePerpendicular(Graphics2D g2, double scale, ChessboardCornerClusterFinder<GrayF32> clusterFinder) {<NEW_LINE>g2.setFont(regular);<NEW_LINE>BasicStroke thin = new BasicStroke(2);<NEW_LINE>BasicStroke thick = new BasicStroke(4);<NEW_LINE>// g2.setStroke(new BasicStroke(1));<NEW_LINE>// List<Vertex> vertexes = detector.getClusterFinder().getVertexes().toList();<NEW_LINE>List<ChessboardCornerClusterFinder.LineInfo> lines = clusterFinder.getLines().toList();<NEW_LINE>for (int i = 0; i < lines.size(); i++) {<NEW_LINE>ChessboardCornerClusterFinder.LineInfo lineInfo = lines.get(i);<NEW_LINE>if (lineInfo.isDisconnected() || lineInfo.parallel)<NEW_LINE>continue;<NEW_LINE>ChessboardCornerClusterFinder.Vertex va = Objects.requireNonNull(lineInfo.endA).dst;<NEW_LINE>ChessboardCornerClusterFinder.Vertex vb = Objects.requireNonNull(lineInfo.endB).dst;<NEW_LINE>ChessboardCorner ca = foundCorners.get(va.index);<NEW_LINE>ChessboardCorner cb = foundCorners.get(vb.index);<NEW_LINE>double intensity = lineInfo.intensity == -Double.MAX_VALUE ? Double.NaN : lineInfo.intensity;<NEW_LINE>line.setLine(ca.x * scale, ca.y * scale, cb.x * <MASK><NEW_LINE>g2.setStroke(thick);<NEW_LINE>g2.setColor(Color.BLACK);<NEW_LINE>g2.draw(line);<NEW_LINE>g2.setStroke(thin);<NEW_LINE>g2.setColor(Color.ORANGE);<NEW_LINE>g2.draw(line);<NEW_LINE>float x = (float) ((ca.x + cb.x) / 2.0);<NEW_LINE>float y = (float) ((ca.y + cb.y) / 2.0);<NEW_LINE>g2.setColor(Color.RED);<NEW_LINE>g2.drawString(String.format("%.1f", intensity), x * (float) scale, y * (float) scale);<NEW_LINE>}<NEW_LINE>} | scale, cb.y * scale); |
916,333 | private static PsiReference[] mergeReferences(PsiElement element, List<PsiReference> references) {<NEW_LINE>if (references.size() <= 1) {<NEW_LINE>return references.toArray(new PsiReference[references.size()]);<NEW_LINE>}<NEW_LINE>Collections.sort(references, START_OFFSET_COMPARATOR);<NEW_LINE>final List<PsiReference> intersecting = new ArrayList<PsiReference>();<NEW_LINE>final List<PsiReference> notIntersecting = new ArrayList<PsiReference>();<NEW_LINE>TextRange intersectingRange = references.get(0).getRangeInElement();<NEW_LINE>boolean intersected = false;<NEW_LINE>for (int i = 1; i < references.size(); i++) {<NEW_LINE>final PsiReference reference = references.get(i);<NEW_LINE>final TextRange range = reference.getRangeInElement();<NEW_LINE>final int offset = range.getStartOffset();<NEW_LINE>if (intersectingRange.getStartOffset() <= offset && intersectingRange.getEndOffset() >= offset) {<NEW_LINE>intersected = true;<NEW_LINE>intersecting.add(references.get(i - 1));<NEW_LINE>if (i == references.size() - 1) {<NEW_LINE>intersecting.add(reference);<NEW_LINE>}<NEW_LINE>intersectingRange = intersectingRange.union(range);<NEW_LINE>} else {<NEW_LINE>if (intersected) {<NEW_LINE>intersecting.add(references<MASK><NEW_LINE>intersected = false;<NEW_LINE>} else {<NEW_LINE>notIntersecting.add(references.get(i - 1));<NEW_LINE>}<NEW_LINE>intersectingRange = range;<NEW_LINE>if (i == references.size() - 1) {<NEW_LINE>notIntersecting.add(reference);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List<PsiReference> result = doMerge(element, intersecting);<NEW_LINE>result.addAll(notIntersecting);<NEW_LINE>return result.toArray(new PsiReference[result.size()]);<NEW_LINE>} | .get(i - 1)); |
237,307 | private int createComplementDataCommand(Date scheduleDate) {<NEW_LINE>Command command = new Command();<NEW_LINE>command.setScheduleTime(scheduleDate);<NEW_LINE>command.setCommandType(CommandType.COMPLEMENT_DATA);<NEW_LINE>command.setProcessDefinitionCode(processInstance.getProcessDefinitionCode());<NEW_LINE>Map<String, String> cmdParam = JSONUtils.toMap(processInstance.getCommandParam());<NEW_LINE>if (cmdParam.containsKey(Constants.CMD_PARAM_RECOVERY_START_NODE_STRING)) {<NEW_LINE>cmdParam.remove(Constants.CMD_PARAM_RECOVERY_START_NODE_STRING);<NEW_LINE>}<NEW_LINE>cmdParam.replace(CMDPARAM_COMPLEMENT_DATA_START_DATE, DateUtils.format(scheduleDate, "yyyy-MM-dd HH:mm:ss", null));<NEW_LINE>command.setCommandParam(JSONUtils.toJsonString(cmdParam));<NEW_LINE>command.setTaskDependType(processInstance.getTaskDependType());<NEW_LINE>command.setFailureStrategy(processInstance.getFailureStrategy());<NEW_LINE>command.setWarningType(processInstance.getWarningType());<NEW_LINE>command.setWarningGroupId(processInstance.getWarningGroupId());<NEW_LINE>command.setStartTime(new Date());<NEW_LINE>command.setExecutorId(processInstance.getExecutorId());<NEW_LINE>command.setUpdateTime(new Date());<NEW_LINE>command.setProcessInstancePriority(processInstance.getProcessInstancePriority());<NEW_LINE>command.setWorkerGroup(processInstance.getWorkerGroup());<NEW_LINE>command.<MASK><NEW_LINE>command.setDryRun(processInstance.getDryRun());<NEW_LINE>command.setProcessInstanceId(0);<NEW_LINE>command.setProcessDefinitionVersion(processInstance.getProcessDefinitionVersion());<NEW_LINE>return processService.createCommand(command);<NEW_LINE>} | setEnvironmentCode(processInstance.getEnvironmentCode()); |
803,660 | public void prepare() throws NoSuchMethodException {<NEW_LINE>final Validator validator = Validators.newValidator();<NEW_LINE>final ExecutableValidator execValidator = validator.forExecutables();<NEW_LINE>final Set<ConstraintViolation<ConstraintViolationBenchmark.Resource>> paramViolations = // the parameter value<NEW_LINE>execValidator.// the parameter value<NEW_LINE>validateParameters(// the parameter value<NEW_LINE>new Resource(), // the parameter value<NEW_LINE>ConstraintViolationBenchmark.Resource.class.getMethod("paramFunc", String.class), new Object[] { "" });<NEW_LINE>paramViolation = paramViolations<MASK><NEW_LINE>final Set<ConstraintViolation<ConstraintViolationBenchmark.Resource>> objViolations = // the parameter value<NEW_LINE>execValidator.// the parameter value<NEW_LINE>validateParameters(// the parameter value<NEW_LINE>new Resource(), // the parameter value<NEW_LINE>ConstraintViolationBenchmark.Resource.class.getMethod("objectFunc", Foo.class), new Object[] { new Foo() });<NEW_LINE>objViolation = objViolations.iterator().next();<NEW_LINE>} | .iterator().next(); |
1,129,125 | public void eval(String body, String timestampSecond, String esInstanceId, String ip, String bodySize, String level, String node, String remote, String uri) {<NEW_LINE>try {<NEW_LINE>if (isBlackInstance(esInstanceId)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>reportMetric(body.getBytes().length + uri.getBytes().length, timestampSecond);<NEW_LINE>String dataJson = accessExtractor.extract(body, timestampSecond, esInstanceId, ip, bodySize, level, node, remote, uri);<NEW_LINE>if (StringUtils.isNotEmpty(dataJson)) {<NEW_LINE>collect<MASK><NEW_LINE>}<NEW_LINE>} catch (Throwable t) {<NEW_LINE>log.error(String.format("ExtractMetric log error search access of body %s instanceId %s of ip %s of time %s, error %s", body, esInstanceId, ip, timestampSecond, t.getMessage()), t);<NEW_LINE>}<NEW_LINE>} | (Tuple1.of(dataJson)); |
1,790,786 | protected static Bitmap createScaledBitmap(Bitmap src, int dstWidth, int dstHeight, boolean filter) {<NEW_LINE>if (dstWidth == src.getWidth() && dstHeight == src.getHeight() && !filter) {<NEW_LINE>// Return the original.<NEW_LINE>return src;<NEW_LINE>}<NEW_LINE>if (dstWidth <= 0 || dstHeight <= 0) {<NEW_LINE>throw new IllegalArgumentException("width and height must be > 0");<NEW_LINE>}<NEW_LINE>Bitmap scaledBitmap = ReflectionHelpers.callConstructor(Bitmap.class);<NEW_LINE>ShadowBitmap shadowBitmap = Shadow.extract(scaledBitmap);<NEW_LINE>ShadowBitmap shadowSrcBitmap = Shadow.extract(src);<NEW_LINE>shadowBitmap.appendDescription(shadowSrcBitmap.getDescription());<NEW_LINE>shadowBitmap.appendDescription(<MASK><NEW_LINE>if (filter) {<NEW_LINE>shadowBitmap.appendDescription(" with filter " + filter);<NEW_LINE>}<NEW_LINE>shadowBitmap.createdFromBitmap = src;<NEW_LINE>shadowBitmap.scaledFromBitmap = src;<NEW_LINE>shadowBitmap.createdFromFilter = filter;<NEW_LINE>shadowBitmap.width = dstWidth;<NEW_LINE>shadowBitmap.height = dstHeight;<NEW_LINE>shadowBitmap.config = src.getConfig();<NEW_LINE>shadowBitmap.mutable = true;<NEW_LINE>if (shadowBitmap.config == null) {<NEW_LINE>shadowBitmap.config = Config.ARGB_8888;<NEW_LINE>}<NEW_LINE>if (!ImageUtil.scaledBitmap(src, scaledBitmap, filter)) {<NEW_LINE>shadowBitmap.bufferedImage = new BufferedImage(dstWidth, dstHeight, BufferedImage.TYPE_INT_ARGB);<NEW_LINE>shadowBitmap.setPixelsInternal(new int[shadowBitmap.getHeight() * shadowBitmap.getWidth()], 0, 0, 0, 0, shadowBitmap.getWidth(), shadowBitmap.getHeight());<NEW_LINE>}<NEW_LINE>if (RuntimeEnvironment.getApiLevel() >= O) {<NEW_LINE>shadowBitmap.colorSpace = shadowSrcBitmap.colorSpace;<NEW_LINE>}<NEW_LINE>return scaledBitmap;<NEW_LINE>} | " scaled to " + dstWidth + " x " + dstHeight); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.