Skip to content

Commit

Permalink
fix style issue with space after property name and before type defini…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
DiegoYungh committed Apr 14, 2016
1 parent a3df51e commit d13942a
Show file tree
Hide file tree
Showing 23 changed files with 68 additions and 68 deletions.
8 changes: 4 additions & 4 deletions src/Behavioral/ChainOfResponsibility/AbstractPurchasePower.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import {PurchaseRequest} from './PurchaseRequest';

export abstract class AbstractPurchasePower {

protected static BASE:number = 500.00;
protected static BASE: number = 500.00;

protected successor:AbstractPurchasePower = null;
protected successor: AbstractPurchasePower = null;

public setSuccessor(successor:AbstractPurchasePower):void {
public setSuccessor(successor: AbstractPurchasePower): void {
this.successor = successor;
}

public abstract processRequest(request:PurchaseRequest):void;
public abstract processRequest(request: PurchaseRequest): void;
}
8 changes: 4 additions & 4 deletions src/Behavioral/ChainOfResponsibility/ChainPatternDemo.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import {PurchaseRequest} from './PurchaseRequest';

function getInitiator() {

let manager:AbstractPurchasePower = new ManagerPurchasePower();
let director:AbstractPurchasePower = new DirectorPurchasePower();
let president:AbstractPurchasePower = new PresidentPurchasePower();
let manager: AbstractPurchasePower = new ManagerPurchasePower();
let director: AbstractPurchasePower = new DirectorPurchasePower();
let president: AbstractPurchasePower = new PresidentPurchasePower();

manager.setSuccessor(director);
director.setSuccessor(president);
Expand All @@ -25,7 +25,7 @@ function getInitiator() {
export function main() {
describe('ChainOfResponsibility', () => {

let initiator:AbstractPurchasePower = getInitiator();
let initiator: AbstractPurchasePower = getInitiator();

it('Should be approved by manager', () => {
let request = new PurchaseRequest(8000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class DirectorPurchasePower extends AbstractPurchasePower {

private static ALLOWABLE = AbstractPurchasePower.BASE * 40;

public processRequest(request:PurchaseRequest):void {
public processRequest(request: PurchaseRequest): void {
if (request.getAmount() <= DirectorPurchasePower.ALLOWABLE) {
request.setApprovedBy(this);
} else if (this.successor !== null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export class ManagerPurchasePower extends AbstractPurchasePower {

private static ALLOWABLE = AbstractPurchasePower.BASE * 20;

public processRequest(request:PurchaseRequest):void {
public processRequest(request: PurchaseRequest): void {
if (request.getAmount() <= ManagerPurchasePower.ALLOWABLE) {
request.setApprovedBy(this);
} else if (this.successor !== null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export class PresidentPurchasePower extends AbstractPurchasePower {

private static ALLOWABLE = AbstractPurchasePower.BASE * 60;

public processRequest(request:PurchaseRequest):void {
public processRequest(request: PurchaseRequest): void {
if (request.getAmount() <= PresidentPurchasePower.ALLOWABLE) {
request.setApprovedBy(this);
}
Expand Down
10 changes: 5 additions & 5 deletions src/Behavioral/ChainOfResponsibility/PurchaseRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ import {AbstractPurchasePower} from './AbstractPurchasePower';

export class PurchaseRequest {

protected approvedBy:AbstractPurchasePower = null;
protected approvedBy: AbstractPurchasePower = null;

public constructor(protected amount:number) {
public constructor(protected amount: number) {
}

public getAmount():number {
public getAmount(): number {
return this.amount;
}

public setApprovedBy(approvedBy:AbstractPurchasePower):void {
public setApprovedBy(approvedBy: AbstractPurchasePower): void {
this.approvedBy = approvedBy;
}

public getApprovedBy():AbstractPurchasePower {
public getApprovedBy(): AbstractPurchasePower {
return this.approvedBy;
}
}
16 changes: 8 additions & 8 deletions src/Behavioral/Command/CommandFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@ import {LightOffCommand} from './LightOffCommand';

export class CommandFactory {

private commands:Array<CommandInterface> = new Array();
private commands: Array<CommandInterface> = new Array();

static init():CommandFactory {
static init(): CommandFactory {
var cf = new CommandFactory();
cf.addCommand(new LightOnCommand());
cf.addCommand(new LightOffCommand());

return cf;
}

public addCommand(command:CommandInterface):void {
public addCommand(command: CommandInterface): void {
this.commands.push(command);
}

public getCommand(name:string):CommandInterface {
return this.commands.find(function (command:CommandInterface) {
public getCommand(name: string): CommandInterface {
return this.commands.find(function (command: CommandInterface) {
return command.getName() === name;
});
}

public execute(name:string):void {
public execute(name: string): void {
var command = this.getCommand(name);

if (command === undefined) {
Expand All @@ -34,8 +34,8 @@ export class CommandFactory {
command.apply();
}

public listCommands():Array<string> {
return this.commands.map(function (command:CommandInterface) {
public listCommands(): Array<string> {
return this.commands.map(function (command: CommandInterface) {
return command.getName();
});
}
Expand Down
6 changes: 3 additions & 3 deletions src/Behavioral/Command/CommandInterface.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export interface CommandInterface {

getName():string;
getName(): string;

apply():void;
apply(): void;

isExecuted():boolean;
isExecuted(): boolean;
}
2 changes: 1 addition & 1 deletion src/Behavioral/Command/CommandPatternDemo.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {CommandFactory} from './CommandFactory';
export function main() {
describe('Command', () => {

let cf:CommandFactory = CommandFactory.init();
let cf: CommandFactory = CommandFactory.init();

it('Should not find command.', () => {
expect(function () {
Expand Down
8 changes: 4 additions & 4 deletions src/Behavioral/Command/LightOffCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import {CommandInterface} from './CommandInterface';

export class LightOffCommand implements CommandInterface {

private executed:boolean = false;
private executed: boolean = false;

public apply():void {
public apply(): void {
this.executed = true;
}

public isExecuted():boolean {
public isExecuted(): boolean {
return this.executed;
}

public getName():string {
public getName(): string {
return 'Light Off';
}
}
8 changes: 4 additions & 4 deletions src/Behavioral/Command/LightOnCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import {CommandInterface} from './CommandInterface';

export class LightOnCommand implements CommandInterface {

private executed:boolean = false;
private executed: boolean = false;

public apply():void {
public apply(): void {
this.executed = true;
}

public isExecuted():boolean {
public isExecuted(): boolean {
return this.executed;
}

public getName():string {
public getName(): string {
return 'Light On';
}
}
18 changes: 9 additions & 9 deletions src/Behavioral/Interpreter/Evaluator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ import {Variable} from './Variable';

export class Evaluator implements ExpressionInterface {

private syntaxTree:ExpressionInterface;
private syntaxTree: ExpressionInterface;

public constructor(expression:string) {
public constructor(expression: string) {

var expressionStack:Array<ExpressionInterface> = new Array();
var expressionStack: Array<ExpressionInterface> = new Array();

expression.split(' ').forEach(function (token:string) {
expression.split(' ').forEach(function (token: string) {
if (token === '+') {
var subExpression:ExpressionInterface = new Plus(expressionStack.pop(), expressionStack.pop());
var subExpression: ExpressionInterface = new Plus(expressionStack.pop(), expressionStack.pop());
expressionStack.push(subExpression);
} else if (token === '-') {
var right:ExpressionInterface = expressionStack.pop();
var left:ExpressionInterface = expressionStack.pop();
var right: ExpressionInterface = expressionStack.pop();
var left: ExpressionInterface = expressionStack.pop();

var subExpression:ExpressionInterface = new Minus(left, right);
var subExpression: ExpressionInterface = new Minus(left, right);
expressionStack.push(subExpression);
} else {
expressionStack.push(new Variable(token));
Expand All @@ -29,7 +29,7 @@ export class Evaluator implements ExpressionInterface {
this.syntaxTree = expressionStack.pop();
}

public interpret(context:Map<string, ExpressionInterface>):number {
public interpret(context: Map<string, ExpressionInterface>): number {
return this.syntaxTree.interpret(context);
}
}
2 changes: 1 addition & 1 deletion src/Behavioral/Interpreter/ExpressionInterface.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export interface ExpressionInterface {
interpret(variables:Map<string, ExpressionInterface>):number;
interpret(variables: Map<string, ExpressionInterface>): number;
}
6 changes: 3 additions & 3 deletions src/Behavioral/Interpreter/InterpreterPatternDemo.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import {Number as Num} from './Number';
export function main() {
describe('Interpreter', () => {

let expression:string = 'w x z - +';
let evaluator:ExpressionInterface = new Evaluator(expression);
let variables:Map<string, Num> = new Map<string, Num>();
let expression: string = 'w x z - +';
let evaluator: ExpressionInterface = new Evaluator(expression);
let variables: Map<string, Num> = new Map<string, Num>();
variables.set('w', new Num(52));
variables.set('x', new Num(25));
variables.set('z', new Num(25));
Expand Down
4 changes: 2 additions & 2 deletions src/Behavioral/Interpreter/Minus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import {ExpressionInterface} from './ExpressionInterface';

export class Minus implements ExpressionInterface {

public constructor(private leftOperand:ExpressionInterface, private rightOperand:ExpressionInterface) {
public constructor(private leftOperand: ExpressionInterface, private rightOperand: ExpressionInterface) {
}

public interpret(variables:Map<string, ExpressionInterface>):number {
public interpret(variables: Map<string, ExpressionInterface>): number {
return this.leftOperand.interpret(variables) - this.rightOperand.interpret(variables);
}
}
4 changes: 2 additions & 2 deletions src/Behavioral/Interpreter/Number.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import {ExpressionInterface} from './ExpressionInterface';

export class Number implements ExpressionInterface {

public constructor(private number:number) {
public constructor(private number: number) {
}

public interpret(variables:Map<string, ExpressionInterface>):number {
public interpret(variables: Map<string, ExpressionInterface>): number {
return this.number;
}
}
4 changes: 2 additions & 2 deletions src/Behavioral/Interpreter/Plus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import {ExpressionInterface} from './ExpressionInterface';

export class Plus implements ExpressionInterface {

public constructor(private leftOperand:ExpressionInterface, private rightOperand:ExpressionInterface) {
public constructor(private leftOperand: ExpressionInterface, private rightOperand: ExpressionInterface) {
}

public interpret(variables:Map<string, ExpressionInterface>):number {
public interpret(variables: Map<string, ExpressionInterface>): number {
return this.leftOperand.interpret(variables) + this.rightOperand.interpret(variables);
}
}
4 changes: 2 additions & 2 deletions src/Behavioral/Interpreter/Variable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import {ExpressionInterface} from './ExpressionInterface';

export class Variable implements ExpressionInterface {

public constructor(private name:string) {
public constructor(private name: string) {
}

public interpret(variables:Map<string, ExpressionInterface>):number {
public interpret(variables: Map<string, ExpressionInterface>): number {
return null === variables.get(this.name) ? 0 : variables.get(this.name).interpret(variables);
}
}
4 changes: 2 additions & 2 deletions src/Behavioral/Iterator/ContainerInterface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Iterator} from './IteratorInterface';

export interface Container <T>{
getIterator(): Iterator<T>;
export interface Container <T> {
getIterator(): Iterator<T>;
}
8 changes: 4 additions & 4 deletions src/Behavioral/Iterator/DemoIterator.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {Iterator} from './IteratorInterface';

export class DemoIterator<T> implements Iterator<T> {
private index:number;
private items:Array<T>;
private index: number;
private items: Array<T>;

constructor(items:Array<T>) {
constructor(items: Array<T>) {
this.items = items;
this.index = 0;
}
Expand All @@ -18,7 +18,7 @@ export class DemoIterator<T> implements Iterator<T> {
}

public next() {
let item:any = null;
let item: any = null;

if (this.hasNext() === true) {
this.index = this.index + 1;
Expand Down
2 changes: 1 addition & 1 deletion src/Behavioral/Iterator/DemoRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {DemoIterator} from './DemoIterator';
export class DemoRepository<T> implements Container<T> {
private items: Array<T>;

public constructor (items: Array<T>) {
public constructor(items: Array<T>) {
this.items = items;
}

Expand Down
6 changes: 3 additions & 3 deletions src/Behavioral/Iterator/IteratorInterface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export interface Iterator<T> {
currentItem():T;
hasNext():boolean;
next():T;
currentItem(): T;
hasNext(): boolean;
next(): T;
}
2 changes: 1 addition & 1 deletion src/Behavioral/Iterator/IteratorPatternDemo.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {DemoRepository} from './DemoRepository';
export function main() {
describe('Iterator', () => {

let repository:DemoRepository<number> = new DemoRepository<number>(
let repository: DemoRepository<number> = new DemoRepository<number>(
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
);
let iterator = repository.getIterator();
Expand Down

0 comments on commit d13942a

Please sign in to comment.