package ua.ansymo.hintco

class ModelValidation {
	def static validate(HintConfiguration config){
		emptyHierarchicalUnits(config)
	}
	
	def static emptyHierarchicalUnits(HintConfiguration config) {
		if (config.eAllContents.filter(HierarchicalCosimUnit).exists[u | u.cosimunits.empty]){
			throw new RuntimeException("Hierarchical units must have child units.")
		}
	}
		
}
