import { SourceMeasure } from "../SourceMeasure" ; export class AbstractExpression { protected placement : PlacementEnum ; public parentMeasure : SourceMeasure ; constructor ( placement ) { this . placement = placement ; } protected static isStringInStringList ( stringList , inputString ) { for ( let idx = 0 , len = stringList . length ; idx < len ; ++ idx ) { const s = stringList [ idx ] ; if ( inputString . toLowerCase ( ) === s . toLowerCase ( ) . trim ( ) ) { return true ; } } return false ; } /** Placement of the expression */ public get Placement ( ) : PlacementEnum { return this . placement ; } public static PlacementEnumFromString ( placementString ) { switch ( placementString . toLowerCase ( ) ) { case "above" : return PlacementEnum . Above ; case "below" : return PlacementEnum . Below ; case "aboveorbelow" : case "abovebelow" : return PlacementEnum . AboveOrBelow ; case "left" : return PlacementEnum . Left ; case "right" : return PlacementEnum . Right ; case "auto" : default : return PlacementEnum . NotYetDefined ; } } } export enum PlacementEnum { Above = 0 , Below = 1 , Left = 2 , Right = 3 , NotYetDefined = 4 , AboveOrBelow = 5 }