home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / Chip_2000-02_cd.bin / zkuste / Delphi / navody / tt / objvm.exe / UNITS / RootValue.pas < prev    next >
Pascal/Delphi Source File  |  1998-03-13  |  2KB  |  63 lines

  1. unit RootValue;
  2.  
  3. interface
  4. uses LangValue,
  5.      LangValueList;
  6. {LangValue for use as Root value of IExecution and }
  7. {IObjVM }
  8. type TRootValue=class(ILangValue)
  9.      protected
  10.         function  rdValues(const s:string):ILangValue;override;
  11.      public
  12.         {List of Values included in Root}
  13.         ValueList:TLangValueList;
  14.         function  HasValue(const s:string):boolean;override;
  15.         constructor Create;
  16.         destructor  Destroy;override;
  17.         procedure   Add(a:ILangValue);
  18.         function    CreateEqu:ILangValue;override;
  19.      end;
  20. implementation
  21. uses ProxyValue;
  22. function    TRootValue.rdValues;
  23.             Var i:integer;
  24.             begin
  25.               for i:=0 to ValueList.Count-1 do
  26.               begin
  27.                 if ValueList[i].HasValue(s) then
  28.                 begin
  29.                   Result:=ValueList[i].Values[s];
  30.                   break;
  31.                 end;
  32.               end;
  33.             end;
  34. function    TRootValue.HasValue;
  35.             Var i:Integer;
  36.             begin
  37.               Result:=false;
  38.               for i:=0 to ValueList.Count-1 do
  39.               begin
  40.                 Result:=Result or ValueList[i].HasValue(s);
  41.               end;
  42.             end;
  43. constructor TRootValue.Create;
  44.             begin
  45.               inherited Create(nil);
  46.               ValueList:=TLangValueList.Create;
  47.             end;
  48. destructor  TRootValue.Destroy;
  49.             begin
  50.               ValueList.Free;
  51.               inherited Destroy;
  52.             end;
  53. procedure   TRootValue.Add;
  54.             begin
  55.               ValueList.Add(a);
  56.             end;
  57. function    TRootValue.CreateEqu;
  58.             begin
  59.               Result:=TProxyValue.CreateFrom(Self);
  60.             end;
  61.  
  62. end.
  63.