WAConfiguration


Seaside-Configuration

Comment:



Hierarchy:

ProtoObject
Object
WAConfiguration

Summary:

methods:

instance class
accessing ancestry attributes initializing testing values as yet unclassified instance creation

Detail:

instance methods:

accessing
name

	^ self subclassResponsibility

ancestry
addAncestorsTo: tempCollection linearization: linearCollection

	(linearCollection includes: self)
		ifTrue: [tempCollection do: [:ea | linearCollection add: ea before: self].
				tempCollection removeAllSuchThat: [:ea | true]]
		ifFalse: [tempCollection add: self.
				self ancestors isEmpty
					ifTrue: [linearCollection addAll: tempCollection.
							tempCollection removeAllSuchThat: [:ea | true]]
					ifFalse: [self ancestors do: [:ea | ea addAncestorsTo: tempCollection linearization: linearCollection]]]
allAncestors

	| temp linear |
	temp _ OrderedCollection new.
	linear _ OrderedCollection new.
	self addAncestorsTo: temp linearization: linear.
	^ linear allButFirst asArray
allAncestorsDo: aBlock

	self allAncestors do: aBlock
allPotentialAncestors

	^ #()
ancestors

	^ #()
potentialAncestors

	^ self allPotentialAncestors reject: [:ea | ea = self or: [(self inheritsFrom: ea) or: [ea inheritsFrom: self]]]
withAllAncestorsDo: aBlock

	aBlock value: self.
	^ self allAncestorsDo: aBlock

attributes
allAttributes

	^ Array streamContents:
		[:s | 
		self withAllAncestorsDo: [:ea | s nextPutAll: ea attributes]]
attributeNamed: aSymbol

	^ self allAttributes
		detect: [:ea | ea key = aSymbol]
		ifNone: [self error: 'No attribute named ', aSymbol printString]
attributes

	^ #()
groupedAttributes

	| dict sorted |
	dict _ Dictionary new.
	sorted _ SortedCollection sortBlock: [:a :b | a key <= b key].
	self allAttributes do:
		[:ea |
		(dict at: ea group ifAbsentPut: [SortedCollection sortBlock: [:a :b | a key <= b key]])
			add: ea].
	dict associationsDo:
		[:assoc |
		sorted add: assoc].
	^ sorted
		

initializing
initialize
	

testing
hasAttributeNamed: aSymbol

	^ self allAttributes anySatisfy: [:ea | ea key = aSymbol]
hasLocalValueForAttribute: anAttribute

	self localValueAt: anAttribute key ifAbsent: [^ false].
	^ true
hasMutableAncestry

	^ false
inheritsFrom: aConfiguration

	^ self allAncestors anySatisfy: [:ea | ea = aConfiguration]
	
	
isDeletable

	^ false
isMutable

	^ false

values
attributesAndValuesDo: keyValueBlock

	^ self allAttributes do:
		[:ea |
		keyValueBlock value: ea value: (self valueForAttribute: ea)]
inheritedValueAndSourceAt: aSymbol do: aBlock

	self allAncestorsDo:
		[:ea |
		(ea localValueAt: aSymbol ifAbsent: [])
			ifNotNilDo: [:val | ^ aBlock value: val value: ea]].
	^ nil
localValueAt: aSymbol ifAbsent: absentBlock

	self subclassResponsibility
lookupValueAt: aSymbol

	^ self inheritedValueAndSourceAt: aSymbol do: [:value :source | value]
valueAt: aSymbol

	^ self localValueAt: aSymbol ifAbsent: [self lookupValueAt: aSymbol]
valueForAttribute: anAttribute

	^ self valueAt: anAttribute key

class methods:

as yet unclassified
readUserConfigurationsFrom: aStream

	| ini |
	ini _ INIFile readFrom: aStream.
	self registeredConfigurationsDo:
		[:config |
		(ini includesSection: config name) ifTrue:
			[config clear.
			(ini section: config name) associationsDo:
				[:assoc | assoc value ifNotNil:
					[(config hasAttributeNamed: assoc key)
						ifTrue: [config valueAt: assoc key put: assoc value]]]]]
writeUserConfigurationsOn: aStream

	| ini |
	ini _ INIFile new.
	self registry keysAndValuesDo:
		[:key :value | (ini section: key) addAll: value localValues].
	ini writeOn: aStream

instance creation
new

	^ self basicNew initialize

^top


- made by Dandelion -