From: dpvc v. a. <we...@ma...> - 2007-08-26 03:09:23
|
Log Message: ----------- Allow Interval constructor to handle more situations. Modified Files: -------------- pg/lib/Value: Interval.pm Revision Data ------------- Index: Interval.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Value/Interval.pm,v retrieving revision 1.40 retrieving revision 1.41 diff -Llib/Value/Interval.pm -Llib/Value/Interval.pm -u -r1.40 -r1.41 --- lib/Value/Interval.pm +++ lib/Value/Interval.pm @@ -16,7 +16,7 @@ sub new { my $self = shift; my $class = ref($self) || $self; my $context = (Value::isContext($_[0]) ? shift : $self->context); - if (scalar(@_) == 1 && (!ref($_[0]) || ref($_[0]) eq 'ARRAY')) { + if (scalar(@_) == 1) { my $x = Value::makeValue($_[0],context=>$context); if (Value::isFormula($x)) { return $x if $x->type eq 'Interval'; @@ -151,7 +151,7 @@ my $x = (scalar(@_) ? shift : $self); return $self->new($context,$x,@_) if scalar(@_) > 0; $x = Value::makeValue($x,context=>$context); - return $x if $x->isSetOfReals; + return $x->inContext($context) if $x->isSetOfReals; return $context->Package("Set")->new($context,$x) if Value::isReal($x); my $open = $x->{open}; $open = '(' unless defined($open); my $close = $x->{close}; $close = ')' unless defined($close); |