diff --git a/src/adap-b01/names/Name.ts b/src/adap-b01/names/Name.ts index d319159b..8fddf684 100644 --- a/src/adap-b01/names/Name.ts +++ b/src/adap-b01/names/Name.ts @@ -10,6 +10,7 @@ export class Name { throw new Error("needs implementation"); } + // Returns human-readable representation of Name instance public asNameString(delimiter: string = this.delimiter): string { throw new Error("needs implementation"); } diff --git a/src/adap-b02/names/Name.ts b/src/adap-b02/names/Name.ts new file mode 100644 index 00000000..dd2ea067 --- /dev/null +++ b/src/adap-b02/names/Name.ts @@ -0,0 +1,20 @@ +export const DEFAULT_DELIMITER: string = '.'; +export const ESCAPE_CHARACTER = '\\'; + +export interface Name { + + // Returns human-readable representation of Name instance + asNameString(delimiter?: string): string; + + isEmpty(): boolean; + + getNoComponents(): number; + + getComponent(i: number): string; + setComponent(i: number, c: string): void; + + insert(i: number, c: string): void; + append(c: string): void; + remove(i: number): void; + +} \ No newline at end of file diff --git a/src/adap-b02/names/StringArrayName.ts b/src/adap-b02/names/StringArrayName.ts new file mode 100644 index 00000000..eff6395c --- /dev/null +++ b/src/adap-b02/names/StringArrayName.ts @@ -0,0 +1,48 @@ +import { Name, DEFAULT_DELIMITER, ESCAPE_CHARACTER } from "./Name"; + +export class StringArrayName implements Name { + + protected components: string[] = []; + protected delimiter: string = DEFAULT_DELIMITER; + + constructor(other: string[], delimiter?: string) { + throw new Error("needs implementation"); + } + + public asNameString(delimiter: string = this.delimiter): string { + throw new Error("needs implementation"); + } + + public isEmpty(): boolean { + throw new Error("needs implementation"); + } + + public getNoComponents(): number { + throw new Error("needs implementation"); + } + + public getComponent(i: number): string { + throw new Error("needs implementation"); + } + + public setComponent(i: number, c: string): void { + throw new Error("needs implementation"); + } + + public insert(i: number, c: string): void { + throw new Error("needs implementation"); + } + + public append(c: string): void { + throw new Error("needs implementation"); + } + + public remove(i: number): void { + throw new Error("needs implementation"); + } + + public concat(other: Name): void { + throw new Error("needs implementation"); + } + +} \ No newline at end of file diff --git a/src/adap-b02/names/StringName.ts b/src/adap-b02/names/StringName.ts new file mode 100644 index 00000000..6fcd9c49 --- /dev/null +++ b/src/adap-b02/names/StringName.ts @@ -0,0 +1,50 @@ +import { Name, DEFAULT_DELIMITER, ESCAPE_CHARACTER } from "./Name"; + +export class StringName implements Name { + + protected delimiter: string = DEFAULT_DELIMITER; + + protected name: string = ""; + protected length: number = 0; // Number of components in Name instance + + constructor(other: string, delimiter?: string) { + throw new Error("needs implementation"); + } + + public asNameString(delimiter: string = this.delimiter): string { + throw new Error("needs implementation"); + } + + public isEmpty(): boolean { + throw new Error("needs implementation"); + } + + public getNoComponents(): number { + throw new Error("needs implementation"); + } + + public getComponent(x: number): string { + throw new Error("needs implementation"); + } + + public setComponent(n: number, c: string): void { + throw new Error("needs implementation"); + } + + public insert(n: number, c: string): void { + throw new Error("needs implementation"); + } + + public append(c: string): void { + throw new Error("needs implementation"); + } + + public remove(n: number): void { + throw new Error("needs implementation"); + } + + public concat(other: Name): void { + throw new Error("needs implementation"); + } + +} \ No newline at end of file