diff --git a/src/Flow-Core/CDBlockObjectVisitor.class.st b/src/Flow-Core/CDBlockObjectVisitor.class.st index c62f76f..efe0bc7 100644 --- a/src/Flow-Core/CDBlockObjectVisitor.class.st +++ b/src/Flow-Core/CDBlockObjectVisitor.class.st @@ -127,27 +127,6 @@ CDBlockObjectVisitor >> visitAction: anAction [ self visit: anAction outgoing ] ] -{ #category : #visiting } -CDBlockObjectVisitor >> visitCondition: aCondition [ - | condition yes no previous | - condition := self dimensionAt: aCondition. - yes := self dimensionAt: aCondition yes. - no := self dimensionAt: aCondition no. - previous := self dimensionAt: aCondition incoming. - self - position: yes rightOf: condition strength: ClStrength strong; - position: yes middleOf: condition strength: ClStrength strong; - position: no under: condition strength: ClStrength strong; - position: no centerOf: condition strength: ClStrength strong; - position: condition under: previous strength: ClStrength strong. - - edges add: (aCondition -> (aCondition yes)). - edges add: (aCondition -> (aCondition no)). - - self visit: aCondition yes. - self visit: aCondition no. -] - { #category : #visiting } CDBlockObjectVisitor >> visitEnd: anEndState [ | end previous | @@ -162,6 +141,27 @@ CDBlockObjectVisitor >> visitEnd: anEndState [ " ] +{ #category : #visiting } +CDBlockObjectVisitor >> visitFork: aFork [ + | condition firstBranch secondBranch previous | + condition := self dimensionAt: aFork. + firstBranch := self dimensionAt: aFork firstBranch. + secondBranch := self dimensionAt: aFork secondBranch. + previous := self dimensionAt: aFork incoming. + self + position: firstBranch rightOf: condition strength: ClStrength strong; + position: firstBranch middleOf: condition strength: ClStrength strong; + position: secondBranch under: condition strength: ClStrength strong; + position: secondBranch centerOf: condition strength: ClStrength strong; + position: condition under: previous strength: ClStrength strong. + + edges add: (aFork -> (aFork firstBranch)). + edges add: (aFork -> (aFork secondBranch)). + + self visit: aFork firstBranch. + self visit: aFork secondBranch. +] + { #category : #visiting } CDBlockObjectVisitor >> visitStartState: aStartState [ | start next | diff --git a/src/Flow-Core/CDCodeModelBuilder.class.st b/src/Flow-Core/CDCodeModelBuilder.class.st index 348ddd3..8a9957c 100644 --- a/src/Flow-Core/CDCodeModelBuilder.class.st +++ b/src/Flow-Core/CDCodeModelBuilder.class.st @@ -12,11 +12,6 @@ CDCodeModelBuilder >> model [ ^ startState ] -{ #category : #'as yet unclassified' } -CDCodeModelBuilder >> resolve: flowName no: aCollection [ - ^ self resolve: flowName outgoing: aCollection -] - { #category : #'as yet unclassified' } CDCodeModelBuilder >> resolve: aString outgoing: aCollection [ | method pragma state | @@ -31,11 +26,6 @@ CDCodeModelBuilder >> resolve: aString outgoing: aCollection [ builder: self ] -{ #category : #'as yet unclassified' } -CDCodeModelBuilder >> resolve: flowName yes: aCollection [ - ^ self resolve: flowName outgoing: aCollection -] - { #category : #'as yet unclassified' } CDCodeModelBuilder >> resolveMethod: aCollection [ | targetClass | diff --git a/src/Flow-Core/CDDecision.class.st b/src/Flow-Core/CDDecision.class.st index 2c0c11f..1c05647 100644 --- a/src/Flow-Core/CDDecision.class.st +++ b/src/Flow-Core/CDDecision.class.st @@ -1,10 +1,6 @@ Class { #name : #CDDecision, - #superclass : #CDBlockObject, - #instVars : [ - 'yes', - 'no' - ], + #superclass : #CDTransitionFork, #category : #'Flow-Core' } @@ -13,28 +9,9 @@ CDDecision class >> stateObjectName [ ^ #decision ] -{ #category : #visiting } -CDDecision >> acceptStateVisitor: aStateObjectVisitor [ - ^ aStateObjectVisitor visitCondition: self -] - { #category : #accessing } CDDecision >> no [ - ^ no -] - -{ #category : #accessing } -CDDecision >> no: anObject [ - anObject incoming: self. - no := anObject -] - -{ #category : #'as yet unclassified' } -CDDecision >> resolve: flowName in: aCollection builder: aBuilder [ - yes := aBuilder resolve: flowName yes: (aCollection first: 2). - yes incoming: self. - no := aBuilder resolve: flowName no: (aCollection last: 2). - no incoming: self + ^ secondBranch ] { #category : #accessing } @@ -57,11 +34,5 @@ CDDecision >> shape [ { #category : #accessing } CDDecision >> yes [ - ^ yes -] - -{ #category : #accessing } -CDDecision >> yes: anObject [ - anObject incoming: self. - yes := anObject + ^ firstBranch ] diff --git a/src/Flow-Core/CDTransitionFork.class.st b/src/Flow-Core/CDTransitionFork.class.st new file mode 100644 index 0000000..0d69433 --- /dev/null +++ b/src/Flow-Core/CDTransitionFork.class.st @@ -0,0 +1,67 @@ +Class { + #name : #CDTransitionFork, + #superclass : #CDBlockObject, + #instVars : [ + 'firstBranch', + 'secondBranch' + ], + #category : #'Flow-Core' +} + +{ #category : #'as yet unclassified' } +CDTransitionFork class >> stateObjectName [ + ^ #transitionFork +] + +{ #category : #visiting } +CDTransitionFork >> acceptStateVisitor: aStateObjectVisitor [ + ^ aStateObjectVisitor visitFork: self +] + +{ #category : #accessing } +CDTransitionFork >> firstBranch [ + ^ firstBranch +] + +{ #category : #accessing } +CDTransitionFork >> firstBranch: anObject [ + anObject incoming: self. + firstBranch := anObject +] + +{ #category : #visiting } +CDTransitionFork >> resolveFrom: aPragma in: aCollection builder: aBuilder [ + firstBranch := aBuilder resolveFrom: aPragma outgoing: (aCollection first: 2). + firstBranch incoming: self. + secondBranch := aBuilder resolveFrom: aPragma outgoing: (aCollection last: 2). + secondBranch incoming: self +] + +{ #category : #accessing } +CDTransitionFork >> secondBranch [ + ^ secondBranch +] + +{ #category : #accessing } +CDTransitionFork >> secondBranch: anObject [ + anObject incoming: self. + secondBranch := anObject +] + +{ #category : #'as yet unclassified' } +CDTransitionFork >> shape [ +| shapeBuilder labelShape | + shapeBuilder := RSMultilineLabelBuilder new. + shapeBuilder labelShape + fontSize: self fontSize. + labelShape := (shapeBuilder shapeFor: label). + + ^ RSComposite new + model: self; + shapes: { + RSShapeFactory rectangle + extent: (Point x: labelShape width + 20 y: 150); + border: self border; + color: #lightYellow. + labelShape} +]