From 5f56c12e4911968c1c18871ba0762c1db34b8438 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 20 Dec 2016 10:51:10 +0100 Subject: Einlesen funktionstuechtig --- analyzer.lps | 118 +++++++++++++++++++++++++++++---------------------------- valuesunit.pas | 48 +++++++++++++++++------ 2 files changed, 96 insertions(+), 70 deletions(-) diff --git a/analyzer.lps b/analyzer.lps index e39f80b..40637d4 100644 --- a/analyzer.lps +++ b/analyzer.lps @@ -3,37 +3,37 @@ - + - - - + + + + + + + + + + + + + - - + + - - - - - - - - - - @@ -42,127 +42,129 @@ + + + + + + + - + - + - + - - + + - + - - + + - + - + - - + + - - + + - - + + - - + + - + - + - + - - + - + - + - + + - - + + - + - + - + - - + + - - + - - + + - + - - - - diff --git a/valuesunit.pas b/valuesunit.pas index 97d960f..a571955 100644 --- a/valuesunit.pas +++ b/valuesunit.pas @@ -20,10 +20,10 @@ type constructor create; destructor destroy; override; procedure readFromFile(dat: string); overload; - procedure readFromFile(ti: tExtPoint; dat: string); overload; - procedure readFromFile(minT,maxT: extended; dat: string); overload; + procedure readFromFile(ti: tInt64Point; dat: string); overload; + procedure readFromFile(minT,maxT: int64; dat: string); overload; function count: int64; - function timeInterval: tExtPoint; + function timeInterval: tInt64Point; procedure intersect(v: tValues); end; @@ -34,7 +34,7 @@ function timeToInt64(s: string): int64; implementation uses - math, dateutils; + dateutils; constructor tValues.create; begin @@ -50,15 +50,15 @@ end; procedure tValues.readFromFile(dat: string); begin - readFromFile(-infinity,infinity,dat); + readFromFile(low(int64),high(int64),dat); end; -procedure tValues.readFromFile(ti: tExtPoint; dat: string); +procedure tValues.readFromFile(ti: tInt64Point; dat: string); begin readFromFile(ti['x'],ti['y'],dat); end; -procedure tValues.readFromFile(minT,maxT: extended; dat: string); +procedure tValues.readFromFile(minT,maxT: int64; dat: string); var f: textfile; s: string; @@ -169,15 +169,39 @@ begin result:=length(werte); end; -function tValues.timeInterval: tExtPoint; +function tValues.timeInterval: tInt64Point; begin - result['x']:=werte[0].time; - result['y']:=werte[count-1].time; + if count=0 then begin + result['x']:=high(int64); + result['y']:=low(int64); + end + else begin + result['x']:=werte[0].time; + result['y']:=werte[count-1].time; + end; end; procedure tValues.intersect(v: tValues); +var + i,t: int64; begin - if + if (count=0) or (v.count=0) or (timeInterval=v.timeInterval) then + exit; + t:=v.timeInterval['x']; + i:=0; + while (i0 then begin + for t:=i to count-1 do + werte[t-i]:=werte[t]; + setlength(werte,count-i); + end; + + t:=v.timeInterval['y']; + while (count>0) and (werte[count-1].time>t) do + setlength(werte,length(werte)-1); + + v.intersect(self); end; // general functions *********************************************************** @@ -190,7 +214,7 @@ begin round(w1.time*(1-x) + w2.time*x); for c:='x' to 'z' do begin result.vec[c]:= - round(w1.vec[c]*(1-x) + w2.vec[c]*x); + w1.vec[c]*(1-x) + w2.vec[c]*x; end; end; -- cgit v1.2.3-54-g00ecf