Skip to content

Instantly share code, notes, and snippets.

@joshcough
Created December 9, 2013 17:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshcough/7876464 to your computer and use it in GitHub Desktop.
Save joshcough/7876464 to your computer and use it in GitHub Desktop.
def smPrimitives(c: CharacteristicRule): List[DataItemID] = c match {
case Not(r) => smPrimitives(r)
case And(r1, r2) => smPrimitives(r1) ++ smPrimitives(r2)
case Orr(r1, r2) => smPrimitives(r1) ++ smPrimitives(r2)
case SimpleCharacteristicRule(ce) => ce match {
case GroupComparison(lhs, _, rhs) => List(lhs)
case _ => Nil
}
}
case def smPrimitives(c: CharacteristicRule): List[DataItemID] = {
Not(r) => smPrimitives(r)
And(r1, r2) => smPrimitives(r1) ++ smPrimitives(r2)
Orr(r1, r2) => smPrimitives(r1) ++ smPrimitives(r2)
SimpleCharacteristicRule(ce) => ce match {
case GroupComparison(lhs, _, rhs) => List(lhs)
case _ => Nil
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment