Exemple #1
0
 /**
  * Gets the string representation of this variable, providing the string representation of the
  * linked term in the case of bound variable
  */
 public String toStringFlattened() {
   Term tt = getTerm();
   if (name != null) {
     if (tt == this) {
       return completeName;
     } else {
       return tt.toString();
     }
   } else {
     if (tt == this) {
       return ANY + hashCode();
     } else {
       return tt.toString();
     }
   }
 }
Exemple #2
0
 public String toString(QueryFormatter f) {
   String ret = "";
   for (Term t : terms()) {
     if (!ret.isEmpty()) ret += " " + getOp() + " ";
     ret += t.toString(f);
   }
   return (terms().size() > 1 ? "(" + ret + ")" : ret);
 }
Exemple #3
0
 /** return content as string array */
 public String[] toStringArray() {
   if (iContent.size() == 1 && iContent.get(0).toString().length() == 0) return new String[] {};
   String[] ret = new String[iContent.size()];
   for (int i = 0; i < ret.length; i++) {
     Term t = elementAt(i);
     ret[i] = (t.getText().length() > 0 ? t.toString() : t.elementAt(0).toString());
   }
   return ret;
 }
 @Override
 protected String derivativeBase(int order) {
   if (order < 0) {
     throw new IllegalArgumentException(UNSUPPORTED_DERIVATIVE_ORDER_MESSAGE);
   }
   Term derived = this;
   for (int i = 0; i < order; ++i) {
     derived = derived.derivative();
   }
   return derived.toString();
 }
  private static MultiList<Object, Set<Constant>> partitionExchangeable_impl(
      Iterable<DefaultRule> rules) {
    MultiMap<Term, Term> partitioning = new MultiMap<Term, Term>();

    List<Term> constants = Sugar.arrayListFromCollections(constants(rules));
    Set<Term> closed = new HashSet<Term>();

    // checking interchangeability pairwise
    for (int i = 0; i < constants.size(); i++) {
      if (!closed.contains(constants.get(i))) {
        partitioning.put(constants.get(i), constants.get(i));
        for (int j = i + 1; j < constants.size(); j++) {
          if (areExchangeable(constants.get(i), constants.get(j), rules)) {
            partitioning.put(constants.get(i), constants.get(j));
            closed.add(constants.get(j));
          }
        }
      }
    }
    Map<Constant, Constant> map = new HashMap<Constant, Constant>();
    for (Map.Entry<Term, Set<Term>> entry : partitioning.entrySet()) {
      Constant lexmin = null;
      for (Term t : entry.getValue()) {
        if (t instanceof Constant) {
          if (lexmin == null || t.toString().compareTo(lexmin.toString()) < 0) {
            lexmin = (Constant) t;
          }
        }
      }
      for (Term t : entry.getValue()) {
        if (t instanceof Constant) {
          map.put((Constant) t, lexmin);
        }
      }
    }

    MultiMap<Pair<Object, Constant>, Constant> mm =
        new MultiMap<Pair<Object, Constant>, Constant>();
    for (Map.Entry<Constant, Constant> entry : map.entrySet()) {
      mm.put(
          new Pair<Object, Constant>(
              entry.getValue().type() == null ? Sugar.NIL : entry.getValue().type(),
              entry.getValue()),
          entry.getKey());
    }

    MultiList<Object, Set<Constant>> retVal = new MultiList<Object, Set<Constant>>();
    for (Map.Entry<Pair<Object, Constant>, Set<Constant>> entry : mm.entrySet()) {
      retVal.put(entry.getKey().r, entry.getValue());
    }
    return retVal;
  }
Exemple #6
0
 public static Term defaultTerm(Term v, org.kframework.kil.loader.Context context) {
   String sort = v.getSort();
   KSort ksort = KSort.getKSort(sort).mainSort();
   if (ksort.isDefaultable()) return new Empty(ksort.toString());
   GlobalSettings.kem.register(
       new KException(
           ExceptionType.WARNING,
           KExceptionGroup.COMPILER,
           "Don't know the default value for term " + v.toString() + ". Assuming .K",
           v.getFilename(),
           v.getLocation()));
   return KSequence.EMPTY;
 }
Exemple #7
0
  @Override
  public String toString() {
    String result;
    byte[] resultByteArray;

    String prefix;
    String degreeString = degree.toString();
    if ("2.0".equals(degreeString)) {
      prefix = "";
    } else {
      prefix = "<" + degreeString + ">";
    }

    try {
      result = new String(prefix + "√(" + term.toString() + ")");
      resultByteArray = result.getBytes("UTF-8");
    } catch (UnsupportedEncodingException e) {
      // What the f**k doesn't support UTF-8?
      result = "sqrt" + prefix + "(" + term.toString() + ")";
      resultByteArray = result.getBytes();
    }

    return new String(resultByteArray, Charset.forName("UTF-8"));
  }
Exemple #8
0
 @Override
 public String toString() {
   return term.toString() + " " + year;
 }
 @Override
 public String toString() {
   return name.toString() + "/" + arity;
 }
Exemple #10
0
 public String toString(QueryFormatter f) {
   return iQuery.toString(f);
 }
Exemple #11
0
 @Override
 public String toString() {
   return "#freezer " + term.toString() + "(.KList)";
 }
Exemple #12
0
 public String toString() {
   return "NOT " + iTerm.toString();
 }
Exemple #13
0
 /** writes a term */
 private static void writeTerm(PrintWriter pw, Term t) {
   pw.println(t.toString() + ".");
 }
 @Override
 public String getDisplayName() {
   return trigType + "(" + term.toString() + ")";
 }
Exemple #15
0
 public String toString(QueryFormatter f) {
   return "NOT " + iTerm.toString(f);
 }
Exemple #16
0
 @Override
 public String toString() {
   return varName + " #= " + term.toString();
 }
Exemple #17
0
 public String toString() {
   return iQuery.toString();
 }
 @Override
 public String toString() {
   return "-" + negated.toString();
 }
Exemple #19
0
 public Eval(Term term) {
   this(term, term.toString());
 }