Revision 44376 trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultExpressionBuilder.java
DefaultExpressionBuilder.java | ||
---|---|---|
90 | 90 |
} |
91 | 91 |
|
92 | 92 |
@Override |
93 |
public void replace(Value target, Value replacement) { |
|
94 |
if( this.value == target ) { |
|
95 |
this.value = replacement; |
|
96 |
} else { |
|
97 |
this.value.replace(target, replacement); |
|
98 |
} |
|
99 |
} |
|
100 |
|
|
101 |
@Override |
|
93 | 102 |
public String toString() { |
94 | 103 |
return this.toString(EMPTY_FORMATTER); |
95 | 104 |
} |
... | ... | |
181 | 190 |
} |
182 | 191 |
|
183 | 192 |
@Override |
193 |
public void replace(Value target, Value replacement) { |
|
194 |
if( this.srs == target ) { |
|
195 |
this.srs = replacement; |
|
196 |
} else { |
|
197 |
this.srs.replace(target, replacement); |
|
198 |
} |
|
199 |
} |
|
200 |
|
|
201 |
@Override |
|
184 | 202 |
public Parameter as_geometry_variable() { |
185 | 203 |
this.type = ParameterType.Geometry; |
186 | 204 |
if (this.value == null && this.name != null) { |
... | ... | |
493 | 511 |
} |
494 | 512 |
|
495 | 513 |
@Override |
514 |
public void replace(Value target, Value replacement) { |
|
515 |
if( this.values == null ) { |
|
516 |
return; |
|
517 |
} |
|
518 |
for (int i = 0; i < values.size(); i++) { |
|
519 |
Value theValue = values.get(i); |
|
520 |
if( target == theValue ) { |
|
521 |
values.set(i, replacement); |
|
522 |
} else { |
|
523 |
theValue.replace(target, replacement); |
|
524 |
} |
|
525 |
} |
|
526 |
} |
|
527 |
|
|
528 |
@Override |
|
496 | 529 |
public Object value() { |
497 | 530 |
return this.value; |
498 | 531 |
} |
... | ... | |
572 | 605 |
} |
573 | 606 |
|
574 | 607 |
@Override |
608 |
public void replace(Value target, Value replacement) { |
|
609 |
for (int i = 0; i < parameters.size(); i++) { |
|
610 |
Value value = parameters.get(i); |
|
611 |
if( value == target ) { |
|
612 |
parameters.set(i, replacement); |
|
613 |
} else { |
|
614 |
value.replace(target, replacement); |
|
615 |
} |
|
616 |
} |
|
617 |
} |
|
618 |
|
|
619 |
@Override |
|
575 | 620 |
public String toString() { |
576 | 621 |
return this.toString(EMPTY_FORMATTER); |
577 | 622 |
} |
... | ... | |
614 | 659 |
|
615 | 660 |
public class MethodBase extends FunctionBase implements Method { |
616 | 661 |
|
617 |
private final Value instance;
|
|
662 |
private Value instance; |
|
618 | 663 |
|
619 | 664 |
public MethodBase(Value instance, String name) { |
620 | 665 |
super(name); |
... | ... | |
631 | 676 |
this.instance.accept(visitor, filter); |
632 | 677 |
super.accept(visitor, filter); |
633 | 678 |
} |
679 |
|
|
680 |
@Override |
|
681 |
public void replace(Value target, Value replacement) { |
|
682 |
if( this.instance == target ) { |
|
683 |
this.instance = replacement; |
|
684 |
} else { |
|
685 |
this.instance.replace(target, replacement); |
|
686 |
} |
|
687 |
} |
|
634 | 688 |
|
635 | 689 |
@Override |
636 | 690 |
public String toString(Formatter<Value> formatter) { |
... | ... | |
678 | 732 |
} |
679 | 733 |
|
680 | 734 |
@Override |
735 |
public void replace(Value target, Value replacement) { |
|
736 |
if( target == this.left ) { |
|
737 |
this.left = replacement; |
|
738 |
} else { |
|
739 |
this.left.replace(target, replacement); |
|
740 |
} |
|
741 |
if( target == this.right ) { |
|
742 |
this.right = replacement; |
|
743 |
} else { |
|
744 |
this.right.replace(target, replacement); |
|
745 |
} |
|
746 |
} |
|
747 |
|
|
748 |
@Override |
|
681 | 749 |
public void accept(Visitor visitor, VisitorFilter filter) { |
682 | 750 |
super.accept(visitor, filter); |
683 | 751 |
this.left.accept(visitor, filter); |
... | ... | |
1695 | 1763 |
public Function list() { |
1696 | 1764 |
return function(FUNCTION_LIST); |
1697 | 1765 |
} |
1766 |
|
|
1767 |
@Override |
|
1768 |
public Function tuple() { |
|
1769 |
return function(FUNCTION_TUPLE); |
|
1770 |
} |
|
1771 |
|
|
1772 |
@Override |
|
1773 |
public Function tuple(Constant... values) { |
|
1774 |
Function fn = function(FUNCTION_TUPLE); |
|
1775 |
for (Value theValue : values) { |
|
1776 |
fn.parameter(this.constant(theValue)); |
|
1777 |
} |
|
1778 |
return fn; |
|
1779 |
} |
|
1780 |
|
|
1781 |
|
|
1698 | 1782 |
} |
Also available in: Unified diff