diff options
Diffstat (limited to 'src/client/northstar/core')
12 files changed, 0 insertions, 433 deletions
diff --git a/src/client/northstar/core/BaseObject.ts b/src/client/northstar/core/BaseObject.ts deleted file mode 100644 index ed3818071..000000000 --- a/src/client/northstar/core/BaseObject.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { IEquatable } from '../utils/IEquatable'; -import { IDisposable } from '../utils/IDisposable'; - -export class BaseObject implements IEquatable, IDisposable { - - public Equals(other: Object): boolean { - return this === other; - } - - public Dispose(): void { - } -}
\ No newline at end of file diff --git a/src/client/northstar/core/attribute/AttributeModel.ts b/src/client/northstar/core/attribute/AttributeModel.ts deleted file mode 100644 index c89b1617c..000000000 --- a/src/client/northstar/core/attribute/AttributeModel.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { Attribute, DataType, VisualizationHint } from '../../model/idea/idea'; -import { BaseObject } from '../BaseObject'; -import { observable } from "mobx"; - -export abstract class AttributeModel extends BaseObject { - public abstract get DisplayName(): string; - public abstract get CodeName(): string; - public abstract get DataType(): DataType; - public abstract get VisualizationHints(): VisualizationHint[]; -} - -export class ColumnAttributeModel extends AttributeModel { - public Attribute: Attribute; - - constructor(attribute: Attribute) { - super(); - this.Attribute = attribute; - } - - public get DataType(): DataType { - return this.Attribute.dataType ? this.Attribute.dataType : DataType.Undefined; - } - - public get DisplayName(): string { - return this.Attribute.displayName ? this.Attribute.displayName.ReplaceAll("_", " ") : ""; - } - - public get CodeName(): string { - return this.Attribute.rawName ? this.Attribute.rawName : ""; - } - - public get VisualizationHints(): VisualizationHint[] { - return this.Attribute.visualizationHints ? this.Attribute.visualizationHints : []; - } - - public Equals(other: ColumnAttributeModel): boolean { - return this.Attribute.rawName === other.Attribute.rawName; - } -} - -export class CodeAttributeModel extends AttributeModel { - private _visualizationHints: VisualizationHint[]; - - public CodeName: string; - - @observable - public Code: string; - - constructor(code: string, codeName: string, displayName: string, visualizationHints: VisualizationHint[]) { - super(); - this.Code = code; - this.CodeName = codeName; - this.DisplayName = displayName; - this._visualizationHints = visualizationHints; - } - - public get DataType(): DataType { - return DataType.Undefined; - } - - @observable - public DisplayName: string; - - public get VisualizationHints(): VisualizationHint[] { - return this._visualizationHints; - } - - public Equals(other: CodeAttributeModel): boolean { - return this.CodeName === other.CodeName; - } - -} - -export class BackendAttributeModel extends AttributeModel { - private _dataType: DataType; - private _displayName: string; - private _codeName: string; - private _visualizationHints: VisualizationHint[]; - - public Id: string; - - constructor(id: string, dataType: DataType, displayName: string, codeName: string, visualizationHints: VisualizationHint[]) { - super(); - this.Id = id; - this._dataType = dataType; - this._displayName = displayName; - this._codeName = codeName; - this._visualizationHints = visualizationHints; - } - - public get DataType(): DataType { - return this._dataType; - } - - public get DisplayName(): string { - return this._displayName.ReplaceAll("_", " "); - } - - public get CodeName(): string { - return this._codeName; - } - - public get VisualizationHints(): VisualizationHint[] { - return this._visualizationHints; - } - - public Equals(other: BackendAttributeModel): boolean { - return this.Id === other.Id; - } - -}
\ No newline at end of file diff --git a/src/client/northstar/core/attribute/AttributeTransformationModel.ts b/src/client/northstar/core/attribute/AttributeTransformationModel.ts deleted file mode 100644 index 66485183b..000000000 --- a/src/client/northstar/core/attribute/AttributeTransformationModel.ts +++ /dev/null @@ -1,52 +0,0 @@ - -import { computed, observable } from "mobx"; -import { AggregateFunction } from "../../model/idea/idea"; -import { AttributeModel } from "./AttributeModel"; -import { IEquatable } from "../../utils/IEquatable"; - -export class AttributeTransformationModel implements IEquatable { - - @observable public AggregateFunction: AggregateFunction; - @observable public AttributeModel: AttributeModel; - - constructor(attributeModel: AttributeModel, aggregateFunction: AggregateFunction = AggregateFunction.None) { - this.AttributeModel = attributeModel; - this.AggregateFunction = aggregateFunction; - } - - @computed - public get PresentedName(): string { - var displayName = this.AttributeModel.DisplayName; - if (this.AggregateFunction === AggregateFunction.Count) { - return "count"; - } - if (this.AggregateFunction === AggregateFunction.Avg) { - displayName = "avg(" + displayName + ")"; - } - else if (this.AggregateFunction === AggregateFunction.Max) { - displayName = "max(" + displayName + ")"; - } - else if (this.AggregateFunction === AggregateFunction.Min) { - displayName = "min(" + displayName + ")"; - } - else if (this.AggregateFunction === AggregateFunction.Sum) { - displayName = "sum(" + displayName + ")"; - } - else if (this.AggregateFunction === AggregateFunction.SumE) { - displayName = "sumE(" + displayName + ")"; - } - - return displayName; - } - - public clone(): AttributeTransformationModel { - var clone = new AttributeTransformationModel(this.AttributeModel); - clone.AggregateFunction = this.AggregateFunction; - return clone; - } - - public Equals(other: AttributeTransformationModel): boolean { - return this.AggregateFunction === other.AggregateFunction && - this.AttributeModel.Equals(other.AttributeModel); - } -}
\ No newline at end of file diff --git a/src/client/northstar/core/attribute/CalculatedAttributeModel.ts b/src/client/northstar/core/attribute/CalculatedAttributeModel.ts deleted file mode 100644 index a197c1305..000000000 --- a/src/client/northstar/core/attribute/CalculatedAttributeModel.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { BackendAttributeModel, AttributeModel, CodeAttributeModel } from "./AttributeModel"; -import { DataType, VisualizationHint } from '../../model/idea/idea'; - -export class CalculatedAttributeManager { - public static AllCalculatedAttributes: Array<AttributeModel> = new Array<AttributeModel>(); - - public static Clear() { - this.AllCalculatedAttributes = new Array<AttributeModel>(); - } - - public static CreateBackendAttributeModel(id: string, dataType: DataType, displayName: string, codeName: string, visualizationHints: VisualizationHint[]): BackendAttributeModel { - var filtered = this.AllCalculatedAttributes.filter(am => { - if (am instanceof BackendAttributeModel && - am.Id === id) { - return true; - } - return false; - }); - if (filtered.length > 0) { - return filtered[0] as BackendAttributeModel; - } - var newAttr = new BackendAttributeModel(id, dataType, displayName, codeName, visualizationHints); - this.AllCalculatedAttributes.push(newAttr); - return newAttr; - } - - public static CreateCodeAttributeModel(code: string, codeName: string, visualizationHints: VisualizationHint[]): CodeAttributeModel { - var filtered = this.AllCalculatedAttributes.filter(am => { - if (am instanceof CodeAttributeModel && - am.CodeName === codeName) { - return true; - } - return false; - }); - if (filtered.length > 0) { - return filtered[0] as CodeAttributeModel; - } - var newAttr = new CodeAttributeModel(code, codeName, codeName.ReplaceAll("_", " "), visualizationHints); - this.AllCalculatedAttributes.push(newAttr); - return newAttr; - } -}
\ No newline at end of file diff --git a/src/client/northstar/core/brusher/IBaseBrushable.ts b/src/client/northstar/core/brusher/IBaseBrushable.ts deleted file mode 100644 index 87f4ba413..000000000 --- a/src/client/northstar/core/brusher/IBaseBrushable.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { PIXIPoint } from '../../utils/MathUtil'; -import { IEquatable } from '../../utils/IEquatable'; -import { Doc } from '../../../../new_fields/Doc'; - -export interface IBaseBrushable<T> extends IEquatable { - BrusherModels: Array<Doc>; - BrushColors: Array<number>; - Position: PIXIPoint; - Size: PIXIPoint; -} -export function instanceOfIBaseBrushable<T>(object: any): object is IBaseBrushable<T> { - return 'BrusherModels' in object; -}
\ No newline at end of file diff --git a/src/client/northstar/core/brusher/IBaseBrusher.ts b/src/client/northstar/core/brusher/IBaseBrusher.ts deleted file mode 100644 index d2de6ed62..000000000 --- a/src/client/northstar/core/brusher/IBaseBrusher.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { PIXIPoint } from '../../utils/MathUtil'; -import { IEquatable } from '../../utils/IEquatable'; - - -export interface IBaseBrusher<T> extends IEquatable { - Position: PIXIPoint; - Size: PIXIPoint; -} -export function instanceOfIBaseBrusher<T>(object: any): object is IBaseBrusher<T> { - return 'BrushableModels' in object; -}
\ No newline at end of file diff --git a/src/client/northstar/core/filter/FilterModel.ts b/src/client/northstar/core/filter/FilterModel.ts deleted file mode 100644 index 6ab96b33d..000000000 --- a/src/client/northstar/core/filter/FilterModel.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { ValueComparison } from "./ValueComparision"; -import { Utils } from "../../utils/Utils"; -import { IBaseFilterProvider } from "./IBaseFilterProvider"; -import { FilterOperand } from "./FilterOperand"; -import { HistogramField } from "../../dash-fields/HistogramField"; -import { Cast, FieldValue } from "../../../../new_fields/Types"; -import { Doc } from "../../../../new_fields/Doc"; - -export class FilterModel { - public ValueComparisons: ValueComparison[]; - constructor() { - this.ValueComparisons = new Array<ValueComparison>(); - } - - public Equals(other: FilterModel): boolean { - if (!Utils.EqualityHelper(this, other)) return false; - if (!this.isSame(this.ValueComparisons, (other).ValueComparisons)) return false; - return true; - } - - private isSame(a: ValueComparison[], b: ValueComparison[]): boolean { - if (a.length !== b.length) { - return false; - } - for (let i = 0; i < a.length; i++) { - let valueComp = a[i]; - if (!valueComp.Equals(b[i])) { - return false; - } - } - return true; - } - - public ToPythonString(): string { - return "(" + this.ValueComparisons.map(vc => vc.ToPythonString()).join("&&") + ")"; - } - - public static And(filters: string[]): string { - let ret = filters.filter(f => f !== "").join(" && "); - return ret; - } - public static GetFilterModelsRecursive(baseOperation: IBaseFilterProvider, visitedFilterProviders: Set<IBaseFilterProvider>, filterModels: FilterModel[], isFirst: boolean): string { - let ret = ""; - visitedFilterProviders.add(baseOperation); - let filtered = baseOperation.FilterModels.filter(fm => fm && fm.ValueComparisons.length > 0); - if (!isFirst && filtered.length > 0) { - filterModels.push(...filtered); - ret = "(" + baseOperation.FilterModels.filter(fm => fm !== null).map(fm => fm.ToPythonString()).join(" || ") + ")"; - } - if (Utils.isBaseFilterConsumer(baseOperation) && baseOperation.Links) { - let children = new Array<string>(); - let linkedGraphNodes = baseOperation.Links; - linkedGraphNodes.map(linkVm => { - let filterDoc = FieldValue(Cast(linkVm.linkedFrom, Doc)); - if (filterDoc) { - let filterHistogram = Cast(filterDoc.data, HistogramField); - if (filterHistogram) { - if (!visitedFilterProviders.has(filterHistogram.HistoOp)) { - let child = FilterModel.GetFilterModelsRecursive(filterHistogram.HistoOp, visitedFilterProviders, filterModels, false); - if (child !== "") { - // if (linkVm.IsInverted) { - // child = "! " + child; - // } - children.push(child); - } - } - } - } - }); - - let childrenJoined = children.join(baseOperation.FilterOperand === FilterOperand.AND ? " && " : " || "); - if (children.length > 0) { - if (ret !== "") { - ret = "(" + ret + " && (" + childrenJoined + "))"; - } - else { - ret = "(" + childrenJoined + ")"; - } - } - } - return ret; - } -}
\ No newline at end of file diff --git a/src/client/northstar/core/filter/FilterOperand.ts b/src/client/northstar/core/filter/FilterOperand.ts deleted file mode 100644 index 2e8e8d6a0..000000000 --- a/src/client/northstar/core/filter/FilterOperand.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum FilterOperand -{ - AND, - OR -}
\ No newline at end of file diff --git a/src/client/northstar/core/filter/FilterType.ts b/src/client/northstar/core/filter/FilterType.ts deleted file mode 100644 index 9adbc087f..000000000 --- a/src/client/northstar/core/filter/FilterType.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum FilterType -{ - Filter, - Brush, - Slice -}
\ No newline at end of file diff --git a/src/client/northstar/core/filter/IBaseFilterConsumer.ts b/src/client/northstar/core/filter/IBaseFilterConsumer.ts deleted file mode 100644 index e7549d113..000000000 --- a/src/client/northstar/core/filter/IBaseFilterConsumer.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { FilterOperand } from '../filter/FilterOperand'; -import { IEquatable } from '../../utils/IEquatable'; -import { Doc } from '../../../../new_fields/Doc'; - -export interface IBaseFilterConsumer extends IEquatable { - FilterOperand: FilterOperand; - Links: Doc[]; -} - -export function instanceOfIBaseFilterConsumer(object: any): object is IBaseFilterConsumer { - return 'FilterOperand' in object; -}
\ No newline at end of file diff --git a/src/client/northstar/core/filter/IBaseFilterProvider.ts b/src/client/northstar/core/filter/IBaseFilterProvider.ts deleted file mode 100644 index fc3301b11..000000000 --- a/src/client/northstar/core/filter/IBaseFilterProvider.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { FilterModel } from '../filter/FilterModel'; - -export interface IBaseFilterProvider { - FilterModels: Array<FilterModel>; -} -export function instanceOfIBaseFilterProvider(object: any): object is IBaseFilterProvider { - return 'FilterModels' in object; -}
\ No newline at end of file diff --git a/src/client/northstar/core/filter/ValueComparision.ts b/src/client/northstar/core/filter/ValueComparision.ts deleted file mode 100644 index 65687a82b..000000000 --- a/src/client/northstar/core/filter/ValueComparision.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { Predicate } from '../../model/idea/idea'; -import { Utils } from '../../utils/Utils'; -import { AttributeModel } from '../attribute/AttributeModel'; - -export class ValueComparison { - - public attributeModel: AttributeModel; - public Value: any; - public Predicate: Predicate; - - public constructor(attributeModel: AttributeModel, predicate: Predicate, value: any) { - this.attributeModel = attributeModel; - this.Value = value; - this.Predicate = predicate; - } - - public Equals(other: Object): boolean { - if (!Utils.EqualityHelper(this, other)) { - return false; - } - if (this.Predicate !== (other as ValueComparison).Predicate) { - return false; - } - let isComplex = (typeof this.Value === "object"); - if (!isComplex && this.Value !== (other as ValueComparison).Value) { - return false; - } - if (isComplex && !this.Value.Equals((other as ValueComparison).Value)) { - return false; - } - return true; - } - - public ToPythonString(): string { - var op = ""; - switch (this.Predicate) { - case Predicate.EQUALS: - op = "=="; - break; - case Predicate.GREATER_THAN: - op = ">"; - break; - case Predicate.GREATER_THAN_EQUAL: - op = ">="; - break; - case Predicate.LESS_THAN: - op = "<"; - break; - case Predicate.LESS_THAN_EQUAL: - op = "<="; - break; - default: - op = "=="; - break; - } - - var val = this.Value.toString(); - if (typeof this.Value === 'string' || this.Value instanceof String) { - val = "\"" + val + "\""; - } - var ret = " "; - var rawName = this.attributeModel.CodeName; - switch (this.Predicate) { - case Predicate.STARTS_WITH: - ret += rawName + " != null && " + rawName + ".StartsWith(" + val + ") "; - return ret; - case Predicate.ENDS_WITH: - ret += rawName + " != null && " + rawName + ".EndsWith(" + val + ") "; - return ret; - case Predicate.CONTAINS: - ret += rawName + " != null && " + rawName + ".Contains(" + val + ") "; - return ret; - default: - ret += rawName + " " + op + " " + val + " "; - return ret; - } - } -}
\ No newline at end of file |
