-
Notifications
You must be signed in to change notification settings - Fork 1
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 #15 from traP-jp/dev/remove-interface
インターフェースを抽象クラスに変更
- Loading branch information
Showing
3 changed files
with
24 additions
and
287 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
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; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.