Skip to content

Commit

Permalink
Update for B05 homework
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkriehle authored and joluj committed Nov 25, 2024
1 parent 15d5493 commit e365e6e
Show file tree
Hide file tree
Showing 46 changed files with 995 additions and 232 deletions.
18 changes: 9 additions & 9 deletions src/adap-b01/names/Name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class Name {

/** Expects that all Name components are properly masked */
constructor(other: string[], delimiter?: string) {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

/**
Expand All @@ -29,7 +29,7 @@ export class Name {
* Users can vary the delimiter character to be used
*/
public asString(delimiter: string = this.delimiter): string {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

/**
Expand All @@ -38,35 +38,35 @@ export class Name {
* The control characters in the data string are the default characters
*/
public asDataString(): string {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public getComponent(i: number): string {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

/** Expects that new Name component c is properly masked */
public setComponent(i: number, c: string): void {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

/** Returns number of components in Name instance */
public getNoComponents(): number {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

/** Expects that new Name component c is properly masked */
public insert(i: number, c: string): void {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

/** Expects that new Name component c is properly masked */
public append(c: string): void {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public remove(i: number): void {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

}
27 changes: 21 additions & 6 deletions src/adap-b02/files1/File.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,44 @@
export class File {

public isOpen(): boolean {
throw new Error("no implementation");
throw new Error("incomplete example code");
}

public isClosed(): boolean {
throw new Error("no implementation");
throw new Error("incomplete example code");
}

public open(): void {
this.assertIsClosedFile();
throw new Error("incomplete example code");
}

public read(): Object[] {
this.assertIsOpenFile();
throw new Error("no implementation");
throw new Error("incomplete example code");
}

public write(data: Object[]): void {
this.assertIsOpenFile();
throw new Error("incomplete example code");
}

public close(): void {
this.assertIsOpenFile();
throw new Error("incomplete example code");
}

public delete(): void {
this.assertIsClosedFile();
throw new Error("no implementation");
throw new Error("incomplete example code");
}

protected assertIsOpenFile(): void {
throw new Error("no implementation");
throw new Error("incomplete example code");
}

protected assertIsClosedFile(): void {
throw new Error("no implementation");
throw new Error("incomplete example code");
}

}
2 changes: 2 additions & 0 deletions src/adap-b02/files2/File.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ export interface File {
isOpen(): boolean;
isClosed(): boolean;

open(): void;
read(): any[];
write(data: any[]): void;
close(): void;
delete(): void;

}
24 changes: 17 additions & 7 deletions src/adap-b02/files2/ObjFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,44 @@ export class ObjFile implements File {
}

public isOpen(): boolean {
throw new Error("no implementation");
throw new Error("incomplete example code");
}

public isClosed(): boolean {
throw new Error("no implementation");
throw new Error("incomplete example code");
}

public open(): void {
this.assertIsClosedFile();
throw new Error("incomplete example code");
}

public read(): Object[] {
this.assertIsOpenFile();
throw new Error("no implementation");
throw new Error("incomplete example code");
}

public write(data: Object[]): void {
this.assertIsOpenFile();
throw new Error("no implementation");
throw new Error("incomplete example code");
}

public close(): void {
this.assertIsOpenFile();
throw new Error("incomplete example code");
}

public delete(): void {
this.assertIsClosedFile();
throw new Error("no implementation");
throw new Error("incomplete example code");
}

protected assertIsOpenFile(): void {
throw new Error("no implementation");
throw new Error("incomplete example code");
}

protected assertIsClosedFile(): void {
throw new Error("no implementation");
throw new Error("incomplete example code");
}

}
24 changes: 12 additions & 12 deletions src/adap-b02/names/StringArrayName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,51 +7,51 @@ export class StringArrayName implements Name {
protected components: string[] = [];

constructor(other: string[], delimiter?: string) {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public asString(delimiter: string = this.delimiter): string {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public asDataString(): string {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public getDelimiterCharacter(): string {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public isEmpty(): boolean {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public getNoComponents(): number {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public getComponent(i: number): string {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public setComponent(i: number, c: string): void {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public insert(i: number, c: string): void {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public append(c: string): void {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public remove(i: number): void {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public concat(other: Name): void {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

}
24 changes: 12 additions & 12 deletions src/adap-b02/names/StringName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,51 +8,51 @@ export class StringName implements Name {
protected noComponents: number = 0;

constructor(other: string, delimiter?: string) {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public asString(delimiter: string = this.delimiter): string {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public asDataString(): string {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public getDelimiterCharacter(): string {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public isEmpty(): boolean {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public getNoComponents(): number {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public getComponent(x: number): string {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public setComponent(n: number, c: string): void {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public insert(n: number, c: string): void {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public append(c: string): void {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public remove(n: number): void {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public concat(other: Name): void {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

}
20 changes: 10 additions & 10 deletions src/adap-b03/names/AbstractName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,39 @@ export abstract class AbstractName implements Name {
protected delimiter: string = DEFAULT_DELIMITER;

constructor(delimiter: string = DEFAULT_DELIMITER) {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public clone(): Name {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public asString(delimiter: string = this.delimiter): string {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public toString(): string {
throw new Error("needs implementation");
return this.asDataString();
}

public asDataString(): string {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public isEqual(other: Name): boolean {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public getHashCode(): number {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public isEmpty(): boolean {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

public getDelimiterCharacter(): string {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

abstract getNoComponents(): number;
Expand All @@ -51,7 +51,7 @@ export abstract class AbstractName implements Name {
abstract remove(i: number): void;

public concat(other: Name): void {
throw new Error("needs implementation");
throw new Error("needs implementation or deletion");
}

}
Loading

0 comments on commit e365e6e

Please sign in to comment.