home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / Ulli's_Sud2103312252008.psc / cRow.cls < prev    next >
Text File  |  2008-02-25  |  2KB  |  85 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "cGroup"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14. Option Explicit
  15.  
  16. '#####################################
  17. 'represents a row, a column or a block
  18. '#####################################
  19.  
  20. Private Bits(1 To 9)                As Long
  21. Private NotBits(1 To 9)             As Long
  22.  
  23. 'my propertie
  24. Private myAvailableValues(0 To 9)   As Boolean
  25. Private myPermitPattern             As Long
  26.  
  27. Friend Sub AddValue(ByVal Value As Long)
  28.  
  29.   'adds a value to the available values
  30.  
  31.     myAvailableValues(Value) = True
  32.     myPermitPattern = myPermitPattern Or Bits(Value)
  33.  
  34. End Sub
  35.  
  36. Friend Property Get Agree(ByVal Value As Long) As Boolean
  37.  
  38.   'returns true when Value is permissible in this group (row, a column or a block)
  39.  
  40.     Agree = myAvailableValues(Value)
  41.  
  42. End Property
  43.  
  44. Private Sub Class_Initialize()
  45.  
  46.   'sets all available values to true
  47.  
  48.   Dim i As Long
  49.  
  50.     myAvailableValues(0) = True
  51.     For i = 1 To 9
  52.         Bits(i) = 2 ^ i
  53.         NotBits(i) = Not Bits(i)
  54.         AddValue i
  55.     Next i
  56.  
  57. End Sub
  58.  
  59. Friend Property Get PermitPattern() As Long
  60.  
  61.   'returns myAvailableValues as binary
  62.  
  63.     PermitPattern = myPermitPattern
  64.  
  65. End Property
  66.  
  67. Friend Sub RemoveValue(ByVal Value As Long)
  68.  
  69.   'removes a value from the available values
  70.  
  71.     myAvailableValues(Value) = False
  72.     myPermitPattern = myPermitPattern And NotBits(Value)
  73.  
  74. End Sub
  75.  
  76. Friend Sub Reset()
  77.  
  78.     Class_Initialize
  79.  
  80. End Sub
  81.  
  82. ':) Ulli's VB Code Formatter V2.23.17 (2008-Feb-25 09:14)  Decl: 12  Code: 58  Total: 70 Lines
  83. ':) CommentOnly: 11 (15,7%)  Commented: 0 (0%)  Empty: 28 (40%)  Max Logic Depth: 2
  84. ':) Magic Number: 442372841
  85.