public IValue visitMap(IMap o) throws IOException {
      append('(');
      tab();
      boolean indent = checkIndent(o);
      indent(indent);
      Iterator<IValue> mapIterator = o.iterator();
      if (mapIterator.hasNext()) {
        IValue key = mapIterator.next();
        key.accept(this);
        append(':');
        o.get(key).accept(this);

        while (mapIterator.hasNext()) {
          append(',');
          indent(indent);
          key = mapIterator.next();
          key.accept(this);
          append(':');
          o.get(key).accept(this);
        }
      }
      untab();
      indent(indent);
      append(')');

      return o;
    }
 private boolean checkIndent(ISet o) {
   if (indent && o.size() > 1) {
     for (IValue x : o) {
       Type type = x.getType();
       return indented(type);
     }
   }
   return false;
 }
 private boolean checkIndent(INode o) {
   if (indent && o.arity() > 1) {
     for (IValue x : o) {
       Type type = x.getType();
       if (indented(type)) {
         return true;
       }
     }
   }
   return false;
 }
 private boolean checkIndent(IList o) {
   if (indent && o.length() > 1) {
     for (IValue x : o) {
       Type type = x.getType();
       if (indented(type)) {
         return true;
       }
     }
   }
   return false;
 }
 private boolean checkIndent(IMap o) {
   if (indent && o.size() > 1) {
     for (IValue x : o) {
       Type type = x.getType();
       Type vType = o.get(x).getType();
       if (indented(type)) {
         return true;
       }
       if (indented(vType)) {
         return true;
       }
     }
   }
   return false;
 }
 public void write(IValue value, java.io.Writer stream) throws IOException {
   try {
     value.accept(new Writer(stream, indent, tabSize));
   } finally {
     stream.flush();
   }
 }
Esempio n. 7
0
 protected void setAnnotation(String annoName, IValue annoValue) {
   if (this.ownValue == null) {
     return;
   }
   if (annoValue != null && ownValue.getType().declaresAnnotation(this.typeStore, annoName)) {
     ownValue = ((IConstructor) ownValue).asAnnotatable().setAnnotation(annoName, annoValue);
   }
 }
Esempio n. 8
0
 public void insert(IListWriter listW, IValue message) {
   if (message.getType().isConstructor()
       && message.getType().getAbstractDataType().getName().equals("Message")) {
     listW.insert(message);
   }
 }