Explorar o código

Downgrade tslint for now

Andrea Condoluci %!s(int64=9) %!d(string=hai) anos
pai
achega
b00843329b

+ 1 - 1
package.json

@@ -30,7 +30,7 @@
         "chai": "",
         "mocha": "",
         "tsify": "",
-        "tslint": "",
+        "tslint": "3.8.0",
         "typescript": "",
         "browserify": "",
         "phantomjs-prebuilt": "",

+ 13 - 12
src/Common/DataObjects/fraction.ts

@@ -1,14 +1,7 @@
-// TODO: implement operators!
-
-export class Fraction /*implements IComparable, IComparer<Fraction> */{
-   constructor(numerator: number = 0, denominator: number = 1, simplify: boolean = true) {
-       this.numerator = numerator;
-       this.denominator = denominator;
-
-       if (simplify) { this.simplify(); }
-       this.setRealValue();
-   }
+// FIXME: Check the operators' names
+// FIXME: This class should probably be immutable?
 
+export class Fraction {
     private static maximumAllowedNumber: number = 46340;
     private numerator: number = 0;
     private denominator: number = 1;
@@ -23,8 +16,8 @@ export class Fraction /*implements IComparable, IComparer<Fraction> */{
     }
 
     public static Equal(f1: Fraction, f2: Fraction): boolean {
-      // FIXME
-      return f1.Denominator === f2.Denominator && f1.Numerator === f2.Numerator;
+        // FIXME
+        return f1.Denominator === f2.Denominator && f1.Numerator === f2.Numerator;
     }
 
     public static CreateFractionFromFraction(fraction: Fraction): Fraction {
@@ -63,6 +56,14 @@ export class Fraction /*implements IComparable, IComparer<Fraction> */{
         return a;
     }
 
+    constructor(numerator: number = 0, denominator: number = 1, simplify: boolean = true) {
+        this.numerator = numerator;
+        this.denominator = denominator;
+
+        if (simplify) { this.simplify(); }
+        this.setRealValue();
+    }
+
     public ToString(): string {
         return this.numerator + "/" + this.denominator;
     }

+ 8 - 8
src/Common/DataObjects/pitch.ts

@@ -17,14 +17,6 @@ export enum AccidentalEnum {
 }
 
 export class Pitch {
-    constructor(fundamentalNote: NoteEnum, octave: number, accidental: AccidentalEnum) {
-        this.fundamentalNote = fundamentalNote;
-        this.octave = octave;
-        this.accidental = accidental;
-        this.halfTone = <number>(fundamentalNote) + (octave + Pitch.octXmlDiff) * 12 + <number>accidental;
-        this.frequency = Pitch.calcFrequency(this);
-    }
-
     public static pitchEnumValues: NoteEnum[] = [
         NoteEnum.C, NoteEnum.D, NoteEnum.E, NoteEnum.F, NoteEnum.G, NoteEnum.A, NoteEnum.B,
     ];
@@ -136,6 +128,14 @@ export class Pitch {
         return fundamentalNote;
     }
 
+    constructor(fundamentalNote: NoteEnum, octave: number, accidental: AccidentalEnum) {
+        this.fundamentalNote = fundamentalNote;
+        this.octave = octave;
+        this.accidental = accidental;
+        this.halfTone = <number>(fundamentalNote) + (octave + Pitch.octXmlDiff) * 12 + <number>accidental;
+        this.frequency = Pitch.calcFrequency(this);
+    }
+
     public get Octave(): number {
         return this.octave;
     }

+ 9 - 7
src/MusicalScore/VoiceData/Voice.ts

@@ -2,6 +2,14 @@ import {Instrument} from "../Instrument";
 import {VoiceEntry} from "./VoiceEntry";
 
 export class Voice {
+    private voiceEntries: VoiceEntry[] = [];
+    private parent: Instrument;
+    private visible: boolean;
+    private audible: boolean;
+    private following: boolean;
+    private voiceId: number;
+    private volume: number = 1;
+
     constructor(parent: Instrument, voiceId: number) {
         this.parent = parent;
         this.visible = true;
@@ -9,13 +17,7 @@ export class Voice {
         this.following = true;
         this.voiceId = voiceId;
     }
-    private voiceEntries: VoiceEntry[] = new Array();
-    private parent: Instrument;
-    private visible: boolean;
-    private audible: boolean;
-    private following: boolean;
-    private voiceId: number;
-    private volume: number = 1;
+
     public get VoiceEntries(): VoiceEntry[] {
         return this.voiceEntries;
     }