-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementa novas funções especiais de modificadores (#115)
* Implementa novo método calc() * Testes unitários para o método calcular() * Implementa novo método gradiente-linear() * Testes unitaŕios - método gradiente-linear() * Implementa novo método contraste() * Implementa testes unitários de valores para o método contraste()
- Loading branch information
1 parent
b81f5e4
commit 9e97f88
Showing
14 changed files
with
433 additions
and
27 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
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
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
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
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Simbolo } from "../../lexador"; | ||
import { Metodo } from "./metodo"; | ||
|
||
export class Calcular extends Metodo { | ||
valor1: number; | ||
quantificador1: string; | ||
operador: string; | ||
valor2: number; | ||
quantificador2: string; | ||
traducao: string; | ||
|
||
constructor(valor1: Simbolo, quantificador1: Simbolo, operador: Simbolo, valor2: Simbolo, quantificador2: Simbolo) { | ||
super(); | ||
this.valor1 = Number(valor1.lexema); | ||
this.quantificador1 = quantificador1.lexema; | ||
this.operador = operador.lexema; | ||
this.valor2 = Number(valor2.lexema); | ||
this.quantificador2 = quantificador2.lexema; | ||
this.traducao = 'calc'; | ||
} | ||
|
||
paraTexto() { | ||
return `calc(${this.valor1}${this.quantificador1} ${this.operador} ${this.valor2}${this.quantificador2})` | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Simbolo } from "../../lexador"; | ||
import { Metodo } from "./metodo"; | ||
|
||
export class Contraste extends Metodo { | ||
valor: number; | ||
quantificador: string; | ||
traducao: string; | ||
|
||
constructor(valor: Simbolo, quantificador: Simbolo) { | ||
super(); | ||
this.valor = Number(valor.lexema); | ||
|
||
this.quantificador = quantificador ? quantificador.lexema : null; | ||
this.traducao = 'contrast'; | ||
} | ||
|
||
paraTexto() { | ||
if (this.quantificador) { | ||
return `contrast(${this.valor}${this.quantificador})` | ||
} | ||
|
||
return `contrast(${this.valor})` | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Simbolo } from "../../lexador"; | ||
import { Metodo } from "./metodo"; | ||
import { cores } from "../../modificadores/atributos/cores"; | ||
|
||
export class GradienteLinear extends Metodo { | ||
valorAngulo: number; | ||
quantificadorAngulo: string; | ||
cor1: string; | ||
cor2: string; | ||
traducao: string; | ||
|
||
constructor(valorAngulo: Simbolo, quantificadorAngulo: Simbolo, cor1: Simbolo, cor2: Simbolo) { | ||
super(); | ||
this.valorAngulo = Number(valorAngulo.lexema); | ||
this.quantificadorAngulo = quantificadorAngulo.lexema; | ||
this.cor1 = cor1.lexema; | ||
this.cor2 = cor2.lexema; | ||
this.traducao = 'linear-gradient'; | ||
} | ||
|
||
paraTexto() { | ||
this.cor1 = cores[this.cor1]; | ||
this.cor2 = cores[this.cor2]; | ||
return `linear-gradient(${this.valorAngulo}${this.quantificadorAngulo}, ${this.cor1}, ${this.cor2})` | ||
} | ||
} |
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
Oops, something went wrong.