Move `weightsToEdgeEvaluator` to `analysis` (#969)

The logic for converting weights into an edge evaluator should not be
coupled to the frontend application.

Progress towards #967.

Test plan: Very straightforward rename; `yarn test` suffices.
This commit is contained in:
Dandelion Mané 2018-10-31 20:14:30 -07:00 committed by GitHub
parent 48a66c8118
commit b077bd8179
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 13 deletions

View File

@ -1,9 +1,9 @@
// @flow // @flow
import type {Edge} from "../../../core/graph"; import type {Edge} from "../core/graph";
import type {WeightedTypes} from "../../../analysis/weights"; import type {WeightedTypes} from "./weights";
import type {EdgeEvaluator} from "../../../analysis/pagerank"; import type {EdgeEvaluator} from "./pagerank";
import {NodeTrie, EdgeTrie} from "../../../core/trie"; import {NodeTrie, EdgeTrie} from "../core/trie";
export function weightsToEdgeEvaluator(weights: WeightedTypes): EdgeEvaluator { export function weightsToEdgeEvaluator(weights: WeightedTypes): EdgeEvaluator {
const nodeTrie = new NodeTrie(); const nodeTrie = new NodeTrie();

View File

@ -1,19 +1,16 @@
// @flow // @flow
import * as NullUtil from "../../../util/null"; import * as NullUtil from "../util/null";
import { import {fallbackNodeType, fallbackEdgeType} from "./fallbackDeclaration";
fallbackNodeType,
fallbackEdgeType,
} from "../../../analysis/fallbackDeclaration";
import { import {
inserterNodeType, inserterNodeType,
machineNodeType, machineNodeType,
assemblesEdgeType, assemblesEdgeType,
} from "../../../plugins/demo/declaration"; } from "../plugins/demo/declaration";
import {edges as factorioEdges} from "../../../plugins/demo/graph"; import {edges as factorioEdges} from "../plugins/demo/graph";
import {weightsToEdgeEvaluator} from "./weightsToEdgeEvaluator"; import {weightsToEdgeEvaluator} from "./weightsToEdgeEvaluator";
describe("app/credExplorer/weights/weightsToEdgeEvaluator", () => { describe("analysis/weightsToEdgeEvaluator", () => {
describe("weightsToEdgeEvaluator", () => { describe("weightsToEdgeEvaluator", () => {
type WeightArgs = {| type WeightArgs = {|
+assemblesForward?: number, +assemblesForward?: number,

View File

@ -14,7 +14,7 @@ import {
import {StaticAdapterSet, DynamicAdapterSet} from "../adapters/adapterSet"; import {StaticAdapterSet, DynamicAdapterSet} from "../adapters/adapterSet";
import type {WeightedTypes} from "../../analysis/weights"; import type {WeightedTypes} from "../../analysis/weights";
import {weightsToEdgeEvaluator} from "./weights/weightsToEdgeEvaluator"; import {weightsToEdgeEvaluator} from "../../analysis/weightsToEdgeEvaluator";
/* /*
This models the UI states of the credExplorer/App as a state machine. This models the UI states of the credExplorer/App as a state machine.