Skip to content

Commit

Permalink
Merge pull request #15 from traP-jp/dev/remove-interface
Browse files Browse the repository at this point in the history
インターフェースを抽象クラスに変更
  • Loading branch information
pasmophobia authored Jun 15, 2024
2 parents c6d2fb6 + d8c596b commit 4618d7c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 287 deletions.
44 changes: 24 additions & 20 deletions h24s_25/src/ts/ballInterface.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
import { BallTypeEnum } from './balltypes';
// ball interface
export interface BallInterface {
label: () => string;
initialVelocity: { x: number, y: number };
initialPosition: { x: number, y: number };
ballType: () => BallTypeEnum;
export abstract class BallInterface {
abstract label(): string;
abstract initialVelocity: { x: number, y: number };
abstract initialPosition: { x: number, y: number };
abstract ballType(): BallTypeEnum;
}

// interface for each balltype
export interface NumberBallInterface extends BallInterface {
value: () => number;
export abstract class NumberBallInterface extends BallInterface {
abstract value(): number;
override ballType() {return BallTypeEnum.NUMBER}
}

export interface FunctionBallInterface<T> extends BallInterface {
func: () => (x: number) => T;
export abstract class FunctionBallInterface<T> extends BallInterface {
abstract func(): (x: number) => T;
override ballType(): BallTypeEnum {
return BallTypeEnum.FUNCTION;
}
}

export interface HigherOrderFunctionBallInterface<T1, T2> extends BallInterface {
func: () => (f: (x: number) => T1) => T2;
export abstract class HigherOrderFunctionBallInterface<T1, T2> extends BallInterface {
abstract func(): (f: (x: number) => T1) => T2;
override ballType() {
return BallTypeEnum.HIGHER_ORDER_FUNCTION;
}
}

export interface InputBallInterface extends BallInterface {
argId: () => number;
setValue: (value: number) => void;
convertToNumberBall: () => NumberBallInterface;
}

export interface OutputBallInterface extends BallInterface {
outputStreamId: () => number;
outputValue: () => number;
export abstract class OutputBallInterface extends BallInterface {
abstract outputStreamId(): number;
abstract outputValue(): number;
override ballType() {
return BallTypeEnum.OUTPUT;
}
}
255 changes: 0 additions & 255 deletions package-lock.json

This file was deleted.

12 changes: 0 additions & 12 deletions package.json

This file was deleted.

0 comments on commit 4618d7c

Please sign in to comment.