-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from friedalexuni/main
Added homework B02 skeleton (no tests included)
- Loading branch information
Showing
4 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"); | ||
} | ||
|
||
} |