This file contains hidden or 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
CallCenter() { | |
workers.addAll([ | |
Responder(type: ResponderType.Worker, name: "Responder A"), | |
Responder(type: ResponderType.Worker, name: "Responder B"), | |
Responder(type: ResponderType.Worker, name: "Responder C"), | |
Responder(type: ResponderType.Worker, name: "Responder D"), | |
]); | |
managers.addAll([ | |
Responder(type: ResponderType.Manager, name: "Manager A"), |
This file contains hidden or 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
class Responder { | |
final ResponderType type; | |
Call call; | |
final String name; | |
Responder({this.type, this.name}); | |
void respondToCall(Call incoming) { | |
if (isBusy()) { | |
throw ResponderBusyException('Responder $name of type $type is busy.'); |
This file contains hidden or 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
class Call { | |
String msg; | |
List<Function> endCallCallbacks = []; | |
Call(this.msg); | |
addEndCallback(Function callback) { | |
endCallCallbacks.add(callback); | |
} |
This file contains hidden or 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
class Call { | |
String msg; | |
Call({this.msg}); | |
} |
This file contains hidden or 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
type state = string; | |
let action = | |
| Load | |
| Unload; | |
let component = ReasonReact.reducerComponent("New"); | |
let make = _children => { | |
...component, |
This file contains hidden or 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
type tSemver = Js.t(semverInstance); | |
[@bs.new] [@bs.module] external createSemver : string => tSemver = "semver"; |
This file contains hidden or 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
class type semverInstance = | |
[@bs] | |
{ | |
pub inc: tRelease => semverInstance; | |
pub version: string; | |
pub major: int; | |
pub minor: int; | |
pub patch: int; | |
pub raw: string; | |
pub build: array(string); |
This file contains hidden or 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
[@bs.module "semver"] [@bs.val] | |
external cmp : (string, string, string) => bool = "cmp"; | |
let cmp = (a: string, c: comparator, b: string) => | |
cmp(a, c |> comparatorToString, b); |
This file contains hidden or 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
let comparatorToString = comparator : string => | |
switch (comparator) { | |
| LooseEqual => "==" | |
| LooseNotEqual => "!==" | |
| Equal => "===" | |
| Empty => "" | |
| NotEqual => "!==" | |
| Gt => ">" | |
| Gte => ">=" | |
| Lt => "<" |
This file contains hidden or 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
[@bs.module "semver"] [@bs.val] | |
external cmp : (string, string, string) => bool = "cmp"; |