Skip to content

Commit

Permalink
Merge 664f446
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Oct 17, 2024
2 parents 3961064 + 664f446 commit 7ffcf8e
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ ManifestOpenPonkMarkovChains class >> ruleAnySatisfyRuleV1FalsePositive [
<ignoreForCoverage>
^ #(#(#(#RGMethodDefinition #(#OPMcPredictedSimulation #preconditions #false)) #'2023-07-13T11:24:22.815+02:00') )
]

{ #category : 'code-critics' }
ManifestOpenPonkMarkovChains class >> ruleSendsDifferentSuperRuleV1FalsePositive [

<ignoreForCoverage>
^ #(#(#(#RGMethodDefinition #(#OPMcTransition #represents: #false)) #'2024-10-17T13:25:59.228+02:00') )
]
4 changes: 2 additions & 2 deletions Pharo/OpenPonk-MarkovChains/OPMc.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ OPMc >> isTransition [
^ false
]

{ #category : 'testing' }
{ #category : 'accessing' }
OPMc >> states [
^ elements select: [ :each | each isState ]
]

{ #category : 'testing' }
{ #category : 'accessing' }
OPMc >> transitions [
^ elements select: [ :each | each isTransition ]
]
18 changes: 9 additions & 9 deletions Pharo/OpenPonk-MarkovChains/OPMcExamples.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ OPMcExamples class >> exampleMarkovWeather [
add: cloudy;
add: rainy.
mc addAll: {
(sunny -> sunny name: '0.6').
(sunny -> cloudy name: '0.3').
(sunny -> rainy name: '0.1').
(cloudy -> cloudy name: '0.3').
(cloudy -> sunny name: '0.2').
(cloudy -> rainy name: '0.5').
(rainy -> rainy name: '0.5').
(rainy -> sunny name: '0.4').
(rainy -> cloudy name: '0.1') }.
(sunny => sunny name: '0.6').
(sunny => cloudy name: '0.3').
(sunny => rainy name: '0.1').
(cloudy => cloudy name: '0.3').
(cloudy => sunny name: '0.2').
(cloudy => rainy name: '0.5').
(rainy => rainy name: '0.5').
(rainy => sunny name: '0.4').
(rainy => cloudy name: '0.1') }.
^ mc
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ Class {
}

{ #category : 'accessing' }
OPMcModelDeprecatedSerializer class >> fileExtension [
OPMcModelDeprecatedSerializer class >> fileExtensions [

^ #ston
^ #( #ston )
]

{ #category : 'as yet unclassified' }
Expand Down
4 changes: 2 additions & 2 deletions Pharo/OpenPonk-MarkovChains/OPMcModelSerializer.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ OPMcModelSerializer class >> exportVersion [
]

{ #category : 'accessing' }
OPMcModelSerializer class >> fileExtension [
OPMcModelSerializer class >> fileExtensions [

^ #xml
^ #( #xml )
]

{ #category : 'as yet unclassified' }
Expand Down
30 changes: 16 additions & 14 deletions Pharo/OpenPonk-MarkovChains/OPMcState.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,39 @@ Class {
#tag : 'Models'
}

{ #category : 'as yet unclassified' }
{ #category : 'accessing' }
OPMcState >> activations [
^ activationCount

^ activationCount
]

{ #category : 'as yet unclassified' }
{ #category : 'actions' }
OPMcState >> counterAdd [
activationCount
ifNotNil: [ activationCount := activationCount +1 ]
ifNil: [ activationCount := 0.
activationCount := activationCount + 1 ]

activationCount ifNil: [ ^ activationCount := 1 ].
activationCount := activationCount + 1
]

{ #category : 'as yet unclassified' }
{ #category : 'actions' }
OPMcState >> counterDecrement [
activationCount = 1 | (activationCount = 0)
ifFalse: [ activationCount := activationCount - 1 ]
ifTrue: [ activationCount := 0 ]

activationCount := activationCount < 2
ifTrue: [ 0 ]
ifFalse: [ activationCount - 1 ]
]

{ #category : 'as yet unclassified' }
{ #category : 'actions' }
OPMcState >> counterReset [

activationCount := 0
]

{ #category : 'as yet unclassified' }
{ #category : 'DynaCASE-FSM-GraphML-accessing' }
OPMcState >> graphmlType [
^ #regular
]

{ #category : 'as yet unclassified' }
{ #category : 'testing' }
OPMcState >> isNormal [
^ true
]
26 changes: 13 additions & 13 deletions Pharo/OpenPonk-MarkovChains/OPMcTransition.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -35,71 +35,71 @@ OPMcTransition >> = otherTransition [
and: [ otherTransition represents: self ] ]
]

{ #category : 'comparing' }
{ #category : 'converting' }
OPMcTransition >> asTransition [
^ self
]

{ #category : 'comparing' }
{ #category : 'removing' }
OPMcTransition >> detach [
super detach.
source := nil.
target := nil
]

{ #category : 'comparing' }
{ #category : 'initialization' }
OPMcTransition >> initialize [
super initialize.
matchBlock := [ :aValue | (self name splitOn: ',') includes: aValue asString ]
]

{ #category : 'comparing' }
{ #category : 'testing' }
OPMcTransition >> isState [
^ false
]

{ #category : 'comparing' }
{ #category : 'testing' }
OPMcTransition >> isTransition [
^ true
]

{ #category : 'comparing' }
{ #category : 'accessing' }
OPMcTransition >> matchBlock [
^ matchBlock
]

{ #category : 'comparing' }
{ #category : 'accessing' }
OPMcTransition >> matchBlock: aOneArgBlock [
matchBlock := aOneArgBlock.
self changed
]

{ #category : 'comparing' }
{ #category : 'testing' }
OPMcTransition >> matches: aValue [
^ matchBlock value: aValue
]

{ #category : 'comparing' }
{ #category : 'testing' }
OPMcTransition >> represents: otherTransition [
^ super = otherTransition
]

{ #category : 'comparing' }
{ #category : 'accessing' }
OPMcTransition >> source [
^ source
]

{ #category : 'comparing' }
{ #category : 'accessing' }
OPMcTransition >> source: aVertex [
source := aVertex
]

{ #category : 'comparing' }
{ #category : 'accessing' }
OPMcTransition >> target [
^ target
]

{ #category : 'comparing' }
{ #category : 'accessing' }
OPMcTransition >> target: aVertex [
target := aVertex
]
23 changes: 12 additions & 11 deletions Pharo/OpenPonk-MarkovChains/OPMcVertex.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,58 +7,59 @@ Class {
}

{ #category : 'associating' }
OPMcVertex >> -> aVertex [
OPMcVertex >> => aVertex [

^ OPMcTransition from: self to: aVertex
]

{ #category : 'associating' }
{ #category : 'DynaCASE-FSM-GraphML-accessing' }
OPMcVertex >> graphmlType [
^ self subclassResponsibility
]

{ #category : 'associating' }
{ #category : 'accessing' }
OPMcVertex >> incoming [
owner ifNil: [ ^ #() ].
^ owner transitions select: [ :each | each target = self ]
]

{ #category : 'associating' }
{ #category : 'testing' }
OPMcVertex >> isFinal [
^ false
]

{ #category : 'associating' }
{ #category : 'testing' }
OPMcVertex >> isInitial [
^ false
]

{ #category : 'associating' }
{ #category : 'testing' }
OPMcVertex >> isNormal [
^ false
]

{ #category : 'associating' }
{ #category : 'testing' }
OPMcVertex >> isState [
^ true
]

{ #category : 'associating' }
{ #category : 'testing' }
OPMcVertex >> isTransition [
^ false
]

{ #category : 'associating' }
{ #category : 'accessing' }
OPMcVertex >> outgoing [
owner ifNil: [ ^ #() ].
^ owner transitions select: [ :each | each source = self ]
]

{ #category : 'associating' }
{ #category : 'accessing' }
OPMcVertex >> relatedElements [
^ (self incoming , self outgoing) asSet asOrderedCollection
]

{ #category : 'associating' }
{ #category : 'removing' }
OPMcVertex >> removedFrom: aDiagram [
self
removedFrom: aDiagram
Expand Down

0 comments on commit 7ffcf8e

Please sign in to comment.