| … | |
… | |
| 35 | |
35 | |
| 36 | my $c = bless { |
36 | my $c = bless { |
| 37 | value => $value, type => $type, isConstant => 1, |
37 | value => $value, type => $type, isConstant => 1, |
| 38 | ref => $ref, equation => $equation, |
38 | ref => $ref, equation => $equation, |
| 39 | }, $class; |
39 | }, $class; |
| 40 | $c->{canBeInterval} = 1 if ($value->class eq 'Point' && $type->{length} == 2); |
40 | $c->{canBeInterval} = 1 |
|
|
41 | if $value->{canBeInterval} || |
|
|
42 | ($value->class =~ m/Point|List/ && |
|
|
43 | $type->{length} == 2 && $type->{entryType}{name} eq 'Number'); |
| 41 | |
44 | |
| 42 | $c->{isZero} = $value->isZero; |
45 | $c->{isZero} = $value->isZero; |
| 43 | $c->{isOne} = $value->isOne; |
46 | $c->{isOne} = $value->isOne; |
| 44 | return $c; |
47 | return $c; |
| 45 | } |
48 | } |
| … | |
… | |
| 76 | return $TeX; |
79 | return $TeX; |
| 77 | } |
80 | } |
| 78 | sub perl { |
81 | sub perl { |
| 79 | my $self = shift; my $parens = shift; my $matrix = shift; |
82 | my $self = shift; my $parens = shift; my $matrix = shift; |
| 80 | my $perl = $self->{value}->perl(0,$matrix); |
83 | my $perl = $self->{value}->perl(0,$matrix); |
| 81 | $perl = 'Closed('.$perl.')' |
84 | $perl = "(($perl)->with(open=>'$self->{open}',close=>'$self->{close}'))" |
| 82 | if $self->{canBeInterval} && $self->{open}.$self->{close} eq '[]'; |
85 | if $self->{canBeInterval} && $self->{open}.$self->{close} eq '[]'; |
| 83 | $perl = '('.$perl.')' if $parens; |
86 | $perl = '('.$perl.')' if $parens; |
| 84 | return $perl; |
87 | return $perl; |
| 85 | } |
88 | } |
| 86 | |
89 | |
| … | |
… | |
| 97 | } |
100 | } |
| 98 | |
101 | |
| 99 | # |
102 | # |
| 100 | # Get a Union object's data |
103 | # Get a Union object's data |
| 101 | # |
104 | # |
| 102 | sub makeUnion {@{shift->{value}->{data}}} |
105 | sub makeUnion {@{shift->{value}{data}}} |
| 103 | |
106 | |
| 104 | ######################################################################### |
107 | ######################################################################### |
| 105 | |
108 | |
| 106 | 1; |
109 | 1; |
| 107 | |
110 | |