#579 closed defect (fixed)
Error in PutValue for Series
| Reported by: | Pedro Gea | Owned by: | Víctor de Buen Remiro | 
|---|---|---|---|
| Priority: | highest | Milestone: | |
| Component: | TimeSetAlgebra | Version: | head | 
| Severity: | critical | Keywords: | |
| Cc: | Pedro Gea | 
Description
PutValue or := has strange behaviors for Serie.
Here you are some examples with comments in spanish:
/
 Ejemplo 1
   El comportamiento de la reasignación varía dependiendo
   de si se accede previamente a la serie.
   Supongo que es herencia del TOL Lazy.
Serie s1 = SubSer(Pulse(y2002),y2000,y2004);
Serie s2 = s1;
Serie s1 := SubSer(Pulse(y2003),y2001,y2005);
WriteLn("\n* Ejemplo 1 (a) *");
WriteLn("serie  \tfirst    \tlast    \t2003 value:");
WriteLn("s1:\t"<<First(s1)<<"\t"<<Last(s1)<<"\t"<<SerDat(s1,y2003));
WriteLn("s2:\t"<<First(s2)<<"\t"<<Last(s2)<<"\t"<<SerDat(s2,y2003));
 => s1 == s2
  & First(s1) == First(s2)
  & Last(s1)  != Last(s2)    ???
Serie f1 = SubSer(Pulse(y2002),y2000,y2004);
Serie f2 = f1;
 --- ¡Cambia el comportamiento tras un acceso! ---
Real SerDat(f2,y2002); 
 ---------------------------------------------------
Serie f1 := SubSer(Pulse(y2003),y2001,y2005);
WriteLn("\n* Ejemplo 1 (b) *");
WriteLn("serie  \tfirst    \tlast    \t2003 value:");
WriteLn("f1:\t"<<First(f1)<<"\t"<<Last(f1)<<"\t"<<SerDat(f1,y2003));
WriteLn("f2:\t"<<First(f2)<<"\t"<<Last(f2)<<"\t"<<SerDat(f2,y2003));
 => s1 != s2
 Ejemplo 2
   Vemos hasta qué punto la reasignación no es volver a asignar.
   Para evitar que el resultado dependa de cuales son 
   las fechas inicio y final por defecto, fijamos unas.
Date PutDefaultDates(y2008,y2009);
Serie s3 = Pulse(y2003);
WriteLn("\n* Ejemplo 2 (a) *");
WriteLn("serie  \tfirst    \tlast    \t2003 value:");
WriteLn("s3:\t"<<First(s3)<<"\t"<<Last(s3)<<"   \t"<<SerDat(s3,y2003));
Serie s3 := Pulse(y2003);
WriteLn("\n* Ejemplo 2 (b) *");
WriteLn("serie  \tfirst    \tlast    \t2003 value:");
WriteLn("s3:\t"<<First(s3)<<"\t"<<Last(s3)<<"\t"<<SerDat(s3,y2003));
Change History (5)
comment:1 Changed 17 years ago by
| Status: | new → assigned | 
|---|
comment:2 Changed 17 years ago by
| Owner: | changed from danirus to Víctor de Buen Remiro | 
|---|---|
| Status: | assigned → new | 
comment:3 Changed 17 years ago by
| Resolution: | → fixed | 
|---|---|
| Status: | new → closed | 
I think that problem has been solved for bounded case. In no bounded one the time series is not a serializable object and cannot be copied because it is just and abstract syntax tree. So, all we can do is truncate it between default dates. Now is shown a warning explaining that the infinite time series will be truncated.
This is the new behaviour, please tell me if you are agree
* Ejemplo 1 (a) *
serie   first           last            2003 value:
s1:     y2001m01d01     y2005m01d01     1
s2:     y2000m01d01     y2004m01d01     0
* Ejemplo 1 (b) *
serie   first           last            2003 value:
f1:     y2001m01d01     y2005m01d01     1
f2:     y2000m01d01     y2004m01d01     0
* Ejemplo 2 (a) *
serie   first           last            2003 value:
s3:     TheBegin        TheEnd          1
<W>
Warning: [1] No se puede aplicar PutValue (:=) a una serie temporal con otra que no tiene fechas acotadas, por lo que será truncada por las fechas por defecto en curso: [y2008m01d1,y2009m01d01]</W>
* Ejemplo 2 (b) *
serie   first           last            2003 value:
s3:     y2008m01d01     y2009m01d01     ?
Thanks for reporting
comment:4 Changed 17 years ago by
| bug_file_loc: | → http://cvs.tol-project.org/viewcvs.cgi/tol_tests/tol/Bugzilla/bug_000579 | 
|---|

I think that PutValue should be disabled for virtual data types as Serie and TimeSet but I'll try to solve it at least for discrete case, when the Serie has a bounded interval of definition.
Thanks for reporting.