Skip to content

Commit

Permalink
Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Sep 12, 2021
1 parent 31bc172 commit 0d7e4e0
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 27 deletions.
4 changes: 2 additions & 2 deletions src/report/reporters/boxplot/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getCombNamePaddedColor } from '../../utils/name.js'
import { getCombTitleColorPad } from '../../utils/name.js'

import { getBox } from './box.js'
import { getLabels } from './labels.js'
Expand Down Expand Up @@ -47,7 +47,7 @@ const serializeCombination = function ({
contentWidth,
mini,
}) {
const combinationTitles = getCombNamePaddedColor(combination)
const combinationTitles = getCombTitleColorPad(combination)

if (!isMeasuredCombination(combination)) {
return getEmptyCombination(combinationTitles, mini)
Expand Down
4 changes: 2 additions & 2 deletions src/report/reporters/boxplot/width.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getCombinationPaddedName } from '../../utils/name.js'
import { getCombinationTitlePad } from '../../utils/name.js'

import { getPaddedStatLength } from './box.js'
import { isMeasuredCombination } from './normalize.js'
Expand All @@ -12,7 +12,7 @@ export const getWidths = function ({
minAll,
maxAll,
}) {
const titlesWidth = getCombinationPaddedName(combinations[0]).length
const titlesWidth = getCombinationTitlePad(combinations[0]).length
const combinationsA = combinations.filter(isMeasuredCombination)
const contentWidth = subtractToContentWidth(screenWidth, titlesWidth)
const minBlockWidth = getMinMaxBlockWidth({
Expand Down
4 changes: 2 additions & 2 deletions src/report/reporters/debug.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { fieldColor } from '../utils/colors.js'
import { getCombinationNameColor } from '../utils/name.js'
import { getCombinationTitleColor } from '../utils/name.js'
import { STAT_TITLES } from '../utils/stat_titles.js'
import { getTables } from '../utils/table.js'

Expand Down Expand Up @@ -58,7 +58,7 @@ const getBodyRows = function (combinations, statNames) {
}

const getBodyRow = function (combination, statNames) {
const leftCell = getCombinationNameColor(combination)
const leftCell = getCombinationTitleColor(combination)
const rightCells = statNames.map((statName) => getCell(statName, combination))
return [leftCell, ...rightCells]
}
Expand Down
4 changes: 2 additions & 2 deletions src/report/reporters/histogram/empty.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { getCombNamePaddedColor } from '../../utils/name.js'
import { getCombTitleColorPad } from '../../utils/name.js'

// Shown when a combination has not been measured yet
export const getEmptyCombination = function (combination, height, mini) {
const histogramLines = getHistogramLines(height, mini)
const labelsLines = getLabelsLines(mini)
const combinationTitles = getCombNamePaddedColor(combination)
const combinationTitles = getCombTitleColorPad(combination)
return `${histogramLines}${combinationTitles}\n${labelsLines}`
}

Expand Down
4 changes: 2 additions & 2 deletions src/report/reporters/histogram/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getCombNamePaddedColor } from '../../utils/name.js'
import { getCombTitleColorPad } from '../../utils/name.js'

import { getAbscissa } from './abscissa.js'
import { EXTRA_HEIGHT } from './characters.js'
Expand Down Expand Up @@ -55,7 +55,7 @@ const serializeCombination = function ({
mini,
smooth,
}) {
const combinationTitles = getCombNamePaddedColor(combination)
const combinationTitles = getCombTitleColorPad(combination)

if (histogram === undefined) {
return getEmptyCombination(combination, height, mini)
Expand Down
4 changes: 2 additions & 2 deletions src/report/reporters/histogram/width.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { getCombinationPaddedName } from '../../utils/name.js'
import { getCombinationTitlePad } from '../../utils/name.js'

import { getPaddedStatLength } from './abscissa.js'

// Compute the width of each column.
export const getWidths = function (combinations, mini, screenWidth) {
const titlesWidth = getCombinationPaddedName(combinations[0]).length
const titlesWidth = getCombinationTitlePad(combinations[0]).length
const minBlockWidth = getMinMaxBlockWidth(combinations, mini, 'min')
const maxBlockWidth = getMinMaxBlockWidth(combinations, mini, 'max')
const contentWidth = Math.max(
Expand Down
4 changes: 2 additions & 2 deletions src/report/reporters/history.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { hasSameCombinationIds } from '../../combination/ids.js'
import { fieldColor } from '../utils/colors.js'
import { getCombinationNameColor } from '../utils/name.js'
import { getCombinationTitleColor } from '../utils/name.js'
import { STATS_SEPARATOR_COLORED } from '../utils/separator.js'
import { getTables } from '../utils/table.js'

Expand Down Expand Up @@ -37,7 +37,7 @@ const getBodyRows = function (combinations, history) {
}

const getBodyRow = function (combination, history) {
const leftCell = getCombinationNameColor(combination)
const leftCell = getCombinationTitleColor(combination)
const rightCells = history.map((historyResult) =>
getCell(historyResult, combination),
)
Expand Down
25 changes: 12 additions & 13 deletions src/report/utils/name.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
import { titleColor } from './colors.js'
import { NAME_SEPARATOR, NAME_SEPARATOR_COLORED } from './separator.js'

// Retrieve a combination's name with padding and color
export const getCombNamePaddedColor = function (combination) {
return `${getCombinationNameColor(combination)}${NAME_SEPARATOR_COLORED}`
// Retrieve a combination's title with padding and color
export const getCombTitleColorPad = function (combination) {
return `${getCombinationTitleColor(combination)}${NAME_SEPARATOR_COLORED}`
}

// Retrieve a combination's name with padding
export const getCombinationPaddedName = function (combination) {
return `${getCombinationName(combination)}${NAME_SEPARATOR}`
// Retrieve a combination's title with padding
export const getCombinationTitlePad = function (combination) {
return `${getCombinationTitle(combination)}${NAME_SEPARATOR}`
}

// Retrieve the prettified combination name to used as a first column
export const getCombinationNameColor = function (combination) {
const combinationName = getCombinationName(combination)
return titleColor(combinationName)
// Retrieve the prettified combination title to used as a first column
export const getCombinationTitleColor = function (combination) {
return titleColor(getCombinationTitle(combination))
}

const getCombinationName = function ({ dimensions }) {
const combinationName = Object.values(dimensions)
const getCombinationTitle = function ({ dimensions }) {
const combinationTitle = Object.values(dimensions)
.map(getTitlePadded)
.join(NAME_MIDDLE)
return `${NAME_START}${combinationName}${NAME_END}`
return `${NAME_START}${combinationTitle}${NAME_END}`
}

const getTitlePadded = function ({ titlePadded }) {
Expand Down

0 comments on commit 0d7e4e0

Please sign in to comment.