Package ai.domain

Examples of ai.domain.DomainException


      return other;
    if (other.isBottom())
      return this;
    //we require the same set of values!!
    if (!this.variableValues.keySet().equals(other.variableValues.keySet()))
      throw new DomainException("Join only allowed with the same variables!!, mine: "+this +", other:"+other);

    //join of values
    Map<Variable, DI> result = new HashMap<Variable, DI>();
    for(Map.Entry<Variable, DI> entry: variableValues.entrySet()) {
      Variable var = entry.getKey();
View Full Code Here


    return new NonRelationalDomain<DI>(result);
  }

  @Override
  public final NonRelationalDomain<DI> meet(NonRelationalDomain<DI> other) {
    throw new DomainException("Not implemented yet");
  }
View Full Code Here

    if (this.isBottom())
      return other;
    if (other.isBottom())
      return this;
    if (!this.variableValues.keySet().equals(other.variableValues.keySet()))
      throw new DomainException("Join only allowed with the same variables!!, mine: "+this +", other:"+other);

    Map<Variable, DI> result = new HashMap<Variable, DI>();
    for(Map.Entry<Variable, DI> entry: variableValues.entrySet()) {
      Variable var = entry.getKey();
      DI value = entry.getValue();     
View Full Code Here

    return variableValues.containsKey(variable);
  }

  public final DI getValueFor(Variable variable) {
    if (!variableValues.containsKey(variable))
      throw new DomainException("Cannot take value of not present variable '%s'", variable);
    return variableValues.get(variable);
  }
View Full Code Here

      return this.getBottom();
//      throw new DomainException("Bottom initial value??");
    if (variableValues.containsKey(name)) {
      if (ignoreIfExists)
        return this;
      throw new DomainException("Duplicate variable '%s'", name);
    }
    Map<Variable, DI> copy = new HashMap<Variable, DI>(variableValues);
    copy.put(name, initialValue);
    return new NonRelationalDomain<DI>(copy);
  }
View Full Code Here

 
  public final NonRelationalDomain<DI> updateVariable(Variable var, DI newValue) {
    if (isBottom())
      return this;
    if (!variableValues.containsKey(var))
      throw new DomainException("Missing variable: '%s'", var);
    if (newValue.isBottom())
      return getBottom();
    Map<Variable, DI> result = new HashMap<Variable, DI>(variableValues);
    result.put(var, newValue);
    return new NonRelationalDomain<DI>(result);
View Full Code Here

//  }
//
  public static long getIntegerValue(NumberLiteral node) {
    Object constant = node.resolveConstantExpressionValue();
    if (constant == null)
      throw new DomainException("Hmm");
    if (constant instanceof Integer)
      return (Integer) constant;
    if (constant instanceof Long)
      return (Long) constant;
    if (constant instanceof Short)
      return (Short) constant;
    if (constant instanceof Byte)
      return (Byte) constant;
    throw new DomainException("Unhandled number literal type '%s'(%s)", constant, constant.getClass());
  }
View Full Code Here

  }
 
  public static long getIntegerValue(CharacterLiteral node) {
    Object constant = node.resolveConstantExpressionValue();
    if (constant == null)
      throw new DomainException("Hmm");
    if (constant instanceof Character)
      return (Character) constant;
    throw new DomainException("Unhandled character literal type '%s'(%s)", constant, constant.getClass());
  }
View Full Code Here

  }

  public static boolean getBooleanValue(BooleanLiteral node) {
    Object constant = node.resolveConstantExpressionValue();
    if (constant == null)
      throw new DomainException("Hmm");
    if (constant instanceof Boolean)
      return (Boolean) constant;
    throw new DomainException("Unhandled boolean literal type '%s'(%s)", constant, constant.getClass());
  }
View Full Code Here

  }
 
  public static <DI extends DomainIntf<DI>> DI getValueForVariable(NonRelationalDomain<DI> di, Variable var) {
    if (di.containsValue(var))
      return di.getValueFor(var);
    throw new DomainException("Missing variable '%s': '%s'", var, di);
  }
View Full Code Here

TOP

Related Classes of ai.domain.DomainException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.