Commit 93f0a5a0 authored by Federico Santiago Luongo Gonnet's avatar Federico Santiago Luongo Gonnet
Browse files

ajustes multipipe y graficos end y var point

parent 812491c7
......@@ -304,30 +304,28 @@ export class FuncPipe extends Pipe {
case METHOD_FUNCTION.IZQUIERDA_MULTIPIPE:
var res = new Array()
if (this.multipipeConstruction) {
var size = this.calculateSize(this.multipipeConstruction)
var argAux = arg.toString().replace(firstBraket, '')
argAux = argAux.replace(lastBraket, '')
var arrArg = argAux.replace(/\s/g,'').split(",")
for (var i = 0; i < size; i++) {
res.push(arrArg[i])
}
if (res.length == 1){
this.setSelectMultipipeOut(res[0])
var argAux = arg.toString().replace(firstBraket, '');
argAux = argAux.replace(lastBraket, '');
argAux = argAux.replace(/\s/g,'');
var arrArg = this.parse(argAux);
res.push(arrArg[0]);
var defineOut = this.countOutput(arrArg[0]);
if (defineOut){
this.setSelectMultipipeOut(arrArg[0])
}
}
return `${res}`;
case METHOD_FUNCTION.DERECHA_MULTIPIPE:
var res = new Array()
if (this.multipipeConstruction) {
var size = this.calculateSize(this.multipipeConstruction)
var argAux = arg.toString().replace(firstBraket, '')
argAux = argAux.replace(lastBraket, '')
var arrArg = argAux.replace(/\s/g,'').split(",")
for (var i = arrArg.length - 1; i >= arrArg.length - size; i--) {
res.unshift(arrArg[i])
}
if (res.length == 1){
this.setSelectMultipipeOut(res[0])
var argAux = arg.toString().replace(firstBraket, '');
argAux = argAux.replace(lastBraket, '');
argAux = argAux.replace(/\s/g,'');
var arrArg = this.parse(argAux);
res.push(arrArg[1]);
var defineOut = this.countOutput(arrArg[1]);
if (defineOut){
this.setSelectMultipipeOut(arrArg[1])
}
}
return `${res}`;
......@@ -353,6 +351,44 @@ export class FuncPipe extends Pipe {
return 1
}
}
parse(str) {
let result = [], item = '', depth = 0;
function push() { if (item) result.push(item); item = ''; }
for (let i = 0, c; c = str[i], i < str.length; i++) {
if (!depth && c === ',') push();
else {
item += c;
if (c === '(') depth++;
if (c === ')') depth--;
}
}
push();
return result;
}
countOutput(str) {
const RegEx1 = /\([0-9]+,[0-9]+\)/; //busco un punto (par de numeros)
const RegEx2 = /\([0-9]+,[a-z]+\)i/; // Par distinto de punto
const RegEx4 = /\([a-z]+,[0-9]+\)i/; // Par distinto de punto
const RegEx5 = /\([a-z]+,[a-z]+\)i/; // Par distinto de punto
const RegEx3 = /^\(.*\(/; // existen 2 parentesis de apertura
if (RegEx3.test(str)){
return false
} else if (RegEx1.test(str)){
return true
} else if (RegEx2.test(str) || RegEx4.test(str) || RegEx5.test(str) ){
return false
} else {
return true
}
}
/*
* @desc: Actualiza el tipo de salida de la funcion SELECT_MULTIPIPE
* @attr
......
......@@ -59,6 +59,9 @@ $color5-color: black;
.NUMBER {
fill: $NumberColor
}
.POINT {
fill: $NumberColor
}
.FIGURE {
fill: $FigureColor
}
......
......@@ -2,13 +2,11 @@ import React from 'react';
const I = (props) => (
<g transform={props.transform}>
<circle cx="20" cy="20" r="10" />
<path className={props.className[1]} d="M 10 0 L 10 20 L 15 20 L 15 0 z"/>
<path className={props.className[2]} d="M 14 0 L 14 20 L 19 20 L 19 0 z"/>
<path className={props.className[3]} d="M 18 0 L 18 20 L 23 20 L 23 0 z"/>
<path className={props.className[4]} d="M 22 0 L 22 20 L 27 20 L 27 0 z"/>
<path className={props.className[5]} d="M 26 0 L 26 20 L 30 20 L 30 0 z"/>
</g>
);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment