aboutsummaryrefslogtreecommitdiff
path: root/src/client/northstar/model
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/northstar/model')
-rw-r--r--src/client/northstar/model/ModelExtensions.ts32
-rw-r--r--src/client/northstar/model/ModelHelpers.ts18
-rw-r--r--src/client/northstar/model/binRanges/AlphabeticVisualBinRange.ts4
-rw-r--r--src/client/northstar/model/binRanges/DateTimeVisualBinRange.ts28
-rw-r--r--src/client/northstar/model/binRanges/NominalVisualBinRange.ts4
-rw-r--r--src/client/northstar/model/binRanges/QuantitativeVisualBinRange.ts2
-rw-r--r--src/client/northstar/model/binRanges/VisualBinRange.ts6
-rw-r--r--src/client/northstar/model/binRanges/VisualBinRangeHelper.ts23
-rw-r--r--src/client/northstar/model/idea/MetricTypeMapping.ts28
9 files changed, 70 insertions, 75 deletions
diff --git a/src/client/northstar/model/ModelExtensions.ts b/src/client/northstar/model/ModelExtensions.ts
index 9fcba7f1c..29f80d2d1 100644
--- a/src/client/northstar/model/ModelExtensions.ts
+++ b/src/client/northstar/model/ModelExtensions.ts
@@ -1,48 +1,48 @@
-import { AttributeParameters, Brush, MarginAggregateParameters, SingleDimensionAggregateParameters, Solution } from '../model/idea/idea'
-import { Utils } from '../utils/Utils'
+import { AttributeParameters, Brush, MarginAggregateParameters, SingleDimensionAggregateParameters, Solution } from '../model/idea/idea';
+import { Utils } from '../utils/Utils';
-import { FilterModel } from '../core/filter/FilterModel'
+import { FilterModel } from '../core/filter/FilterModel';
-(SingleDimensionAggregateParameters as any).prototype["Equals"] = function (other: Object) {
+(SingleDimensionAggregateParameters as any).prototype.Equals = function (other: Object) {
if (!Utils.EqualityHelper(this, other)) return false;
if (!Utils.EqualityHelper((this as SingleDimensionAggregateParameters).attributeParameters!,
(other as SingleDimensionAggregateParameters).attributeParameters!)) return false;
- if (!((this as SingleDimensionAggregateParameters).attributeParameters! as any)["Equals"]((other as SingleDimensionAggregateParameters).attributeParameters)) return false;
+ if (!((this as SingleDimensionAggregateParameters).attributeParameters! as any).Equals((other as SingleDimensionAggregateParameters).attributeParameters)) return false;
return true;
-}
+};
{
- (AttributeParameters as any).prototype["Equals"] = function (other: AttributeParameters) {
- return (<any>this).constructor.name === (<any>other).constructor.name &&
+ (AttributeParameters as any).prototype.Equals = function (other: AttributeParameters) {
+ return (this).constructor.name === (<any>other).constructor.name &&
this.rawName === other.rawName;
- }
+ };
}
{
- (Solution as any).prototype["Equals"] = function (other: Object) {
+ (Solution as any).prototype.Equals = function (other: Object) {
if (!Utils.EqualityHelper(this, other)) return false;
if ((this as Solution).solutionId !== (other as Solution).solutionId) return false;
return true;
- }
+ };
}
{
- (MarginAggregateParameters as any).prototype["Equals"] = function (other: Object) {
+ (MarginAggregateParameters as any).prototype.Equals = function (other: Object) {
if (!Utils.EqualityHelper(this, other)) return false;
if (!Utils.EqualityHelper((this as SingleDimensionAggregateParameters).attributeParameters!,
(other as SingleDimensionAggregateParameters).attributeParameters!)) return false;
- if (!((this as SingleDimensionAggregateParameters).attributeParameters! as any)["Equals"]((other as SingleDimensionAggregateParameters).attributeParameters!)) return false;
+ if (!((this as SingleDimensionAggregateParameters).attributeParameters! as any).Equals((other as SingleDimensionAggregateParameters).attributeParameters!)) return false;
if ((this as MarginAggregateParameters).aggregateFunction !== (other as MarginAggregateParameters).aggregateFunction) return false;
return true;
- }
+ };
}
{
- (Brush as any).prototype["Equals"] = function (other: Object) {
+ (Brush as any).prototype.Equals = function (other: Object) {
if (!Utils.EqualityHelper(this, other)) return false;
if ((this as Brush).brushEnum !== (other as Brush).brushEnum) return false;
if ((this as Brush).brushIndex !== (other as Brush).brushIndex) return false;
return true;
- }
+ };
} \ No newline at end of file
diff --git a/src/client/northstar/model/ModelHelpers.ts b/src/client/northstar/model/ModelHelpers.ts
index d0711fb69..ac807b41f 100644
--- a/src/client/northstar/model/ModelHelpers.ts
+++ b/src/client/northstar/model/ModelHelpers.ts
@@ -16,7 +16,7 @@ export class ModelHelpers {
public static CreateAggregateKey(distinctAttributeParameters: AttributeParameters | undefined, atm: AttributeTransformationModel, histogramResult: HistogramResult,
brushIndex: number, aggParameters?: SingleDimensionAggregateParameters): AggregateKey {
{
- if (aggParameters == undefined) {
+ if (aggParameters === undefined) {
aggParameters = ModelHelpers.GetAggregateParameter(distinctAttributeParameters, atm);
}
else {
@@ -64,7 +64,7 @@ export class ModelHelpers {
if (aggParams) {
aggregateParameters.push(aggParams);
- var margin = new MarginAggregateParameters()
+ var margin = new MarginAggregateParameters();
margin.aggregateFunction = agg.AggregateFunction;
margin.attributeParameters = ModelHelpers.GetAttributeParameters(agg.AttributeModel);
margin.distinctAttributeParameters = distinctAttributeParameters;
@@ -106,7 +106,7 @@ export class ModelHelpers {
{
rawName: am.CodeName,
visualizationHints: am.VisualizationHints,
- id: (am as BackendAttributeModel).Id
+ id: (am).Id
});
}
else if (am instanceof CodeAttributeModel) {
@@ -114,11 +114,11 @@ export class ModelHelpers {
{
rawName: am.CodeName,
visualizationHints: am.VisualizationHints,
- code: (am as CodeAttributeModel).Code
+ code: (am).Code
});
}
else {
- throw new Exception()
+ throw new Exception();
}
}
@@ -146,7 +146,7 @@ export class ModelHelpers {
}
public static GetAggregateResult(bin: Bin, aggregateKey: AggregateKey) {
- if (aggregateKey.aggregateParameterIndex == -1 || aggregateKey.brushIndex == -1) {
+ if (aggregateKey.aggregateParameterIndex === -1 || aggregateKey.brushIndex === -1) {
return null;
}
return bin.aggregateResults![aggregateKey.aggregateParameterIndex! * bin.ySize! + aggregateKey.brushIndex!];
@@ -157,9 +157,9 @@ export class ModelHelpers {
var ret = new Array<AggregateFunction>();
ret.push(AggregateFunction.None);
ret.push(AggregateFunction.Count);
- if (atm.AttributeModel.DataType == DataType.Float ||
- atm.AttributeModel.DataType == DataType.Double ||
- atm.AttributeModel.DataType == DataType.Int) {
+ if (atm.AttributeModel.DataType === DataType.Float ||
+ atm.AttributeModel.DataType === DataType.Double ||
+ atm.AttributeModel.DataType === DataType.Int) {
ret.push(AggregateFunction.Avg);
ret.push(AggregateFunction.Sum);
}
diff --git a/src/client/northstar/model/binRanges/AlphabeticVisualBinRange.ts b/src/client/northstar/model/binRanges/AlphabeticVisualBinRange.ts
index 995bf4e0b..120b034f2 100644
--- a/src/client/northstar/model/binRanges/AlphabeticVisualBinRange.ts
+++ b/src/client/northstar/model/binRanges/AlphabeticVisualBinRange.ts
@@ -1,5 +1,5 @@
-import { AlphabeticBinRange, BinLabel } from '../../model/idea/idea'
-import { VisualBinRange } from './VisualBinRange'
+import { AlphabeticBinRange, BinLabel } from '../../model/idea/idea';
+import { VisualBinRange } from './VisualBinRange';
export class AlphabeticVisualBinRange extends VisualBinRange {
public DataBinRange: AlphabeticBinRange;
diff --git a/src/client/northstar/model/binRanges/DateTimeVisualBinRange.ts b/src/client/northstar/model/binRanges/DateTimeVisualBinRange.ts
index 9313fb1a7..776e643cd 100644
--- a/src/client/northstar/model/binRanges/DateTimeVisualBinRange.ts
+++ b/src/client/northstar/model/binRanges/DateTimeVisualBinRange.ts
@@ -1,5 +1,5 @@
-import { DateTimeBinRange, DateTimeStep, DateTimeStepGranularity } from '../idea/idea'
-import { VisualBinRange } from './VisualBinRange'
+import { DateTimeBinRange, DateTimeStep, DateTimeStepGranularity } from '../idea/idea';
+import { VisualBinRange } from './VisualBinRange';
export class DateTimeVisualBinRange extends VisualBinRange {
public DataBinRange: DateTimeBinRange;
@@ -39,24 +39,24 @@ export class DateTimeVisualBinRange extends VisualBinRange {
public GetLabel(value: number): string {
var dt = DateTimeVisualBinRange.TicksToDate(value);
- if (this.DataBinRange.step!.dateTimeStepGranularity == DateTimeStepGranularity.Second ||
- this.DataBinRange.step!.dateTimeStepGranularity == DateTimeStepGranularity.Minute) {
+ if (this.DataBinRange.step!.dateTimeStepGranularity === DateTimeStepGranularity.Second ||
+ this.DataBinRange.step!.dateTimeStepGranularity === DateTimeStepGranularity.Minute) {
return ("" + this.pad(dt.getMinutes(), 2) + ":" + this.pad(dt.getSeconds(), 2));
//return dt.ToString("mm:ss");
}
- else if (this.DataBinRange.step!.dateTimeStepGranularity == DateTimeStepGranularity.Hour) {
+ else if (this.DataBinRange.step!.dateTimeStepGranularity === DateTimeStepGranularity.Hour) {
return (this.pad(dt.getHours(), 2) + ":" + this.pad(dt.getMinutes(), 2));
//return dt.ToString("HH:mm");
}
- else if (this.DataBinRange.step!.dateTimeStepGranularity == DateTimeStepGranularity.Day) {
+ else if (this.DataBinRange.step!.dateTimeStepGranularity === DateTimeStepGranularity.Day) {
return ((dt.getMonth() + 1) + "/" + dt.getDate() + "/" + dt.getFullYear());
//return dt.ToString("MM/dd/yyyy");
}
- else if (this.DataBinRange.step!.dateTimeStepGranularity == DateTimeStepGranularity.Month) {
+ else if (this.DataBinRange.step!.dateTimeStepGranularity === DateTimeStepGranularity.Month) {
//return dt.ToString("MM/yyyy");
return ((dt.getMonth() + 1) + "/" + dt.getFullYear());
}
- else if (this.DataBinRange.step!.dateTimeStepGranularity == DateTimeStepGranularity.Year) {
+ else if (this.DataBinRange.step!.dateTimeStepGranularity === DateTimeStepGranularity.Year) {
return "" + dt.getFullYear();
}
return "n/a";
@@ -82,22 +82,22 @@ export class DateTimeVisualBinRange extends VisualBinRange {
public static AddToDateTimeTicks(ticks: number, dateTimeStep: DateTimeStep): number {
var copiedDate = DateTimeVisualBinRange.TicksToDate(ticks);
var returnDate: Date = new Date(Date.now());
- if (dateTimeStep.dateTimeStepGranularity == DateTimeStepGranularity.Second) {
+ if (dateTimeStep.dateTimeStepGranularity === DateTimeStepGranularity.Second) {
returnDate = new Date(copiedDate.setSeconds(copiedDate.getSeconds() + dateTimeStep.dateTimeStepValue!));
}
- else if (dateTimeStep.dateTimeStepGranularity == DateTimeStepGranularity.Minute) {
+ else if (dateTimeStep.dateTimeStepGranularity === DateTimeStepGranularity.Minute) {
returnDate = new Date(copiedDate.setMinutes(copiedDate.getMinutes() + dateTimeStep.dateTimeStepValue!));
}
- else if (dateTimeStep.dateTimeStepGranularity == DateTimeStepGranularity.Hour) {
+ else if (dateTimeStep.dateTimeStepGranularity === DateTimeStepGranularity.Hour) {
returnDate = new Date(copiedDate.setHours(copiedDate.getHours() + dateTimeStep.dateTimeStepValue!));
}
- else if (dateTimeStep.dateTimeStepGranularity == DateTimeStepGranularity.Day) {
+ else if (dateTimeStep.dateTimeStepGranularity === DateTimeStepGranularity.Day) {
returnDate = new Date(copiedDate.setDate(copiedDate.getDate() + dateTimeStep.dateTimeStepValue!));
}
- else if (dateTimeStep.dateTimeStepGranularity == DateTimeStepGranularity.Month) {
+ else if (dateTimeStep.dateTimeStepGranularity === DateTimeStepGranularity.Month) {
returnDate = new Date(copiedDate.setMonth(copiedDate.getMonth() + dateTimeStep.dateTimeStepValue!));
}
- else if (dateTimeStep.dateTimeStepGranularity == DateTimeStepGranularity.Year) {
+ else if (dateTimeStep.dateTimeStepGranularity === DateTimeStepGranularity.Year) {
returnDate = new Date(copiedDate.setFullYear(copiedDate.getFullYear() + dateTimeStep.dateTimeStepValue!));
}
return DateTimeVisualBinRange.DateToTicks(returnDate);
diff --git a/src/client/northstar/model/binRanges/NominalVisualBinRange.ts b/src/client/northstar/model/binRanges/NominalVisualBinRange.ts
index 407ff3ea6..42509d797 100644
--- a/src/client/northstar/model/binRanges/NominalVisualBinRange.ts
+++ b/src/client/northstar/model/binRanges/NominalVisualBinRange.ts
@@ -1,5 +1,5 @@
-import { NominalBinRange, BinLabel } from '../../model/idea/idea'
-import { VisualBinRange } from './VisualBinRange'
+import { NominalBinRange, BinLabel } from '../../model/idea/idea';
+import { VisualBinRange } from './VisualBinRange';
export class NominalVisualBinRange extends VisualBinRange {
public DataBinRange: NominalBinRange;
diff --git a/src/client/northstar/model/binRanges/QuantitativeVisualBinRange.ts b/src/client/northstar/model/binRanges/QuantitativeVisualBinRange.ts
index 80886416b..c579c8e5f 100644
--- a/src/client/northstar/model/binRanges/QuantitativeVisualBinRange.ts
+++ b/src/client/northstar/model/binRanges/QuantitativeVisualBinRange.ts
@@ -1,4 +1,4 @@
-import { QuantitativeBinRange } from '../idea/idea'
+import { QuantitativeBinRange } from '../idea/idea';
import { VisualBinRange } from './VisualBinRange';
import { format } from "d3-format";
diff --git a/src/client/northstar/model/binRanges/VisualBinRange.ts b/src/client/northstar/model/binRanges/VisualBinRange.ts
index f53008f9a..449a22e91 100644
--- a/src/client/northstar/model/binRanges/VisualBinRange.ts
+++ b/src/client/northstar/model/binRanges/VisualBinRange.ts
@@ -1,11 +1,7 @@
-import { BinLabel } from '../../model/idea/idea'
+import { BinLabel } from '../../model/idea/idea';
export abstract class VisualBinRange {
- constructor() {
-
- }
-
public abstract AddStep(value: number): number;
public abstract GetValueFromIndex(index: number): number;
diff --git a/src/client/northstar/model/binRanges/VisualBinRangeHelper.ts b/src/client/northstar/model/binRanges/VisualBinRangeHelper.ts
index 53d585bb4..a92412686 100644
--- a/src/client/northstar/model/binRanges/VisualBinRangeHelper.ts
+++ b/src/client/northstar/model/binRanges/VisualBinRangeHelper.ts
@@ -4,7 +4,7 @@ import { NominalVisualBinRange } from "./NominalVisualBinRange";
import { QuantitativeVisualBinRange } from "./QuantitativeVisualBinRange";
import { AlphabeticVisualBinRange } from "./AlphabeticVisualBinRange";
import { DateTimeVisualBinRange } from "./DateTimeVisualBinRange";
-import { Settings } from "../../manager/Gateway";
+import { NorthstarSettings } from "../../manager/Gateway";
import { ModelHelpers } from "../ModelHelpers";
import { AttributeTransformationModel } from "../../core/attribute/AttributeTransformationModel";
@@ -16,18 +16,18 @@ export class VisualBinRangeHelper {
public static GetNonAggregateVisualBinRange(dataBinRange: BinRange): VisualBinRange {
if (dataBinRange instanceof NominalBinRange) {
- return new NominalVisualBinRange(dataBinRange as NominalBinRange);
+ return new NominalVisualBinRange(dataBinRange);
}
else if (dataBinRange instanceof QuantitativeBinRange) {
- return new QuantitativeVisualBinRange(dataBinRange as QuantitativeBinRange);
+ return new QuantitativeVisualBinRange(dataBinRange);
}
else if (dataBinRange instanceof AlphabeticBinRange) {
- return new AlphabeticVisualBinRange(dataBinRange as AlphabeticBinRange);
+ return new AlphabeticVisualBinRange(dataBinRange);
}
else if (dataBinRange instanceof DateTimeBinRange) {
- return new DateTimeVisualBinRange(dataBinRange as DateTimeBinRange);
+ return new DateTimeVisualBinRange(dataBinRange);
}
- throw new Exception()
+ throw new Exception();
}
public static GetVisualBinRange(distinctAttributeParameters: AttributeParameters | undefined, dataBinRange: BinRange, histoResult: HistogramResult, attr: AttributeTransformationModel, chartType: ChartType): VisualBinRange {
@@ -39,8 +39,7 @@ export class VisualBinRangeHelper {
var aggregateKey = ModelHelpers.CreateAggregateKey(distinctAttributeParameters, attr, histoResult, ModelHelpers.AllBrushIndex(histoResult));
var minValue = Number.MAX_VALUE;
var maxValue = Number.MIN_VALUE;
- for (var b = 0; b < histoResult.brushes!.length; b++) {
- var brush = histoResult.brushes![b];
+ for (const brush of histoResult.brushes!) {
aggregateKey.brushIndex = brush.brushIndex;
for (var key in histoResult.bins) {
if (histoResult.bins.hasOwnProperty(key)) {
@@ -52,16 +51,16 @@ export class VisualBinRangeHelper {
}
}
}
- };
+ }
let visualBinRange = QuantitativeVisualBinRange.Initialize(minValue, maxValue, 10, false);
- if (chartType == ChartType.HorizontalBar || chartType == ChartType.VerticalBar) {
+ if (chartType === ChartType.HorizontalBar || chartType === ChartType.VerticalBar) {
visualBinRange = QuantitativeVisualBinRange.Initialize(Math.min(0, minValue),
- Math.max(0, (visualBinRange as QuantitativeVisualBinRange).DataBinRange.maxValue!),
+ Math.max(0, (visualBinRange).DataBinRange.maxValue!),
SETTINGS_X_BINS, false);
}
- else if (chartType == ChartType.SinglePoint) {
+ else if (chartType === ChartType.SinglePoint) {
visualBinRange = QuantitativeVisualBinRange.Initialize(Math.min(0, minValue), Math.max(0, maxValue),
SETTINGS_X_BINS, false);
}
diff --git a/src/client/northstar/model/idea/MetricTypeMapping.ts b/src/client/northstar/model/idea/MetricTypeMapping.ts
index 11e0c871a..e9759cf16 100644
--- a/src/client/northstar/model/idea/MetricTypeMapping.ts
+++ b/src/client/northstar/model/idea/MetricTypeMapping.ts
@@ -5,20 +5,20 @@ import { Dictionary } from 'typescript-collections';
export class MetricTypeMapping {
public static GetMetricInterpretation(metricType: MetricType): MetricInterpretation {
- if (metricType == MetricType.Accuracy ||
- metricType == MetricType.F1 ||
- metricType == MetricType.F1Macro ||
- metricType == MetricType.F1Micro ||
- metricType == MetricType.JaccardSimilarityScore ||
- metricType == MetricType.ObjectDetectionAveragePrecision ||
- metricType == MetricType.Precision ||
- metricType == MetricType.PrecisionAtTopK ||
- metricType == MetricType.NormalizedMutualInformation ||
- metricType == MetricType.Recall ||
- metricType == MetricType.RocAucMacro ||
- metricType == MetricType.RocAuc ||
- metricType == MetricType.RocAucMicro ||
- metricType == MetricType.RSquared) {
+ if (metricType === MetricType.Accuracy ||
+ metricType === MetricType.F1 ||
+ metricType === MetricType.F1Macro ||
+ metricType === MetricType.F1Micro ||
+ metricType === MetricType.JaccardSimilarityScore ||
+ metricType === MetricType.ObjectDetectionAveragePrecision ||
+ metricType === MetricType.Precision ||
+ metricType === MetricType.PrecisionAtTopK ||
+ metricType === MetricType.NormalizedMutualInformation ||
+ metricType === MetricType.Recall ||
+ metricType === MetricType.RocAucMacro ||
+ metricType === MetricType.RocAuc ||
+ metricType === MetricType.RocAucMicro ||
+ metricType === MetricType.RSquared) {
return MetricInterpretation.HigherIsBetter;
}
return MetricInterpretation.LowerIsBetter;