Creates a chart panel, or null if chart display is not applicable.

@param result
@return
763575
private ChartPanel createChartPanel(final ValueCountingAnalyzerResult result) {
        if (_valueCounts.size() > ChartUtils.CATEGORY_COUNT_DISPLAY_THRESHOLD) {
            logger.info("Display threshold of {} in chart surpassed (got {}). Skipping chart.",
                    ChartUtils.CATEGORY_COUNT_DISPLAY_THRESHOLD, _valueCounts.size());
            return null;
        }

        final Integer distinctCount = result.getDistinctCount();
        final Integer unexpectedValueCount = result.getUnexpectedValueCount();
        final int totalCount = result.getTotalCount();

        // chart for display of the dataset
        final String title = "Value distribution of " + _groupOrColumnName;
        final JFreeChart chart = ChartFactory
                .createBarChart(title, "Value", "Count", _dataset, PlotOrientation.HORIZONTAL, true, true, false);

        final List<Title> titles = new ArrayList<>();
        titles.add(new ShortTextTitle("Total count: " + totalCount));
        if (distinctCount != null) {
            titles.add(new ShortTextTitle("Distinct count: " + distinctCount));
        }
        if (unexpectedValueCount != null) {
            titles.add(new ShortTextTitle("Unexpected value count: " + unexpectedValueCount));
        }
        chart.setSubtitles(titles);

        ChartUtils.applyStyles(chart);

        // code-block for tweaking style and coloring of chart
        {
            final CategoryPlot plot = (CategoryPlot) chart.getPlot();
            plot.getDomainAxis().setVisible(false);

            int colorIndex = 0;
            for (int i = 0; i < getDataSetItemCount(); i++) {
                final String key = getDataSetKey(i);
                final Color color;
                final String upperCaseKey = key.toUpperCase();
                if (_valueColorMap.containsKey(upperCaseKey)) {
                    color = _valueColorMap.get(upperCaseKey);
                } else {
                    if (i == getDataSetItemCount() - 1) {
                        // the last color should not be the same as the first
                        if (colorIndex == 0) {
                            colorIndex++;
                        }
                    }

                    Color colorCandidate = SLICE_COLORS[colorIndex];
                    final int darkAmount = i / SLICE_COLORS.length;
                    for (int j = 0; j < darkAmount; j++) {
                        colorCandidate = WidgetUtils.slightlyDarker(colorCandidate);
                    }
                    color = colorCandidate;

                    colorIndex++;
                    if (colorIndex >= SLICE_COLORS.length) {
                        colorIndex = 0;
                    }
                }

                plot.getRenderer().setSeriesPaint(i, color);
            }
        }

        return ChartUtils.createPanel(chart, false);
    }
487436
private static boolean[][] getChart(int n, VarConfig vc) {
        boolean[][] chart = new boolean[n][n+1];
        int count = 0;
        for (Var v : vc.getVars()) {
            SpanVar span = (SpanVar) v;
            chart[span.getStart()][span.getEnd()] = (vc.getState(span) == SpanVar.TRUE);
            count++;
        }
        if (count != (n*(n+1)/2)) {
            // We didn't see a span variable for every chart cell.
            return null;
        }
        return chart;
    }
623760
public ExecutionResult withResult(Object result) {
    return new ExecutionResult(result, null, nonResult, waitNanos, true, true, successAll);
  }
1327869
public static <I> Result<I> rangeResult(List<I> result, long offset, long fullRequestSize) {
        return new Result<>(result, offset, fullRequestSize);
    }
181375
protected void generateTapPerClass(Result result) {

        Map<String, List<JUnitTestData>> testsByClass = new HashMap<>();

        for (JUnitTestData testMethod : testMethodsList) {
            String className = TapJUnitUtil.extractClassName(testMethod
                    .getDescription());
            testsByClass.computeIfAbsent(className, k -> new ArrayList<>())
                    .add(testMethod);
        }

        testsByClass.forEach((className, testMethods) -> {
            final TestSet testSet = new TestSet();
            testSet.setPlan(new Plan(testMethods.size()));

            testMethods.forEach(testMethod -> {
                TestResult tapTestResult = TapJUnitUtil.generateTAPTestResult(
                        testMethod, 1, isYaml());
                testSet.addTestResult(tapTestResult);
            });

            File output = new File(System.getProperty("tap.junit.results",
                    "target/"), className + ".tap");
            tapProducer.dump(testSet, output);
        });
    }
1067934
protected String getPdate(Map result) {

        HashMap management = getObjectOr(result, "management", new HashMap());
        ArrayList<HashMap> events = getObjectOr(management, "events", new ArrayList<HashMap>());
        for (HashMap event : events) {
            if (getValueOr(event, "event", "").equals("planting")) {
                return getValueOr(event, "date", "");
            }
        }

        return "";
    }
1305881
public static <V> DocumentTreeResult<V> ok(V result) {
    return new DocumentTreeResult<V>(Status.OK, result);
  }
34585
function Panel(options) {
  var panelLayout = options.layoutConfig;
  var viewLayouts = createLayout(panelLayout.view.views);
  this.getPosition = panelLayout.getPosition;
  this.views = _.map(viewLayouts, function (viewLayout) {
    viewLayout.getPosition = wrapGetPosition(viewLayout.getPosition, panelLayout.getPosition);
    return options.creator(viewLayout);
  });
}
891092
public static ResultDescriptor ofResult(final Class<? extends AnalyzerResult> resultClass) {
        ResultDescriptor resultDescriptor = _resultDescriptors.get(resultClass);
        if (resultDescriptor == null) {
            resultDescriptor = new ResultDescriptorImpl(resultClass);
            _resultDescriptors.put(resultClass, resultDescriptor);
        }
        return resultDescriptor;
    }
570292
public AnalysisResult createSafeAnalysisResult() {
        final Set<ComponentJob> unsafeKeys = getUnsafeResultElements().keySet();
        if (unsafeKeys.isEmpty()) {
            return _analysisResult;
        }

        final Map<ComponentJob, AnalyzerResult> resultMap = new LinkedHashMap<>(_analysisResult.getResultMap());
        for (final ComponentJob unsafeKey : unsafeKeys) {
            resultMap.remove(unsafeKey);
        }

        if (resultMap.isEmpty()) {
            return null;
        }

        return new SimpleAnalysisResult(resultMap, _analysisResult.getCreationDate());
    }
638096
public static<R> Result<R> create(R value, int status, String details, String ... vars) {
    	return new Result<R>(value,status,details,vars);
    }
779057
private static Row row(List<StatementResult> results) {
		Row row = results.get( 0 ).getData().get( 0 );
		return row;
	}
397470
public static <T> CompletableFuture<T> completedFuture(T result) {
    CompletableFuture<T> future = new AtomixFuture<>();
    future.complete(result);
    return future;
  }
1369827
@Override
  public ResultStream<T> createMapSelf(ResultStream<? super T> result)
  {
    return new ResultStreamServicePrefetch<>(result, _prefetch);
  }
870026
public void setResult(T result) {
        lock.lock();
        try {
            if(Objects.equals(expected_result, result))
                super.setResult(result);
        }
        finally {
            lock.unlock();
        }
    }
1253923
protected boolean setResult(Object result) {
        for (; ; ) {
            Object currentState = this.state;

            if (isDoneState(currentState)) {
                return false;
            }

            if (STATE.compareAndSet(this, currentState, result)) {
                done();
                notifyThreadsWaitingOnGet();
                runAsynchronous((ExecutionCallbackNode) currentState, result);
                break;
            }
        }
        return true;
    }
777505
public Drawer append(@NonNull Drawer result) {
        if (mUsed) {
            throw new RuntimeException("you must not reuse a DrawerBuilder builder");
        }
        if (mDrawerGravity == null) {
            throw new RuntimeException("please set the gravity for the drawer");
        }

        //set that this builder was used. now you have to create a new one
        mUsed = true;
        mAppended = true;

        //get the drawer layout from the previous drawer
        mDrawerLayout = result.getDrawerLayout();

        // get the slider view
        mSliderLayout = (ScrimInsetsRelativeLayout) mActivity.getLayoutInflater().inflate(R.layout.material_drawer_slider, mDrawerLayout, false);
        mSliderLayout.setBackgroundColor(UIUtils.getThemeColorFromAttrOrRes(mActivity, R.attr.material_drawer_background, R.color.material_drawer_background));
        // get the layout params
        DrawerLayout.LayoutParams params = (DrawerLayout.LayoutParams) mSliderLayout.getLayoutParams();
        // set the gravity of this drawerGravity
        params.gravity = mDrawerGravity;
        // if this is a drawer from the right, change the margins :D
        params = DrawerUtils.processDrawerLayoutParams(this, params);
        // set the new params
        mSliderLayout.setLayoutParams(params);
        //define id for the sliderLayout
        mSliderLayout.setId(R.id.material_drawer_slider_layout);
        // add the slider to the drawer
        mDrawerLayout.addView(mSliderLayout, 1);

        //create the content
        createContent();

        //create the result object
        Drawer appendedResult = new Drawer(this);

        //toggle selection list if we were previously on the account list
        if (mSavedInstance != null && mSavedInstance.getBoolean(Drawer.BUNDLE_DRAWER_CONTENT_SWITCHED_APPENDED, false)) {
            mAccountHeader.toggleSelectionList(mActivity);
        }

        //forget the reference to the activity
        mActivity = null;

        return appendedResult;
    }