diff options
Diffstat (limited to 'unit1.pas')
-rw-r--r-- | unit1.pas | 64 |
1 files changed, 56 insertions, 8 deletions
@@ -43,7 +43,7 @@ implementation {$R *.lfm} uses - math; + math, lowlevelunit; { TForm1 } @@ -122,6 +122,7 @@ begin if not inhaltOk then exit; image1.canvas.brush.color:=$ffffff; + image1.canvas.pen.color:=$000000; image1.canvas.rectangle(-1,-1,image1.width+1,image1.height+1); ma:=-1; mi:=-1; @@ -161,27 +162,74 @@ end; procedure tForm1.interpretiereInhalt; var - i,j,k: longint; + i,j,k,knTag: longint; + s,knZeit,t: string; begin inhaltOk:=false; + image1.canvas.pen.color:=$0000ff; + image1.canvas.pen.width:=5; + image1.canvas.moveTo(0,0); + image1.canvas.lineTo(image1.width,image1.height); + image1.canvas.moveTo(image1.width,0); + image1.canvas.lineTo(0,image1.height); + image1.canvas.pen.color:=$000000; + image1.canvas.pen.width:=1; clearArrays; setLength(zeiten,spinEdit2.value - spinEdit1.value); for i:=spinEdit1.value to spinEdit2.value-1 do zeiten[i-spinEdit1.value]:=i; tage.text:=memo1.lines.text; tage.grep('^$',true); - personen.add('EE'); setLength(kannNicht,length(zeiten)); for i:=0 to length(kannNicht)-1 do begin setLength(kannNicht[i],tage.count); - for j:=0 to length(kannNicht[i])-1 do begin - setLength(kannNicht[i,j],round(5*random)); - for k:=0 to length(kannNicht[i,j])-1 do - kannNicht[i,j,k]:=0; + for j:=0 to length(kannNicht[i])-1 do + setLength(kannNicht[i,j],0); + end; + for i:=0 to memo2.lines.count-1 do begin + s:=memo2.lines[i]; + if s='' then + continue; + personen.add(erstesArgument(s,':')); + while s<>'' do begin + knTag:=tage.findeZeile(erstesArgument(s)); + if knTag<0 then + exit; + knZeit:=erstesArgument(s); + while pos(',',knZeit)>0 do + knZeit[pos(',',knZeit)]:=' '; + while pos('-',knZeit)>0 do begin + t:=knZeit; + knZeit:=''; + while pos(' ',t+' ') < pos('-',t) do + knZeit:=knZeit+' '+erstesArgument(t); + try + j:=strToInt(erstesArgument(t,'-')); + k:=strToInt(erstesArgument(t)); + except + exit; + end; + while j<k do begin + knZeit:=knZeit+' '+intToStr(j); + inc(j); + end; + knZeit:=knZeit+' '+t; + end; + knZeit:=trim(knZeit); + while knZeit<>'' do begin + try + j:=strToInt(erstesArgument(knZeit)) - spinEdit1.value; + except + exit; + end; + if (j<0) or (j>=length(kannNicht)) then + exit; + setLength(kannNicht[j][knTag],length(kannNicht[j][knTag])+1); + kannNicht[j][knTag][length(kannNicht[j][knTag])-1]:=personen.count-1; + end; end; end; inhaltOk:= - (personen.count>0) and (tage.count>0) and (length(zeiten)>0); end; |