Reworked Parameter Classifications
[Mograsim.git] / net.mograsim.machine / src / net / mograsim / machine / mi / parameters / ParameterClassification.java
1 package net.mograsim.machine.mi.parameters;
2
3 import net.mograsim.machine.mi.parameters.MicroInstructionParameter.ParameterType;
4
5 public interface ParameterClassification
6 {
7         /**
8          * Determines whether a {@link MicroInstructionParameter} is part of this class of parameters.
9          * @return true if the classification contains the Parameter, false otherwise
10          */
11         public default boolean conforms(MicroInstructionParameter param)
12         {
13                 return param.getType().equals(getExpectedType()) && param.getValue().width() == getExpectedBits();
14         }
15         
16         /**
17          * @return The type of the parameters in this classification.
18          */
19         public ParameterType getExpectedType();
20         
21         /**
22          * @return The number of bits of the parameters in this classification.
23          */
24         public int getExpectedBits();
25 }