1 package net.mograsim.logic.model.verilog.model;
3 import java.util.HashSet;
5 import java.util.Objects;
8 public class VerilogComponentDeclaration
10 private final String id;
11 private final List<IOPort> ioPorts;
13 public VerilogComponentDeclaration(String id, List<IOPort> ioPorts)
15 this.id = Objects.requireNonNull(id);
16 this.ioPorts = List.copyOf(ioPorts);
23 Set<String> usedNames = new HashSet<>();
25 for (IOPort ioPort : ioPorts)
26 if (!usedNames.add(ioPort.getName()))
27 throw new IllegalArgumentException("Name occurs twice: " + ioPort.getName());
35 public List<IOPort> getIOPorts()
45 result = prime * result + ((ioPorts == null) ? 0 : ioPorts.hashCode());
46 result = prime * result + ((id == null) ? 0 : id.hashCode());
51 public String toString()
53 return id + "[" + ioPorts.size() + "]";
57 public boolean equals(Object obj)
63 if (getClass() != obj.getClass())
65 VerilogComponentDeclaration other = (VerilogComponentDeclaration) obj;
68 if (other.ioPorts != null)
70 } else if (!ioPorts.equals(other.ioPorts))
76 } else if (!id.equals(other.id))