From: dpvc v. a. <we...@ma...> - 2005-08-11 14:32:38
|
Log Message: ----------- Changes needt for Set object, and fixed a bug with unions containing constant intervals with non-constant ones. Modified Files: -------------- pg/lib/Parser/BOP: union.pm Revision Data ------------- Index: union.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Parser/BOP/union.pm,v retrieving revision 1.6 retrieving revision 1.7 diff -Llib/Parser/BOP/union.pm -Llib/Parser/BOP/union.pm -u -r1.6 -r1.7 --- lib/Parser/BOP/union.pm +++ lib/Parser/BOP/union.pm @@ -18,22 +18,26 @@ $self->{type} = Value::Type('Union',2,$Value::Type{number}); $self->{canBeInterval} = 1; foreach my $op ('lop','rop') { - if ($self->{$op}->type !~ m/^(Interval|Union)$/) { - $self->{$op} = bless $self->{$op}, 'Parser::List::Interval'; + if ($self->{$op}->type !~ m/^(Interval|Union|Set)$/) { + if ($self->{$op}->class eq 'Value') { + $self->{$op}{value} = Value::Interval::promote($self->{$op}{value}); + } else { + $self->{$op} = bless $self->{$op}, 'Parser::List::Interval'; + } $self->{$op}->typeRef->{name} = $self->{equation}{context}{parens}{interval}{type}; } } - } else {$self->Error("Operands of '%s' must be intervals",$self->{bop})} + } else {$self->Error("Operands of '%s' must be intervals or sets",$self->{bop})} } # # Make a union of the two operands. # -sub _eval {shift; Value::Union->new(@_)} +sub _eval {$_[1] + $_[2]} # -# Make a union of intervals. +# Make a union of intervals or sets. # sub perl { my $self = shift; my $parens = shift; my @union = (); @@ -44,7 +48,7 @@ } # -# Turn a union into a list of the intervals in the union. +# Turn a union into a list of the intervals or sets in the union. # sub makeUnion { my $self = shift; |