Mercurial > hg > Members > kono > jpf-core
comparison src/main/gov/nasa/jpf/util/event/Event.java @ 2:b920e6b1be83
second part of the jpf-statechart motivated event interface overhaul, providing dynamic (context specific) expansion of EventTrees from within EventChoiceGenerators. This adds a EventContext mechanism that can replace events on-the-fly during advance() (e.g. expand wildcard patterns)
this also included the refined 'vm.extend.transitions' property, which is now a list of TypeSpecs (glob notation plus bounds) for CG types that should be subject to transition extension. We also support CheckExtendTransition attrs for CGs, which can be used to dynamically mark CGs. Note that each matching CG is still tested for non-rescheduling single choices
small Type/FeatureSpec extension to make it applicable to java.lang.Class instances. There is no reason why we can't make use of this for native types
author | Peter Mehlitz <Peter.C.Mehlitz@nasa.gov> |
---|---|
date | Sat, 24 Jan 2015 18:19:08 -0800 |
parents | f6886b2bda4a |
children | 8de43b2b023f |
comparison
equal
deleted
inserted
replaced
1:f6886b2bda4a | 2:b920e6b1be83 |
---|---|
108 | 108 |
109 if (prev != null) { | 109 if (prev != null) { |
110 e.setPrev(prev); | 110 e.setPrev(prev); |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 public void setLinksFrom (Event other){ | |
115 prev = other.prev; | |
116 next = other.next; | |
117 alt = other.alt; | |
118 } | |
119 | |
120 public Event replaceWithSequenceFrom (List<Event> list){ | |
121 Event eLast = null; | |
122 | |
123 for (Event e: list){ | |
124 if (eLast == null){ | |
125 e.prev = prev; | |
126 e.alt = alt; | |
127 } else { | |
128 e.prev = eLast; | |
129 eLast.next = e; | |
130 } | |
131 | |
132 eLast = e; | |
133 } | |
134 | |
135 if (eLast != null){ | |
136 eLast.next = next; | |
137 return list.get(0); | |
138 } else { | |
139 return null; | |
140 } | |
141 } | |
142 | |
143 public Event replaceWithAlternativesFrom (List<Event> list){ | |
144 Event eLast = null; | |
145 for (Event e: list){ | |
146 e.prev = prev; | |
147 e.next = next; | |
148 | |
149 if (eLast != null){ | |
150 eLast.alt = e; | |
151 } | |
152 | |
153 eLast = e; | |
154 } | |
155 | |
156 if (eLast != null){ | |
157 eLast.alt = alt; | |
158 return list.get(0); | |
159 } else { | |
160 return null; | |
161 } | |
162 } | |
163 | |
164 public Event replaceWith (Event e){ | |
165 e.prev = prev; | |
166 e.next = next; | |
167 e.alt = alt; | |
168 | |
169 return e; | |
170 } | |
171 | |
114 protected void setSource (Object source){ | 172 protected void setSource (Object source){ |
115 this.source = source; | 173 this.source = source; |
116 } | 174 } |
117 | 175 |
118 public int getNumberOfAlternatives(){ | 176 public int getNumberOfAlternatives(){ |
545 } | 603 } |
546 | 604 |
547 public boolean isNoEvent(){ | 605 public boolean isNoEvent(){ |
548 return false; | 606 return false; |
549 } | 607 } |
608 | |
609 //--- generic processing interface | |
610 | |
611 public void process(){ | |
612 // can be overridden by subclass if instance has sufficient context info | |
613 } | |
614 | |
615 public void setProcessed(){ | |
616 // can be overridden by subclass, e.g. to maintain event caches | |
617 } | |
550 } | 618 } |