JavaSymbolicObject implements K, Transformable, Visitable { public PSet<Variable> variableSet() { if (variableSet == null) { if (isGround == null || !isGround) { new VariableSetFieldInitializer().visitNode(this); } else { variableSet = HashTreePSet.empty(); } } return variableSet; } protected  JavaSymbolicObject(); protected  JavaSymbolicObject(Source source, Location loc);  JavaSymbolicObject(Source source, Location loc, Att att);  JavaSymbolicObject(Att att); T substituteWithBinders(
            Map<Variable, ? extends Term> substitution); T substitute(
            Map<Variable, ? extends Term> substitution); T renameVariables(); PSet<Variable> variableSet(); boolean isGround(); boolean isNormal(); boolean isConcrete(); boolean isVariable(); Set<Term> userVariableSet(GlobalContext global); Att att(); Optional<Source> source(); Optional<Location> location(); Source getSource(); Location getLocation(); void copyAttributesFrom(JavaSymbolicObject variable); int computeHashCode(); int cachedHashCode(); void addAttribute(String key, String value); void setAttributes(Att att);  }
@Test public void testVariableSet() { Variable v1 = new Variable("foo", Sort.of(KORE.Sort("bar@FOO"))); assertEquals(Collections.singleton(v1), v1.variableSet()); assertEquals(Collections.singleton(v1), v1.variableSet); KItem k1 = new KItem(KLabelConstant.of(foo, definition), KList.EMPTY, globalContext, Sort.of(KORE.Sort("bar@FOO")), true); assertEquals(Collections.emptySet(), k1.variableSet()); assertEquals(Collections.emptySet(), k1.variableSet); assertEquals(Collections.emptySet(), k1.kLabel().variableSet); assertEquals(Collections.emptySet(), k1.kList().variableSet); Variable v2 = new Variable("bar", Sort.of(KORE.Sort("baz@FOO"))); KItem k2 = new KItem(KLabelConstant.of(foo, definition), v2, globalContext, Sort.of(KORE.Sort("bar@FOO")), true); assertEquals(Collections.singleton(v2), k2.variableSet()); assertEquals(Collections.singleton(v2), k2.variableSet); assertEquals(Collections.emptySet(), k2.kLabel().variableSet); assertEquals(Collections.singleton(v2), k2.kList().variableSet); Variable v3 = new Variable("baz", Sort.of(KORE.Sort("baz@FOO"))); KList list = (KList) KList.concatenate(v3, k2); KItem k3 = new KItem(KLabelConstant.of(foo, definition), list, globalContext, Sort.of(KORE.Sort("bar@FOO")), true); assertEquals(Sets.newHashSet(v2, v3), k3.variableSet()); assertEquals(Sets.newHashSet(v2, v3), k3.variableSet); assertEquals(Collections.emptySet(), k3.kLabel().variableSet); assertSame(list, k3.kList()); assertEquals(Sets.newHashSet(v2, v3), list.variableSet); assertSame(v3, list.get(0)); assertSame(k2, list.get(1)); assertEquals(Collections.singleton(v3), v3.variableSet); assertEquals(Collections.singleton(v2), k2.variableSet); assertEquals(Collections.emptySet(), k2.kLabel().variableSet); assertEquals(Collections.singleton(v2), k2.kList().variableSet); }