From 9a5e79dfd1c6829b052ab7cf0cb7a79afd25eb72 Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Tue, 29 Aug 2017 15:23:34 +0200 Subject: Should now load the model. --- instance-calculator/src/VHDLEntity.java | 54 +++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 16 deletions(-) (limited to 'instance-calculator/src/VHDLEntity.java') diff --git a/instance-calculator/src/VHDLEntity.java b/instance-calculator/src/VHDLEntity.java index 8059566..e5ab4eb 100644 --- a/instance-calculator/src/VHDLEntity.java +++ b/instance-calculator/src/VHDLEntity.java @@ -17,44 +17,66 @@ public class VHDLEntity } } - public static boolean handle_is_port_of - ( - final String pt_id, - final String e_id - ) + public static VHDLEntity get_from_id (final String id) { - /* TODO */ - return false; + final VHDLEntity result; + + result = FROM_ID.get(id); + + if (result == null) + { + System.err.println + ( + "[E] Element " + + id + + " is used like an entity, but is not declared as such before that" + + " use." + ); + + System.exit(-1); + } + + return result; } - public static boolean handle_is_architecture_of - ( - final String pt_id, - final String e_id - ) + public static VHDLEntity find (final String id) { - /* TODO */ - return false; + return FROM_ID.get(id); } /******************************************************************************/ private final Collection process_instances; private final Collection waveform_instances; - private final List ports; + private final Collection ports; private final String id; - private String architecture; + private VHDLArchitecture architecture; private VHDLEntity (final String id) { this.id = id; ports = new ArrayList(); + architecture = null; + this.process_instances = new ArrayList(); this.waveform_instances = new ArrayList(); } + public void add_port (final String pt) + { + if (!ports.contains(pt)) + { + ports.add(pt); + } + } + + public void set_architecture (final VHDLArchitecture arch) + { + architecture = arch; + } + public Collection get_process_instances () { return process_instances; -- cgit v1.2.3-70-g09d2