for j:=1 to Length(S) do

  if (S[j]+S[j+1])='->' then break else

  inc(num);

  num1:=1;

  for j:=num to Length(S) do

  if S[j]=' ' then

  begin

  SetLength(V1,num1);

  V1[num1-1]:=S1;

  S1:='';

  inc(num1);

  end  else

  begin

  S1:=S1+S[j];

  end;

  SetLength(V1,num1);

  V1[num1-1]:=S1;

  if num1>=2 then

  for j:=0 to num1-2 do

  begin

  ii:=0;

  jj:=0;

  for k:=1 to StrToInt(V[0]) do

  begin

  if V1[j]=V[k] then jj:=k;

  if V1[j+1]=V[k] then ii:=k;

  end;

  if Table[ii, jj]=''  then Table[ii, jj]:='=' else

  if Table[ii, jj]<>'=' then Table[ii, jj]:=Table[ii, jj]+', =' else

  Table[ii, jj]:='=';

  end;

  end;

for i:=0 to Form2.ListBox1.Count-1 do  ///отношение <

  begin

  SetLength(V1,0);

  S1:='';

  num:=3;

  S:=Form2.ListBox1.Items[i];

  for j:=1 to Length(S) do

  if (S[j]+S[j+1])='->' then break else

  inc(num);

  num1:=1;

  for j:=num to Length(S) do

  if S[j]=' ' then

  begin

  SetLength(V1,num1);

  V1[num1-1]:=S1;

  S1:='';

  inc(num1);

  end  else

  begin

  S1:=S1+S[j];

  end;

  SetLength(V1,num1);

  V1[num1-1]:=S1;

  if num1>1 then

  for j:=0 to num1-2 do

  begin

  jj:=0;

  for k:=1 to StrToInt(V[0]) do

НЕ нашли? Не то? Что вы ищете?

  if V1[j]=V[k] then jj:=k;

  nn:=0;

  flag:=false;

  for k:=0 to Mas_of_Net_Length-1 do

  if V1[j+1]=Mas_of_Net[k] then

  begin

  nn:=k;

  flag:=true;

  end;

  if flag then

  for k:=1 to StrToInt(MasL[nn,0]) do

  begin

  ii:=0;

  for m:=1 to StrToInt(V[0]) do

  if MasL[nn, k]=V[m] then ii:=m;

  if jj<>0 then

  if Table[ii, jj]='' then Table[ii, jj]:='<' else

  if Table[ii, jj]<>'<' then Table[ii, jj]:=Table[ii, jj]+', <' else

  Table[ii, jj]:='<';

  end;

  end;

  end;

for i:=0 to Form2.ListBox1.Count-1 do  ///отношение > пп1 (Bi<Bj, если A->xCBj и Bi принадлежит R(C))

  begin

  SetLength(V1,0);

  S1:='';

  num:=3;

  S:=Form2.ListBox1.Items[i];

  for j:=1 to Length(S) do

  if (S[j]+S[j+1])='->' then break else

  inc(num);

  num1:=1;

  for j:=num to Length(S) do

  if S[j]=' ' then

  begin

  SetLength(V1,num1);

  V1[num1-1]:=S1;

  S1:='';

  inc(num1);

  end  else

  begin

  S1:=S1+S[j];

  end;

  SetLength(V1,num1);

  V1[num1-1]:=S1;

  if num1>1 then

  for j:=0 to num1-2 do

  begin

  ii:=0;

  for k:=1 to StrToInt(V[0]) do

  if V1[j+1]=V[k] then ii:=k;

  nn:=0;

  flag:=false;

  for k:=0 to Mas_of_Net_Length-1 do

  if V1[j]=Mas_of_Net[k] then

  begin

  nn:=k;

  flag:=true;

  end;

  if flag then

  for k:=1 to StrToInt(MasR[nn,0]) do

  begin

  jj:=0;

  for m:=1 to StrToInt(V[0]) do

  if MasR[nn, k]=V[m] then jj:=m;

  if jj<>0 then

  if Table[ii, jj]='' then Table[ii, jj]:='>' else

  if Table[ii, jj]<>'>' then Table[ii, jj]:=Table[ii, jj]+', >' else

  Table[ii, jj]:='>';

  end;

  end;

  end;

for i:=0 to Form2.ListBox1.Count-1 do  ///отношение > пп2 (Bi<Bj, если A->xCDy и Bi принадлежит R(C) и Bj принадлежит L(D))

  begin

  SetLength(V1,0);

  SetLength(N1,1);

  SetLength(N2,1);

  N1[0]:=1;

  N2[0]:=1;

  S1:='';

  num:=3;

  S:=Form2.ListBox1.Items[i];

  for j:=1 to Length(S) do

  if (S[j]+S[j+1])='->' then break else

  inc(num);

  num1:=1;

  for j:=num to Length(S) do

  if S[j]=' ' then

  begin

  SetLength(V1,num1);

  V1[num1-1]:=S1;

  S1:='';

  inc(num1);

  end  else

  begin

  S1:=S1+S[j];

  end;

  SetLength(V1,num1);

  V1[num1-1]:=S1;

  if num1>1 then

  for j:=0 to num1-2 do

  begin

  nn:=0;

  flag:=false;

  for k:=0 to Mas_of_Net_Length-1 do

  if V1[j]=Mas_of_Net[k] then

  begin

  nn:=k;

  flag:=true;

  end;

  if flag then

  for k:=1 to StrToInt(MasR[nn,0]) do

  begin

  ii:=0;

  for m:=1 to StrToInt(V[0]) do

  if MasR[nn, k]=V[m] then ii:=m;

  if ii<>0 then

  begin

  //////Table[ii, jj]:='>';

  SetLength(N1,N1[0]+1);

  N1[0]:=N1[0]+1;

  N1[N1[0]-1]:=ii;

  end;

  end;

  nn:=0;

  flag:=false;

  for k:=0 to Mas_of_Net_Length-1 do

  if V1[j+1]=Mas_of_Net[k] then

  begin

  nn:=k;

  flag:=true;

  end;

  if flag then

  for k:=1 to StrToInt(MasL[nn,0]) do

  begin

  jj:=0;

  for m:=1 to StrToInt(V[0]) do

  if MasL[nn, k]=V[m] then jj:=m;

  if jj<>0 then

  begin

  //////Table[ii, jj]:='>';

  SetLength(N2,N2[0]+1);

  N2[0]:=N2[0]+1;

  N2[N2[0]-1]:=jj;

  end;

  end;

  if (N1[0]>1) and (N2[0]>1) then

  for m:=1 to N2[0]-1 do

  for k:=1 to N1[0]-1 do

  if Table[N2[m],N1[k]]='' then Table[N2[m],N1[k]]:='>' else

  if Table[N2[m],N1[k]]<>'>' then Table[N2[m],N1[k]]:=Table[N2[m],N1[k]]+', >' else

  Table[N2[m],N1[k]]:='>';

  SetLength(N1,1);

  SetLength(N2,1);

  N1[0]:=1;

  N2[0]:=1;

  end;

  end;

//Дополняем символами $

ii:=0;

Table[StrToInt(V[0])+1,0]:='$';

Table[0,StrToInt(V[0])+1]:='$';

for i:=0 to Mas_of_Net_Length-1 do

  if Mas_of_Net[i]='S' then ii:=i;

for i:=1 to StrToInt(MasL[ii,0]) do

  for j:=0 to StrToInt(V[0]) do

  if Table[0,j]=MasL[ii, i] then Table[j, StrToInt(V[0])+1]:='<';

for i:=1 to StrToInt(MasR[ii,0]) do

  for j:=0 to StrToInt(V[0]) do

  if Table[j,0]=MasR[ii, i] then Table[StrToInt(V[0])+1,j]:='>';

for i:=1 to StrToInt(V[0]) do

  begin

  if Table[0,i]='S' then Table[i, StrToInt(V[0])+1]:='<';

  end;

Form3.StringGrid9.ColCount:=StrToInt(V[0])+2;

Form3.StringGrid9.RowCount:=StrToInt(V[0])+2;

for i:=0 to Form3.StringGrid9.ColCount-1 do

  for j:=0 to Form3.StringGrid9.RowCount-1 do

  Form3.StringGrid9.Cells[i, j]:=Table[i, j];

  Form3.Show;

for i:=0 to Form3.StringGrid9.RowCount-1 do

For j:=0 to length(mas_of_Net)-1 do

if form3.StringGrid9.Cells[0,i]<>mas_of_net[j] then

mast[i]:=form3.StringGrid9.Cells[0,i]

else

begin

mast[i]:='';

break;

end;

Button5.Enabled:=true;

//Form3.StringGrid9.Cells [23,23]:= '>';

end;

procedure TForm2.Button6Click(Sender: TObject);

begin

Form3.Show;

end;

function nextstack:string;

var

i, j:integer;

symb:string;

begin

j:=length(stack);

for i:=1 to 2 do

begin

while stack[j]<>' ' do

dec(j);

dec(j);

end;

symb:='';

for j:=j downto 1 do

if stack[j]<>' ' then

symb:=stack[j]+symb

else

break;

nextstack:=symb;

end;

procedure delst(i:integer);

begin

delete(stack, length(stack)-i+1,i);

end;

procedure delst1(i:integer);

begin

delete(st1,length(st1)-i+1,i);

end;

function newstack(Stack:string):string;

var

symb:string;

i:integer;

begin

flagsign:=false;

symb:='';

for i:=length(stack) downto 1 do

begin

if stack[i]<>' ' then

symb:=stack[i]+symb

else

break;

end;

newstack:=symb;

end;

function newstr:string;

var

i:integer;

symb:string;

x: 1..2;

begin

symb:='';

for i:=1 to length(vhod) do

if vhod[i]<>' 'then

symb:=symb+vhod[i]

else

break;

newstr:=symb;

end;

Function Get_from_table(st:string;vh:string):string;

var i, j:integer;

rez:string;

begin

For i:=1 to Form3.Stringgrid9.ColCount do

If (st=Table[0,i]) then break;

For j:=1 to Form3.Stringgrid9.RowCount do

If (vh=Table[0,j]) then break;

  rez:=Table[j, i];

  Form3.StringGrid9.Row:=i;

  Form3.StringGrid9.Col:=j;

  Get_from_table:=rez;

  end;

function View_last(W:TdxOcNode):TdxOcNode;

var nod, res:TdxOcNode;

as1,fff, i:integer;

flagb:boolean;

begin

flagb:=false;

for i:=0 to length(mas_of_net)-1 do

if w. Text=mas_of_net[i]

then

begin

flagb:=true;

break;

end;

if (flagb = true)

then begin

  if W. GetFirstChild=nil

  then begin

  Result:=W;

  exit;

  end

  else begin

  for fff:=W. Count-1 downto 0 do

  begin

  result:=view_last(W. Items[fff]);

  if result<> nil then Exit;

  end;

  end;

  end

else begin

  result:=nil;

  end;

end;

procedure View_DR(b:string);

var fg:integer;

  q, i:integer;

  x, flagb:boolean;

  s:string;

  node, tt:TdxOcNode;

  po:^String;

begin

node:=view_last(Form2.dxOrgChart1.Items[0]);

fg:=1;

while fg<=length(b) do

  begin

  s:='';

  while (b[fg]<>' ') and (fg<=length(b)) do

  begin

  s:=s+b[fg];

  inc(fg);

  end;

  tt:=Form2.dxOrgChart1.AddChild(node, po);

  tt. Text:=s;

  tt. Shape:=shEllipse;

  flagb:=false;

  for i:=0 to length(mas_of_net)-1 do

Из за большого объема этот материал размещен на нескольких страницах:
1 2 3 4 5 6 7 8 9 10 11