<commit_before>Class {
	#name : #RTSpringLayoutStepping,
	#superclass : #RTAnimation,
	#instVars : [
		'view',
		'layout',
		'afterBlock'
	],
	#category : #'Roassal2-Animation'
}

{ #category : #updating }
RTSpringLayoutStepping >> addEdge: anEdge [
	layout addEdge: anEdge
]

{ #category : #updating }
RTSpringLayoutStepping >> addEdges: someEdges [
	layout addEdges: someEdges

]

{ #category : #updating }
RTSpringLayoutStepping >> addNode: anElement [
	"Designate the collection of elements that have to be layouted"
	layout 
		addNodes: (Array with: anElement)
]

{ #category : #updating }
RTSpringLayoutStepping >> addNodes: someElements [
	"Designate the collection of elements that have to be layouted"
	layout 
		addNodes: someElements
]

{ #category : #'public-configuration' }
RTSpringLayoutStepping >> addStartStopButton [

	view canvas addMenu: 'Toggle Animation' callback: [
		(view canvas hasAnimation: self)
			ifTrue: [ view canvas removeAnimation: self ]
			ifFalse: [ view canvas addAnimation: self ] ]
]

{ #category : #accessing }
RTSpringLayoutStepping >> afterBlock: aBlock [
	"Set a block to be evaluated at each refresh"
	"Block could be [ view canvas camera focusOnCenter ]"
	afterBlock := aBlock
]

{ #category : #testing }
RTSpringLayoutStepping >> hasCompleted [
	^ false
]

{ #category : #initialization }
RTSpringLayoutStepping >> initialize [
	super initialize.
	layout := RTForceBasedLayout new.
	afterBlock := [ ]
]

{ #category : #accessing }
RTSpringLayoutStepping >> layout [
	^ layout
]

{ #category : #accessing }
RTSpringLayoutStepping >> layout: aForceBasedLayout [
	"Set an instance of the class RTForceBasedLayout. 
	This is useful in case the layout is initialized from outside"
	layout := aForceBasedLayout.
	view ifNotNil: 
		[ self prepareLayoutFor: view ]
]

{ #category : #accessing }
RTSpringLayoutStepping >> nodes [
	^ layout nodes<commit_msg>Slight improvement of the force based layout<commit_after>Class {
	#name : #RTSpringLayoutStepping,
	#superclass : #RTAnimation,
	#instVars : [
		'view',
		'layout',
		'afterBlock'
	],
	#category : #'Roassal2-Animation'
}

{ #category : #updating }
RTSpringLayoutStepping >> addEdge: anEdge [
	layout addEdge: anEdge
]

{ #category : #updating }
RTSpringLayoutStepping >> addEdges: someEdges [
	layout addEdges: someEdges

]

{ #category : #updating }
RTSpringLayoutStepping >> addNode: anElement [
	"Designate the collection of elements that have to be layouted"
	layout 
		addNodes: (Array with: anElement)
]

{ #category : #updating }
RTSpringLayoutStepping >> addNodes: someElements [
	"Designate the collection of elements that have to be layouted"
	layout 
		addNodes: someElements
]

{ #category : #'public-configuration' }
RTSpringLayoutStepping >> addStartStopButton [

	view canvas addMenu: 'Toggle Animation' callback: [
		(view canvas hasAnimation: self)
			ifTrue: [ view canvas removeAnimation: self ]
			ifFalse: [ view canvas addAnimation: self ] ]
]

{ #category : #accessing }
RTSpringLayoutStepping >> afterBlock: aBlock [
	"Set a block to be evaluated at each refresh"
	"Block could be [ view canvas camera focusOnCenter ]"
	afterBlock := aBlock
]

{ #category : #testing }
RTSpringLayoutStepping >> hasCompleted [
	^ false
]

{ #category : #initialization }
RTSpringLayoutStepping >> initialize [
	super initialize.
	layout := RTForceBasedLayout new.
	afterBlock := [ ]
]

{ #category : #accessing }
RTSpringLayoutStepping >> layout [
	^ layout
]

{ #category : #accessing }
RTSpringLayoutStepping >> layout: aForceBasedLayout [
	"Set an instance of the class RTForceBasedLayout. 
	This is useful in case the layout is initialized from outside"
	self layoutWithoutPreparing: aForceBasedLayout.
	view ifNotNil: 
		[ self prepareLayoutFor: view ]
]

{ #category : #accessing }
RTSpringLayoutStepping >> layoutWithoutPreparing: aForceBasedLayout [
	"Set an instance of the class RTForceBasedLayout. 
	This is useful in case the layout is initialized from outside"
	layout := aForceBasedLayout.

]

{ #category : #accessing }
RTSpringLayoutStepping >> nodes [
	^ layout nodes
{'fraction_non_alphanumeric': 0.09958404697822364, 'fraction_numerical': 0.0004893564962074871, 'mean_word_length': 4.831669044222539, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1779513', 'n_tokens_mistral': 1290, 'n_tokens_neox': 1252, 'n_words': 367}