Package clojure.lang

Examples of clojure.lang.IPersistentMap


        Object map_field_by = def.mapFieldBy(field);
        if (map_field_by != null) {
          String field_name = def.namingStrategy.protoName(map_field_by);
          for (ISeq s = RT.seq(value); s != null; s = s.next()) {
            Map.Entry<?, ?> e = (Map.Entry<?, ?>)s.first();
            IPersistentMap map = (IPersistentMap)e.getValue();
            Object k = e.getKey();
            Object v = toProtoValue(field, map.assoc(map_field_by, k).assoc(field_name, k));
            addRepeatedField(builder, field, v);
          }
        } else if (field.getOptions().getExtension(Extensions.map)) {
          for (ISeq s = RT.seq(value); s != null; s = s.next()) {
            Map.Entry<?, ?> e = (Map.Entry<?, ?>)s.first();
View Full Code Here


        throw new IllegalArgumentException("Vector arg to map conj must be a pair");
      }
      return assoc(v.nth(0), v.nth(1));
    } else {
      DynamicMessage.Builder builder = builder();
      IPersistentMap ext = this.ext;
      for (ISeq s = RT.seq(o); s != null; s = s.next()) {
        Map.Entry<?, ?> e = (Map.Entry<?, ?>)s.first();

        Object k = e.getKey(), v = e.getValue();
        if (!addField(builder, k, v)) {
View Full Code Here

  @Override
  public IPersistentMap without(Object key) {
    Descriptors.FieldDescriptor field = def.fieldDescriptor(key);
    if (field == null) {
      IPersistentMap newExt = (IPersistentMap)RT.dissoc(ext, key);
      if (newExt == ext) {
        return this;
      }
      return new PersistentProtocolBufferMap(meta(), newExt, def, builder());
    }
View Full Code Here

      if (newBody!=body) newBody=newBody.optimise(); // re-optimise if needed
      body=newBody;
    }
   
    // manage dependency updates
    IPersistentMap tempDependencies=this.dependencies;
    IPersistentMap tempDependents=this.dependents;
   
    IPersistentSet free=body.accumulateFreeSymbols(PersistentHashSet.EMPTY);
   
    IPersistentSet oldDeps=(IPersistentSet) tempDependencies.valAt(key);
    if ((oldDeps==null)) oldDeps=PersistentHashSet.EMPTY;
View Full Code Here

    return new LambdaFn(env, body, params);
  }
 
  public Object invokeArray(Object... args) {
    if (args.length!=arity) throwArity(args.length);
    IPersistentMap bindings=PersistentHashMap.EMPTY;
    for (int i=0; i<arity; i++) {
      bindings=bindings.assoc(params[i], args[i]);
    }
    Environment e=body.compute(env, bindings);
    while (true) {
      Object ro=e.getResult();
      if (ro instanceof ReturnResult) return ((ReturnResult) ro).value;
      if (!(ro instanceof RecurResult)) break;
      RecurResult re=(RecurResult) ro;
      for (int i=0; i<arity; i++) {
        bindings=bindings.assoc(params[i], re.values[i]);
      }
      e=body.compute(e,bindings);
    }
    return e.getResult();
  }
View Full Code Here

    initialize();
   
    ClassLoader bundleLoader = new BundleClassLoader(aBundle);
    final URL[] urls = (additionalURLs == null) ? new URL[] {} : additionalURLs.toArray(new URL[additionalURLs.size()]);
    URLClassLoader loader = new URLClassLoader(urls, bundleLoader);
    IPersistentMap bindings = RT.map(Compiler.LOADER, loader);

    boolean pushed = true;

    ClassLoader saved = Thread.currentThread().getContextClassLoader();
View Full Code Here

        throw new IllegalArgumentException(
            "Vector arg to map conj must be a pair");
      return assoc(v.nth(0), v.nth(1));
    }

    IPersistentMap ret = this;
    for (ISeq es = RT.seq(o); es != null; es = es.next()) {
      Map.Entry e = (Map.Entry) es.first();
      ret = ret.assoc(e.getKey(), e.getValue());
    }
    return ret;
  }
View Full Code Here

TOP

Related Classes of clojure.lang.IPersistentMap

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.