001package org.clafer.ast;
002
003import org.clafer.domain.Domain;
004
005/**
006 *
007 * @author jimmy
008 */
009public class JoinSetWithStringException extends AstException {
010
011    public JoinSetWithStringException(AstSetExpr expr, Domain card) {
012        super("Cannot join a non-singleton set with strings. For example:\n"
013                + "\n"
014                + "    A -> string 1..2\n"
015                + "    [ A.ref = \"abc\" ]\n"
016                + "\n"
017                + "The expression \"A\" evaluates to a set of size 1 or 2. The join is forbidden.\n"
018                + "\n"
019                + "    A -> string 1..1\n"
020                + "    [ A.ref = \"abc\" ]\n"
021                + "\n"
022                + "The expression \"A\" evaluates to a singleton of size 1. The join is permitted."
023                + "\n"
024                + "Problem compiling the expression:\n"
025                + "\n"
026                + "    " + expr + "\n"
027                + "\n"
028                + "The compiler infered a size of " + card.getLowBound() + " to " + card.getHighBound() + ".");
029    }
030}