Skip to content

pharo-containers/Containers-KeyedTree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Containers-KeyedTree

An implementation of KeyedTree

Build Status Coverage Status License Pharo version Pharo version

Example

To have an overview of the features this datastructure provide, have a look at the following code snippet (extracted from a unit test):

firstLevelOneSubTree := KeyedTree new.
firstLevelOneSubTree
	at: #two put: 'One-Two';
	at: #three put: 'One-Three'.
	
tree := KeyedTree new.
tree
	at: 1 put: firstLevelOneSubTree;
	at: 2 put: 'Two'.
	
self assert: (tree atPath: #(1)) equals: firstLevelOneSubTree.
self assert: (tree atPath: #(1 two)) equals: 'One-Two'.
self assert: (tree atPath: #(1 three)) equals: 'One-Three'.
self assert: (tree atPath: #(2)) equals: 'Two'.
self should: [ tree atPath: #(2 4) ] raise: self defaultTestError.
self should: [ tree atPath: #(1 two three) ] raise: self defaultTestError.
self should: [ tree atPath: #(3) ] raise: self defaultTestError

Loading

The following script installs Containers-Stack in Pharo.

Metacello new
	baseline: 'ContainersKeyedTree';
	repository: 'github://pharo-containers/Containers-KeyedTree:v1.0/src';
	load.

If you want to depend on it

Add the following code to your Metacello baseline or configuration

spec 
   baseline: 'ContainersKeyedTree' 
   with: [ spec repository: 'github://pharo-containers/Containers-KeyedTree:v1.0/src' ]