summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2017-07-21 11:06:12 +0200
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2017-07-21 11:06:12 +0200
commit878705688b42837b615067f0a479f31614910f38 (patch)
treed0d61b2f4f66baa638876f2d5641a6377979cdd1 /ast-to-instr/src/VHDLEntity.java
parentbee770032c7bf22eb897085f516f440a72dc3a9a (diff)
Optimization pass.
Diffstat (limited to 'ast-to-instr/src/VHDLEntity.java')
-rw-r--r--ast-to-instr/src/VHDLEntity.java41
1 files changed, 15 insertions, 26 deletions
diff --git a/ast-to-instr/src/VHDLEntity.java b/ast-to-instr/src/VHDLEntity.java
index 9ece7e0..81e1338 100644
--- a/ast-to-instr/src/VHDLEntity.java
+++ b/ast-to-instr/src/VHDLEntity.java
@@ -5,8 +5,7 @@ import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
-import java.util.ArrayList;
-import java.util.Collection;
+import java.util.Stack;
public class VHDLEntity extends ParsableXML
{
@@ -38,15 +37,15 @@ public class VHDLEntity extends ParsableXML
}
@Override
- public Collection<ParsableXML> parse ()
+ public void parse
+ (
+ final Stack<ParsableXML> waiting_list
+ )
throws XPathExpressionException
{
- final Collection<ParsableXML> result;
final String xml_id;
final IDs local_id;
- result = new ArrayList<ParsableXML>();
-
xml_id = XMLManager.get_attribute(xml_node, "id");
local_id = IDs.get_id_from_xml_id(xml_id, "entity");
@@ -67,10 +66,8 @@ public class VHDLEntity extends ParsableXML
handle_predicate_end_has_identifier(local_id);
/** Children ************************************************************/
- result.addAll(handle_child_ports(local_id));
- result.addAll(handle_child_generics(local_id));
-
- return result;
+ handle_child_ports(local_id, waiting_list);
+ handle_child_generics(local_id, waiting_list);
}
/***************************************************************************/
@@ -232,18 +229,16 @@ public class VHDLEntity extends ParsableXML
/***************************************************************************/
/** Children ***************************************************************/
/***************************************************************************/
- private Collection<ParsableXML> handle_child_ports
+ private void handle_child_ports
(
- final IDs local_id
+ final IDs local_id,
+ final Stack<ParsableXML> waiting_list
)
throws XPathExpressionException
{
- final Collection<ParsableXML> result;
final NodeList ports;
final int children_count;
- result = new ArrayList<ParsableXML>();
-
ports =
(NodeList) XPE_FIND_PORTS.evaluate
(
@@ -255,24 +250,20 @@ public class VHDLEntity extends ParsableXML
for (int i = 0; i < children_count; ++i)
{
- result.add(new VHDLPort(local_id, ports.item(i)));
+ waiting_list.push(new VHDLPort(local_id, ports.item(i)));
}
-
- return result;
}
- private Collection<ParsableXML> handle_child_generics
+ private void handle_child_generics
(
- final IDs local_id
+ final IDs local_id,
+ final Stack<ParsableXML> waiting_list
)
throws XPathExpressionException
{
- final Collection<ParsableXML> result;
final NodeList generics;
final int children_count;
- result = new ArrayList<ParsableXML>();
-
generics =
(NodeList) XPE_FIND_GENERICS.evaluate
(
@@ -284,9 +275,7 @@ public class VHDLEntity extends ParsableXML
for (int i = 0; i < children_count; ++i)
{
- result.add(new VHDLGeneric(local_id, generics.item(i)));
+ waiting_list.push(new VHDLGeneric(local_id, generics.item(i)));
}
-
- return result;
}
}