cyclus/core — Issue #54: Create a standardized Material resource store
Author: rwcarlsen
Created: 2012-03-06 17:14:38+00:00
State: open
Labels: Feature, Investigate, Module Development

Almost all facilities have code that revolves around "inventory" and "stocks" - much of it is duplicated between facilities. I propose that we create a MaterialStore helper class that provides the following behaviors (and maybe more):

* holding of some specifiable capacity material objects
* adding one or more material objects to be stored

- throws exception if addition would exceed capacity
- provide addPartial method that splits material if addition would exceed capacity and returns the remainder.

* retrieval of a specifiable mass of material objects - the store will automatically deal with necessary splitting.
* provide helper methods like remainingSpace(), storedMass(), materialCount(), etc.

Benefits:

* eliminate duplicated code (consolidation) - it would make it easier to keep models consistent and up to date with changing core
* eliminate duplicate test code - all models that used the MaterialStore would get the MaterialStore tests for 'free'
* make it possible to do more unit testing without exposing model internals - because MaterialStore will publicly expose many of those things/methods we want to test.

Thoughts?

@gidden, @katyhuff