Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 3.14 KB | None | 0 0
  1. Public Class Form2
  2.  
  3.     Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  4.         Main()
  5.     End Sub
  6.  
  7.  
  8.     Dim listFaits As Collection
  9.     Dim listRegle As Collection
  10.     Public Sub addRegle(Condition As Collection, Fact As Faits)
  11.         Dim Regl As regle
  12.         Regl = New regle
  13.         For Each Obj In listRegle
  14.             Regl.AddCondition(CType(Obj, Faits))
  15.         Next obj
  16.         Regl.FaitFinal(Fact)
  17.  
  18.     End Sub
  19.  
  20.     Public Sub addFait(Name As Integer, val As Boolean
  21.                     )
  22.         Dim fait As Faits
  23.         fait = New Faits
  24.         fait.Faits("A", True)
  25.     End Sub
  26.  
  27.  
  28.     Function ChainageAux(ByVal BR As BR, ByVal F As Faits)
  29.         Dim listeFait As Collection
  30.         listeFait = listFaits
  31.         Return ChainageArriere(listeFait, BR, F)
  32.  
  33.     End Function
  34.  
  35.     Public Function ContainsFait(Colle As Collection, Name As String) As Boolean
  36.         Dim tmp As Boolean
  37.         Dim Fact As Faits
  38.         tmp = False
  39.         For Each Fact2 In Colle
  40.             If TypeOf Fact2 Is Faits Then
  41.                 Fact = CType(Fact2, Faits)
  42.                 If (Fact.Name.Equals(Name)) Then
  43.                     tmp = True
  44.                 End If
  45.             End If
  46.         Next Fact2
  47.         Return tmp
  48.     End Function
  49.  
  50.     Function ChainageArriere(ByVal listeFait As Collection, ByVal BR As BR, ByVal F As Faits)
  51.  
  52.         If ContainsFait(listeFait, F.Name) Then
  53.             Return listeFait
  54.         Else
  55.             Return ChainageArriere2(listeFait, BR, F)
  56.         End If
  57.  
  58.     End Function
  59.  
  60.     Function ChainageArriere2(ByVal BF As Collection, ByVal BR As BR, ByVal F As Faits)
  61.         Dim R As BR
  62.         Dim Fact As regle
  63.         For Each Fact2 In BR.EnsembleRegle
  64.             If TypeOf Fact2 Is regle Then
  65.                 Fact = CType(Fact2, regle)
  66.                 If F.Name Then
  67.  
  68.                 End If
  69.  
  70.  
  71.             End If
  72.         Next
  73.  
  74.         If BR.estVide Then
  75.             Return New Collection
  76.         Else
  77.             For Each Fact3 In BR.EnsembleRegle
  78.                 If TypeOf Fact3 Is regle Then
  79.                     Fact = CType(Fact3, regle)
  80.                     If Fact3.conclusionContains(F) Then
  81.                         BR = BR.suppRegle(Fact3)
  82.                         For Each Fact4 In BR.EnsembleRegle
  83.                             If TypeOf Fact4 Is regle Then
  84.                                 Fact = CType(Fact4, regle)
  85.                                 If BF.Contains(Fact4.condition) Then
  86.                                     BR.suppRegle(Fact4)
  87.                                 End If
  88.                             End If
  89.                         Next
  90.                         Return Fact3.conclusion()
  91.                     End If
  92.                 Else
  93.                     For Each Fact5 In BR.EnsembleRegle
  94.                         If TypeOf Fact5 Is Faits Then
  95.                             BF = BF + ChainageArriere(BF, BR, F)
  96.  
  97.                         End If
  98.  
  99.                     Next
  100.                 End If
  101.  
  102.             Next
  103.  
  104.         End If
  105.  
  106.  
  107.     End Function
  108.  
  109.     Public Sub Main()
  110.         listFaits = New Collection
  111.  
  112.     End Sub
  113. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement