Пример #1
0
    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;
    }
Пример #2
0
 private boolean checkIndent(ISet o) {
   if (indent && o.size() > 1) {
     for (IValue x : o) {
       Type type = x.getType();
       return indented(type);
     }
   }
   return false;
 }
Пример #3
0
 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;
 }
Пример #4
0
 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;
 }
Пример #5
0
 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;
 }
Пример #6
0
 public void write(IValue value, java.io.Writer stream) throws IOException {
   try {
     value.accept(new Writer(stream, indent, tabSize));
   } finally {
     stream.flush();
   }
 }
Пример #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);
   }
 }
Пример #8
0
 public void insert(IListWriter listW, IValue message) {
   if (message.getType().isConstructor()
       && message.getType().getAbstractDataType().getName().equals("Message")) {
     listW.insert(message);
   }
 }