MCPcopy Create free account
hub / github.com/SoarGroup/Soar / IntWme

Class IntWme

Java/SMLJava/src/main/java/edu/umich/soar/IntWme.java:12–111  ·  view source on GitHub ↗

Wrapper for int valued working memory elements. @author voigtjr

Source from the content-addressed store, hash-verified

10 *
11 */
12public class IntWme implements Wme
13{
14 /**
15 * Create working memory element instance with no value. The value will be
16 * set (and underlying SML Wme created) on first update.
17 *
18 * @param parent
19 * Parent identifier
20 * @param attr
21 * Attribute
22 * @return Wme ready for update
23 */
24 public static IntWme newInstance(Identifier parent, String attr)
25 {
26 return new IntWme(parent, attr);
27 }
28
29 /**
30 * Create working memory element instance with known initial value.
31 *
32 * @param parent
33 * Parent identifier
34 * @param attr
35 * Attribute
36 * @param val
37 * Initial value
38 * @return Wme ready for update
39 */
40 public static IntWme newInstance(Identifier parent, String attr, long val)
41 {
42 IntWme temp = new IntWme(parent, attr);
43 temp.update(val);
44 return temp;
45 }
46
47 private final Identifier parent;
48
49 private final String attr;
50
51 private IntElement wme;
52
53 private IntWme(Identifier parent, String attr)
54 {
55 this.parent = parent;
56 this.attr = attr;
57 }
58
59 /**
60 * Update to possibly new value. See Agent.BlinkIfNoChange()
61 *
62 * @param val
63 * The new value
64 */
65 public void update(long val)
66 {
67 if (wme != null)
68 wme.Update(val);
69 else

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected