AxisTypes has a better toString method
This commit is contained in:
@@ -128,20 +128,49 @@ export enum DataType {
|
||||
}
|
||||
|
||||
export class AxesTypes {
|
||||
x : Set<DataType>;
|
||||
y : Set<DataType>;
|
||||
x : Array<DataType>;
|
||||
y : Array<DataType>;
|
||||
|
||||
constructor(x: Set<DataType>, y : Set<DataType>) {
|
||||
constructor(x: Array<DataType>, y : Array<DataType>) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
hasXAxis(type : DataType){
|
||||
return this.x.has(type);
|
||||
return this.x.includes(type);
|
||||
}
|
||||
|
||||
hasYAxis(type : DataType){
|
||||
return this.y.has(type);
|
||||
return this.y.includes(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* return the 1-indexed axis data type, e.g. getXAxisDataType(1) for the x1 axis
|
||||
*/
|
||||
getXAxisDataType(index: number){
|
||||
if (this.x.length+1 >= index){
|
||||
return this.x[index-1];
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* return the 1-indexed axis data type, e.g. getYAxisDataType(1) for the x1 axis
|
||||
*/
|
||||
getYAxisDataType(index: number){
|
||||
if (this.y.length+1 >= index){
|
||||
return this.y[index-1];
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
toString() {
|
||||
const x1 = this.getXAxisDataType(1);
|
||||
const y1 = this.getYAxisDataType(1);
|
||||
const x2 = this.getXAxisDataType(2);
|
||||
const y2 = this.getYAxisDataType(2);
|
||||
|
||||
return "x1:"+DataType[x1]+ " y1:"+DataType[y1]+ " x2:"+DataType[x2]+ " y2:"+DataType[y2];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user