Code example for Multiset

Methods: add

0
 
    private VariableOccurrencesCounter() { } 
 
    @Override 
    public void visit(Variable variable) {
        variables.add(variable);
    } 
 
    public static Multiset<Variable> count(Term term) {
        VariableOccurrencesCounter counter = new VariableOccurrencesCounter();
        term.accept(counter);
        return counter.variables;
    } 
}