package de.dwslab.risk.gui.jgraphx.model;

import java.util.List;

public class Predicate {

    private final boolean negated;
    private final String name;
    private final List<String> types;

    public Predicate(String name, List<String> types) {
        this(false, name, types);
    }

    public Predicate(boolean negated, String name, List<String> types) {
        this.negated = negated;
        this.name = name;
        this.types = types;
    }

    public boolean isNegated() {
        return negated;
    }

    public String getName() {
        return name;
    }

    public List<String> getTypes() {
        return types;
    }

    @Override
    public String toString() {
        StringBuilder pred = new StringBuilder();
        if (negated) {
            pred.append("!");
        }
        pred.append(name + "(");

        for (int i = 0; i < types.size(); i++) {
            pred.append(types.get(i));
            if (i < (types.size() - 1)) {
                pred.append(", ");
            }
        }
        pred.append(")");

        return pred.toString();
    }

}

@@ -670,24 +670,916 @@
 ;%0D%0A    %7D%0D%0A%0D%0A
+    @Override%0D%0A    public int hashCode() %7B%0D%0A        final int prime = 31;%0D%0A        int result = 1;%0D%0A        result = prime * result + ((name == null) ? 0 : name.hashCode());%0D%0A        result = prime * result + (negated ? 1231 : 1237);%0D%0A        return result;%0D%0A    %7D%0D%0A%0D%0A    @Override%0D%0A    public boolean equals(Object obj) %7B%0D%0A        if (this == obj) %7B%0D%0A            return true;%0D%0A        %7D%0D%0A        if (obj == null) %7B%0D%0A            return false;%0D%0A        %7D%0D%0A        if (getClass() != obj.getClass()) %7B%0D%0A            return false;%0D%0A        %7D%0D%0A        Predicate other = (Predicate) obj;%0D%0A        if (name == null) %7B%0D%0A            if (other.name != null) %7B%0D%0A                return false;%0D%0A            %7D%0D%0A        %7D else if (!name.equals(other.name)) %7B%0D%0A            return false;%0D%0A        %7D%0D%0A        if (negated != other.negated) %7B%0D%0A            return false;%0D%0A        %7D%0D%0A        return true;%0D%0A    %7D%0D%0A%0D%0A
     @Overrid

Generate hashCode and equals