UNPKG

1.01 kBJavaScriptView Raw
1/**
2 * @fileoverview Define the abstract class about cursors which manipulate another cursor.
3 * @author Toru Nagashima
4 */
5"use strict";
6
7//------------------------------------------------------------------------------
8// Requirements
9//------------------------------------------------------------------------------
10
11const Cursor = require("./cursor");
12
13//------------------------------------------------------------------------------
14// Exports
15//------------------------------------------------------------------------------
16
17/**
18 * The abstract class about cursors which manipulate another cursor.
19 */
20module.exports = class DecorativeCursor extends Cursor {
21
22 /**
23 * Initializes this cursor.
24 * @param {Cursor} cursor The cursor to be decorated.
25 */
26 constructor(cursor) {
27 super();
28 this.cursor = cursor;
29 }
30
31 /** @inheritdoc */
32 moveNext() {
33 const retv = this.cursor.moveNext();
34
35 this.current = this.cursor.current;
36
37 return retv;
38 }
39};