From 35e6857fb09b006da9f8cc3f59f239f078cc69a1 Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Tue, 29 Aug 2017 13:54:43 +0200 Subject: Still working on the implementation. --- instance-calculator/src/VHDLWaveform.java | 99 +++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 instance-calculator/src/VHDLWaveform.java (limited to 'instance-calculator/src/VHDLWaveform.java') diff --git a/instance-calculator/src/VHDLWaveform.java b/instance-calculator/src/VHDLWaveform.java new file mode 100644 index 0000000..83b9626 --- /dev/null +++ b/instance-calculator/src/VHDLWaveform.java @@ -0,0 +1,99 @@ +import java.util.*; + +public class VHDLWaveform +{ + private static final Map FROM_ID; + + static + { + FROM_ID = new HashMap(); + } + + public static void add_element (final String id) + { + if (!FROM_ID.containsKey(id)) + { + FROM_ID.put(id, new VHDLWaveform(id)); + } + } + + public static VHDLWaveform get_from_id (final String id) + { + return FROM_ID.get(id); + } + + public static boolean handle_is_accessed_by + ( + final String wfm_id, + final String ps_id + ) + { + /* TODO */ + return false; + } + +/******************************************************************************/ + private final Collection accessed_wfm; + private final Collection instances; + private final String id; + private int instances_count; + + private VHDLWaveform (final String id) + { + this.id = id; + accessed_wfm = new ArrayList(); + instances = new ArrayList(); + instances_count = 0; + } + + public VHDLWaveform.Instance add_instance + ( + final VHDLEntity visibility + ) + { + final VHDLWaveform.Instance result; + + result = + new VHDLWaveform.Instance + ( + Instances.get_id_for(instances_count), + this, + visibility + ); + + instances.add(result); + + instances_count += 1; + + return result; + } + + public String get_id () + { + return id; + } + + public static class Instance + { + private final String id; + private final VHDLWaveform parent; + private final VHDLEntity visibility; + + private Instance + ( + final String id, + final VHDLWaveform parent, + final VHDLEntity visibility + ) + { + this.id = id; + this.parent = parent; + this.visibility = visibility; + } + + public VHDLWaveform get_parent () + { + return parent; + } + } +} -- cgit v1.2.3-70-g09d2