All files / src virtual_position.ts

90.9% Statements 20/22
66.66% Branches 2/3
100% Functions 2/2
90.9% Lines 20/22

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 231x 1x 1x 1x 1x 1x 1x 1x 1x 219x 219x 219x 219x 1x 1x 7x     7x 7x 7x 1x  
import {Position} from "./position";
 
/** used for macro calls */
 
export class VirtualPosition extends Position {
  public readonly vrow: number;
  public readonly vcol: number;
 
  public constructor(virtual: Position, row: number, col: number) {
    super(virtual.getRow(), virtual.getCol());
    this.vrow = row;
    this.vcol = col;
  }
 
  public equals(p: Position): boolean {
    if (!(p instanceof VirtualPosition)) {
      return false;
    }
    const casted: VirtualPosition = p as VirtualPosition;
    return super.equals(this) && this.vrow === casted.vrow && this.vcol === casted.vcol;
  }
}