Assume I have a routine which takes an enumeration value as an argument and returns a Boolean ... and I want to check a set of those enumeration values to see if they are all true. Is there a idiomatic way to do it. This was my "old school" attempt which seems non-scala-ish:
def allUnitQueuesEmpty(): Boolean =
( getQueue(QID.CPU).isEmpty() &&
getQueue(QID.L1C_I).isEmpty() &&
getQueue(QID.L1D_I).isEmpty() &&
getQueue(QID.L1VC_I).isEmpty() &&
getQueue(QID.L1C_D).isEmpty() &&
getQueue(QID.L1D_D).isEmpty() &&
getQueue(QID.L1VC_D).isEmpty() &&
getQueue(QID.L1WB_D).isEmpty() &&
getQueue(QID.L2C).isEmpty() &&
getQueue(QID.L2WB).isEmpty() &&
getQueue(QID.MEM_RD).isEmpty() &&
getQueue(QID.MEM_WRT).isEmpty() );
Can this be done with a List?
-Jay