Class DecisionFigureText

java.lang.Object
network.ike.docs.koncept.DecisionFigureText

public final class DecisionFigureText extends Object
What a figure builder knows about text without a font engine: an estimate of a run's width from the average widths of a Helvetica-like sans face, in em per character, so the geometry a layout computes from label widths is the same on every machine and in every medium, and the figure's palette and number formats, which the live JavaFX surface shares.

Kept word for word in step with its twin in komet-claude-plugin, package network.ike.komet.claude.decision.render.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    What a swept quantity is: a share of those at a node, money, or anything else with a unit of its own.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The colour of an axis and its labels.
    static final String
    The colour of a caption.
    static final String
     
    static final String
    The colour of the chosen alternative, and of a tornado bar where the base choice holds.
    static final String
     
    static final String
    The colour of a derived value, which the reader cannot move.
    static final String
    The font family the writers name, whose average widths the estimate is of.
    static final String
     
    static final String
    The colour of a gap: a value the rollback could not determine, or a bar where another alternative wins.
    static final String
    The colour of a flip and its threshold.
    static final String
    The ink of ordinary text and outlines.
    static final String
    The colour of a choice left open.
    static final String
     
    static final String
    When nothing is priced: the choice is left open, and the ledger alone weighs the alternatives.
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    ascent(double size)
    Where the baseline of a line of text of a size sits beneath its top.
    static String
    atStep(double value, double step)
    A value at a step's resolution: as many decimals as the step has, so a slider stepping by 0.05 shows 0.35, never 0.34999999.
    static String
    chip(double lower, double upper, boolean lowerOpen, boolean upperOpen, boolean computed, DecisionFigureText.Unit unit, String symbol)
    A measure's bounds as a chip on the tree prints them, in the measure's unit: a share as a percentage, money after its symbol, anything else followed by its unit's name; an interval in brackets.
    static String
    count(double count)
    A count of a cohort: whole from ten up, to two significant figures beneath, so 214.2 reads 214, 3.31 reads 3.3, 2.04 reads 2 and 0.41 reads 0.41.
    static String
    countClause(String sparer, boolean chosenSpares, String countText, String unit, String perText, String eachText)
    A clause for one counted unit: who spares how many, per how many cases, and at what in money each, when the other side pays for it.
    static String
    fit(String text, double size, boolean bold, double maxWidth)
    The text, or as much of it as fits a width with an ellipsis.
    static String
    length(double value)
    A length as the writers print it: at most two decimals, no trailing zeros.
    static double
    lineHeight(double size)
    The height of a line of text of a size, as the builders space lines.
    static String
    ofCohort(double count, double size)
    How many of a cohort go a way, as a branch says it: "214 of 1,000", or "all 1,000" when every one does.
    static String
    percent(double share)
    A computed share as a percentage; see percent(double, boolean).
    static String
    percent(double share, boolean computed)
    A share as a reader says it: a computed one as a percentage to three significant figures, no wider, so a threshold of 0.017463 reads 1.75%; a stated one as the block wrote it, so 0.214 reads 21.4% and 0.9 reads 90%.
    static String
    quantity(double value, DecisionFigureText.Unit unit, String symbol)
    A quantity on a tornado's caption or threshold, with its unit: a share as a percentage, money after its symbol to the whole unit, anything else to three significant figures followed by its unit's name when it has one.
    static String
    shown(double value, boolean computed, boolean money)
    A measure's value as its chip shows it.
    static String
    symbolFor(String unitName)
    The sign a money unit is written with when it has a familiar one, from the unit's name: a dollar's $, a euro's €, a pound's £, a yen's ¥; empty for any other, which then prints its name.
    static String
    tally(String alternative, boolean entering, double size, List<String> names, List<Double> counts)
    Where a cohort ends up, entering a tree of consequences with no choice at its root when entering.
    static String
    tally(String alternative, double size, List<String> names, List<Double> counts)
    Where a cohort that takes one alternative ends up, as one sentence: the outcomes largest first, each with its count and, where fewer than a third arrive, how rare it is as one in so many.
    static String
    tradeoff(String chosen, String other, double money, String moneyText, double health, String healthText, String priceText, String pricedText)
    What the choice at the root trades, as one sentence: how the chosen alternative stands against the next best in money and in health, and the price of a healthy year at which they tie, against the price the tree was read at.
    static String
    tradeoff(String chosen, String other, double money, String moneyText, double health, String healthText, String priceText, String pricedText, boolean countedAgainst, List<String> clauses)
    The trade with what the tree counts weighed in: countedAgainst when the chosen alternative brings more of some counted unit than the next best, so that it does not win outright however health is priced; and a clause per counted unit that differs, already worded, which follows the sentence.
    static String
    value(double value)
    A measure's value as a threshold or a caption reads it: whole above a hundred, two decimals above one, four beneath, since a flip found by bisection is only as exact as its range.
    static double
    width(String text, double size, boolean bold)
    The estimated width of a run of text: each character by its class in a Helvetica-like face, bold a twentieth wider, a space between words narrow.
    static List<String>
    wrap(String text, double size, double maxWidth)
    The text broken into lines no wider than a width, at spaces.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • lineHeight

      public static double lineHeight(double size)
      The height of a line of text of a size, as the builders space lines.
    • ascent

      public static double ascent(double size)
      Where the baseline of a line of text of a size sits beneath its top.
    • width

      public static double width(String text, double size, boolean bold)
      The estimated width of a run of text: each character by its class in a Helvetica-like face, bold a twentieth wider, a space between words narrow.
    • fit

      public static String fit(String text, double size, boolean bold, double maxWidth)
      The text, or as much of it as fits a width with an ellipsis.
    • wrap

      public static List<String> wrap(String text, double size, double maxWidth)
      The text broken into lines no wider than a width, at spaces.
    • value

      public static String value(double value)
      A measure's value as a threshold or a caption reads it: whole above a hundred, two decimals above one, four beneath, since a flip found by bisection is only as exact as its range.
    • percent

      public static String percent(double share, boolean computed)
      A share as a reader says it: a computed one as a percentage to three significant figures, no wider, so a threshold of 0.017463 reads 1.75%; a stated one as the block wrote it, so 0.214 reads 21.4% and 0.9 reads 90%.
    • percent

      public static String percent(double share)
      A computed share as a percentage; see percent(double, boolean).
    • symbolFor

      public static String symbolFor(String unitName)
      The sign a money unit is written with when it has a familiar one, from the unit's name: a dollar's $, a euro's €, a pound's £, a yen's ¥; empty for any other, which then prints its name.
    • chip

      public static String chip(double lower, double upper, boolean lowerOpen, boolean upperOpen, boolean computed, DecisionFigureText.Unit unit, String symbol)
      A measure's bounds as a chip on the tree prints them, in the measure's unit: a share as a percentage, money after its symbol, anything else followed by its unit's name; an interval in brackets. A stated number prints as the block wrote it, a computed one no wider than it earns, as shown(double, boolean, boolean) prints them.
    • quantity

      public static String quantity(double value, DecisionFigureText.Unit unit, String symbol)
      A quantity on a tornado's caption or threshold, with its unit: a share as a percentage, money after its symbol to the whole unit, anything else to three significant figures followed by its unit's name when it has one. A negative amount of money carries its sign before the symbol.
    • shown

      public static String shown(double value, boolean computed, boolean money)
      A measure's value as its chip shows it. A stated number prints as the block wrote it and no wider; a computed one is held to what its inputs can carry: money to the whole unit of its currency, a share or a quantity to three significant figures, since a product of two-figure assumptions never earns a fifth decimal.
    • atStep

      public static String atStep(double value, double step)
      A value at a step's resolution: as many decimals as the step has, so a slider stepping by 0.05 shows 0.35, never 0.34999999.
    • count

      public static String count(double count)
      A count of a cohort: whole from ten up, to two significant figures beneath, so 214.2 reads 214, 3.31 reads 3.3, 2.04 reads 2 and 0.41 reads 0.41.
    • ofCohort

      public static String ofCohort(double count, double size)
      How many of a cohort go a way, as a branch says it: "214 of 1,000", or "all 1,000" when every one does.
    • tally

      public static String tally(String alternative, double size, List<String> names, List<Double> counts)
      Where a cohort that takes one alternative ends up, as one sentence: the outcomes largest first, each with its count and, where fewer than a third arrive, how rare it is as one in so many. The outcome names and counts are given in order.
    • tally

      public static String tally(String alternative, boolean entering, double size, List<String> names, List<Double> counts)
      Where a cohort ends up, entering a tree of consequences with no choice at its root when entering.
    • tradeoff

      public static String tradeoff(String chosen, String other, double money, String moneyText, double health, String healthText, String priceText, String pricedText)
      What the choice at the root trades, as one sentence: how the chosen alternative stands against the next best in money and in health, and the price of a healthy year at which they tie, against the price the tree was read at.
      Parameters:
      money - how much more money the chosen costs, printed with its sign dropped; negative means less
      health - how much more healthy life the chosen keeps, printed with its sign dropped; negative means less
    • tradeoff

      public static String tradeoff(String chosen, String other, double money, String moneyText, double health, String healthText, String priceText, String pricedText, boolean countedAgainst, List<String> clauses)
      The trade with what the tree counts weighed in: countedAgainst when the chosen alternative brings more of some counted unit than the next best, so that it does not win outright however health is priced; and a clause per counted unit that differs, already worded, which follows the sentence.
    • countClause

      public static String countClause(String sparer, boolean chosenSpares, String countText, String unit, String perText, String eachText)
      A clause for one counted unit: who spares how many, per how many cases, and at what in money each, when the other side pays for it. "“scan” spares 3.3 ruptures per 1,000, at $590,000 each."; "“wear test” would spare 185,400 patients with an implant removed per 100, at $54 each."
    • length

      public static String length(double value)
      A length as the writers print it: at most two decimals, no trailing zeros.