summaryrefslogtreecommitdiff
blob: b05f08c7e0e1808e2508dd2a5837f81a992e3c88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import org.w3c.dom.Node;

import java.util.ArrayList;
import java.util.List;

import javax.xml.xpath.XPathExpressionException;

public abstract class VHDLNode extends ParsableXML
{
   protected final IDs next_node;
   protected final int depth;
   protected final String[] attributes;
   protected final OutputFile output;

   public VHDLNode
   (
      final OutputFile output,
      final IDs parent_id,
      final Node xml_node,
      final IDs next_node,
      final int depth,
      final String[] attributes
   )
   {
      super(parent_id, xml_node);

      this.output = output;
      this.next_node = next_node;
      this.depth = depth;
      this.attributes = attributes;
   }

   protected void handle_read_expr_predicates
   (
      final IDs local_id,
      final Node expr_node
   )
   throws XPathExpressionException
   {
      final List<IDs> elements;
      final StringBuilder structure;
      final int elements_count;

      elements = new ArrayList<IDs>();
      structure = new StringBuilder();

      Expressions.process(elements, structure, expr_node);

      Predicates.add_entry
      (
         output,
         "is_read_structure",
         local_id,
         Strings.get_id_from_string
         (
            structure.toString()
         )
      );

      elements_count = elements.size();

      for (int i = 0; i < elements_count; ++i)
      {
         Predicates.add_entry
         (
            output,
            "is_read_element",
            local_id,
            Strings.get_id_from_string(Integer.toString(i)),
            elements.get(i)
         );
      }
   }

   protected void handle_written_expr_predicates
   (
      final IDs local_id,
      final Node expr_node
   )
   throws XPathExpressionException
   {
      final List<IDs> elements;
      final StringBuilder structure;
      final int elements_count;

      elements = new ArrayList<IDs>();
      structure = new StringBuilder();

      Expressions.process(elements, structure, expr_node);

      Predicates.add_entry
      (
         output,
         "is_written_structure",
         local_id,
         Strings.get_id_from_string
         (
            structure.toString()
         )
      );

      elements_count = elements.size();

      for (int i = 0; i < elements_count; ++i)
      {
         Predicates.add_entry
         (
            output,
            "is_written_element",
            local_id,
            Strings.get_id_from_string(Integer.toString(i)),
            elements.get(i)
         );
      }
   }
}