uhr/src/domain/layout.ts

51 lines
1.5 KiB
TypeScript

/*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import {Letter} from './letter';
export interface Layout {
readonly code: string;
getCoarseMinute?: (time: Date) => number;
getDotMinute?: (time: Date) => number;
getHour?: (time: Date) => number;
getSeconds?: (time: Date) => number;
readonly hours: TimeDefinition;
readonly letters: string[];
readonly minutes: TimeDefinition;
parsed?: Letter[][];
readonly permanent: WordDefinition | WordDefinition[];
readonly prettyName: string;
seconds?: TimeDefinition;
readonly version: number;
}
export interface WordDefinition {
[line: number]: number[];
}
export interface TimeDefinition {
[values: string]: WordDefinition | WordDefinition[];
}
export const EMPTY_LAYOUT: Layout = {
code: null,
hours: null,
letters: [],
minutes: null,
permanent: [],
prettyName: null,
version: 2
};