GDBMAContainer.st
changeset 126 fb73b0af430b
parent 91 472a4841a8b6
child 153 dd55019f1d86
equal deleted inserted replaced
125:3d43348d694e 126:fb73b0af430b
    98         description := Magritte::MANumberDescription new
    98         description := Magritte::MANumberDescription new
    99     ] ifFalse:[
    99     ] ifFalse:[
   100     class == String ifTrue:[ 
   100     class == String ifTrue:[ 
   101         description := Magritte::MAStringDescription new
   101         description := Magritte::MAStringDescription new
   102     ] ifFalse:[
   102     ] ifFalse:[
       
   103     class == ByteArray ifTrue:[ 
       
   104         description :=GDBMAByteArrayDescription new        
       
   105     ] ifFalse:[
   103         description := class description. 
   106         description := class description. 
   104     ]]].
   107     ]]]].
   105     description accessor: (GDBMAPropertyAccessor forPropertyNamed: property).
   108     description accessor: (GDBMAPropertyAccessor forPropertyNamed: property).
   106 
   109 
   107     self add: description.
   110     self add: description.
   108     ^ description
   111     ^ description
   109 
   112 
   110     "Created: / 23-09-2014 / 22:20:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   113     "Created: / 23-09-2014 / 22:20:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   111     "Modified: / 12-11-2017 / 17:20:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   114     "Modified: / 22-06-2018 / 11:20:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   112 !
   115 !
   113 
   116 
   114 define: property as: cclass of: class
   117 define: property as: collectionClass of: elementClass
   115     "/ Handle primitive types furst...
   118     "/ Handle primitive types first...
   116 
   119 
   117     | description |
   120     | description |
   118 
   121 
   119     class == Boolean ifTrue:[ 
   122     elementClass == Boolean ifTrue:[ 
   120         description := Magritte::MAToManyScalarRelationDescription new.
   123         description := Magritte::MAToManyScalarRelationDescription new.
   121         description reference: Magritte::MABooleanDescription new.      
   124         description reference: Magritte::MABooleanDescription new.      
   122     ] ifFalse:[
   125     ] ifFalse:[
   123     class == Integer ifTrue:[ 
   126     elementClass == Integer ifTrue:[ 
   124         description := Magritte::MAToManyScalarRelationDescription new.
   127         description := Magritte::MAToManyScalarRelationDescription new.
   125         description reference: Magritte::MANumberDescription new.
   128         description reference: Magritte::MANumberDescription new.
   126     ] ifFalse:[
   129     ] ifFalse:[
   127     class == String ifTrue:[
   130     elementClass == String ifTrue:[
   128         description := Magritte::MAToManyScalarRelationDescription new.
   131         description := Magritte::MAToManyScalarRelationDescription new.
   129         description reference: Magritte::MAStringDescription new.
   132         description reference: Magritte::MAStringDescription new.
   130     ] ifFalse:[
   133     ] ifFalse:[
       
   134     elementClass == ByteArray ifTrue:[
       
   135         description := Magritte::MAToManyScalarRelationDescription new.
       
   136         description reference: GDBMAByteArrayDescription new.     
       
   137     ] ifFalse:[
   131         description := Magritte::MAToManyRelationDescription new.
   138         description := Magritte::MAToManyRelationDescription new.
   132         description reference: class description.
   139         description reference: elementClass description.
   133     ]]].
   140     ]]]].
   134     description accessor: (GDBMAPropertyAccessor forPropertyNamed: property).       
   141     description accessor: (GDBMAPropertyAccessor forPropertyNamed: property).       
   135     description classes: (Array with: class).
   142     description classes: (Array with: elementClass).
   136     description ordered: (cclass inheritsFrom: SequenceableCollection).
   143     description ordered: (collectionClass inheritsFrom: SequenceableCollection).
   137 
   144 
   138     self add: description.
   145     self add: description.
   139     ^ description.
   146     ^ description.
   140 
   147 
   141     "Created: / 23-09-2014 / 22:54:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   148     "Created: / 23-09-2014 / 22:54:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   142     "Modified: / 12-11-2017 / 17:19:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   149     "Modified: / 22-06-2018 / 11:20:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   150     "Modified (comment): / 03-07-2018 / 16:10:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   151 !
       
   152 
       
   153 define: property as: collectionClass of: elementClass1 whenTaggedBy: tag1 or: elementClass2 whenTaggedBy: tag2 
       
   154     "/ Handle primitive types first...
       
   155 
       
   156     | description |
       
   157 
       
   158     description := Magritte::MAToManyRelationDescription new.
       
   159     description reference: (
       
   160         GDBMADescriptionSwitch 
       
   161             forTag: tag1 use: elementClass1 description 
       
   162             forTag: tag2 use: elementClass2 description 
       
   163     ).
       
   164     description classes: (Array with: elementClass1 with: elementClass2).
       
   165     description accessor: (GDBMAPropertyAccessor forPropertyNamed: property).       
       
   166     description ordered: (collectionClass inheritsFrom: SequenceableCollection).
       
   167 
       
   168     self add: description.
       
   169     ^ description.
       
   170 
       
   171     "Created: / 03-07-2018 / 17:10:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   143 ! !
   172 ! !
   144 
   173 
   145 !GDBMAContainer methodsFor:'parsing-GDB/MI'!
   174 !GDBMAContainer methodsFor:'parsing-GDB/MI'!
   146 
   175 
   147 parseUsingGDBMIParser:aGDBMIParser
   176 parseUsingGDBMIParser:aGDBMIParser