1
- import { Vector } from " ./vector/vector" ;
2
- import { DictionaryVector } from " ./vector/dictionary" ;
1
+ import { Vector } from ' ./vector/vector' ;
2
+ import { DictionaryVector } from ' ./vector/dictionary' ;
3
3
4
4
export type ValueFunc < T > = ( idx : number , cols : Vector [ ] ) => T | null ;
5
5
export type PredicateFunc = ( idx : number , cols : Vector [ ] ) => boolean ;
6
6
7
7
export abstract class Value < T > {
8
8
eq ( other : Value < T > | T ) : Predicate {
9
- if ( ! ( other instanceof Value ) ) other = new Literal ( other ) ;
9
+ if ( ! ( other instanceof Value ) ) { other = new Literal ( other ) ; }
10
10
return new Equals ( this , other ) ;
11
11
}
12
12
lteq ( other : Value < T > | T ) : Predicate {
13
- if ( ! ( other instanceof Value ) ) other = new Literal ( other ) ;
13
+ if ( ! ( other instanceof Value ) ) { other = new Literal ( other ) ; }
14
14
return new LTeq ( this , other ) ;
15
15
}
16
16
gteq ( other : Value < T > | T ) : Predicate {
17
- if ( ! ( other instanceof Value ) ) other = new Literal ( other ) ;
17
+ if ( ! ( other instanceof Value ) ) { other = new Literal ( other ) ; }
18
18
return new GTeq ( this , other ) ;
19
19
}
20
20
}
21
21
22
- class Literal < T = any > extends Value < T > {
22
+ class Literal < T = any > extends Value < T > {
23
23
constructor ( public v : T ) { super ( ) ; }
24
24
}
25
25
26
- class Col < T = any > extends Value < T > {
26
+ class Col < T = any > extends Value < T > {
27
27
vector : Vector < T > ;
28
28
colidx : number ;
29
29
@@ -39,9 +39,9 @@ class Col<T=any> extends Value<T> {
39
39
break ;
40
40
}
41
41
}
42
- if ( this . colidx < 0 ) throw new Error ( `Failed to bind Col "${ this . name } "` )
42
+ if ( this . colidx < 0 ) { throw new Error ( `Failed to bind Col "${ this . name } "` ) ; }
43
43
}
44
- this . vector = cols [ this . colidx ]
44
+ this . vector = cols [ this . colidx ] ;
45
45
return this . vector . get . bind ( this . vector ) ;
46
46
}
47
47
@@ -55,7 +55,7 @@ export abstract class Predicate {
55
55
ands ( ) : Predicate [ ] { return [ this ] ; }
56
56
}
57
57
58
- abstract class ComparisonPredicate < T = any > extends Predicate {
58
+ abstract class ComparisonPredicate < T = any > extends Predicate {
59
59
constructor ( public readonly left : Value < T > , public readonly right : Value < T > ) {
60
60
super ( ) ;
61
61
}
@@ -94,7 +94,7 @@ class And extends CombinationPredicate {
94
94
const right = this . right . bind ( cols ) ;
95
95
return ( idx : number , cols : Vector [ ] ) => left ( idx , cols ) && right ( idx , cols ) ;
96
96
}
97
- ands ( ) : Predicate [ ] { return this . left . ands ( ) . concat ( this . right . ands ( ) ) ; }
97
+ ands ( ) : Predicate [ ] { return this . left . ands ( ) . concat ( this . right . ands ( ) ) ; }
98
98
}
99
99
100
100
class Or extends CombinationPredicate {
@@ -121,7 +121,7 @@ class Equals extends ComparisonPredicate {
121
121
const col_func = col . bind ( cols ) ;
122
122
if ( col . vector instanceof DictionaryVector ) {
123
123
// Assume that there is only one key with the value `lit.v`
124
- let key = - 1
124
+ let key = - 1 ;
125
125
for ( ; ++ key < col . vector . data . length ; ) {
126
126
if ( col . vector . data . get ( key ) === lit . v ) {
127
127
break ;
@@ -138,7 +138,7 @@ class Equals extends ComparisonPredicate {
138
138
} else {
139
139
return ( idx : number ) => {
140
140
return ( col . vector as DictionaryVector < any > ) . getKey ( idx ) === key ;
141
- }
141
+ } ;
142
142
}
143
143
} else {
144
144
return ( idx : number , cols : Vector [ ] ) => col_func ( idx , cols ) == lit . v ;
0 commit comments