Fixed a bug in Am2900; created dlatch8/80; relayouted some components
[Mograsim.git] / net.mograsim.machine / src / net / mograsim / machine / isa / AsmInstruction.java
1 package net.mograsim.machine.isa;
2
3 import java.util.Objects;
4
5 public final class AsmInstruction implements AsmElement
6 {
7         private final AsmOperation operation;
8         private final AsmOperands operands;
9
10         public AsmInstruction(AsmOperation operation, AsmOperands operands)
11         {
12                 this.operation = Objects.requireNonNull(operation);
13                 this.operands = Objects.requireNonNull(operands);
14         }
15
16         @Override
17         public int hashCode()
18         {
19                 return Objects.hash(operands, operation);
20         }
21
22         @Override
23         public boolean equals(Object obj)
24         {
25                 if (this == obj)
26                         return true;
27                 if (!(obj instanceof AsmInstruction))
28                         return false;
29                 AsmInstruction other = (AsmInstruction) obj;
30                 return Objects.equals(operands, other.operands) && Objects.equals(operation, other.operation);
31         }
32
33         @Override
34         public String toString()
35         {
36                 return String.format("%s %s", operation, operands).trim();
37         }
38
39 }