Examples of PersistentHashSet


Examples of clojure.lang.PersistentHashSet

        if (!(arg.respondsTo("intersection"))) throw context.getRuntime().newArgumentError("argument should be a set");
        IPersistentSet other = (IPersistentSet)DiametricUtils.getPersistentSet(context, arg);
        try {
            Var var = DiametricService.getFn("clojure.set", "intersection");
            if (set instanceof HashSet) {
                PersistentHashSet value = convertHashSetToPersistentHashSet(set);
                return DiametricUtils.convertJavaToRuby(context, var.invoke(value, other));
            } else {
                return DiametricUtils.convertJavaToRuby(context, var.invoke(set, other));
            }
        } catch (Throwable t) {
View Full Code Here

Examples of clojure.lang.PersistentHashSet

        if (!(arg.respondsTo("union"))) throw context.getRuntime().newArgumentError("argument should be a set");
        IPersistentSet other = (IPersistentSet)DiametricUtils.getPersistentSet(context, arg);
        try {
            Var var = DiametricService.getFn("clojure.set", "union");
            if (set instanceof HashSet) {
                PersistentHashSet value = convertHashSetToPersistentHashSet(set);
                return DiametricSet.getDiametricSet(context, (Set)var.invoke(value, other));
            } else {
                return DiametricSet.getDiametricSet(context, (Set)var.invoke(set, other));
            }
        } catch (Throwable t) {
View Full Code Here

Examples of clojure.lang.PersistentHashSet

        if (!(arg.respondsTo("difference"))) throw context.getRuntime().newArgumentError("argument should be a set");
        IPersistentSet other = (IPersistentSet)DiametricUtils.getPersistentSet(context, arg);
        try {
            Var var = DiametricService.getFn("clojure.set", "difference");
            if (set instanceof HashSet) {
                PersistentHashSet value = convertHashSetToPersistentHashSet(set);
                return DiametricSet.getDiametricSet(context, (Set)var.invoke(value, other));
            } else {
                return DiametricSet.getDiametricSet(context, (Set)var.invoke(set, other));
            }
        } catch (Throwable t) {
View Full Code Here

Examples of clojure.lang.PersistentHashSet

    if (t instanceof Value) {
      Value<?> ev=(Value<?>) t;
      return values.contains(ev.value);
    }
    if (t instanceof ValueSet) {
      @SuppressWarnings("rawtypes")
      PersistentHashSet tvs=((ValueSet) t).values;
      return tvs.containsAll(values);
    }

    return false;
  }
View Full Code Here

Examples of clojure.lang.PersistentHashSet

    return false;
  }
 
  @Override
  public Type intersection(Type t) {
    PersistentHashSet values=this.values;
    ISeq s=values.seq();
    while(s!=null) {
      Object o=s.first();
      if (!t.checkInstance(o)) {
        values=(PersistentHashSet) values.disjoin(o);
      }
      s=s.next();
    }
    return update(values);
  }
View Full Code Here

Examples of com.trifork.clj_ds.PersistentHashSet

    unlink_oneway(other);
    other.unlink_oneway(self_handle());
  }
 
  public void unlink_oneway(EHandle handle) {
    PersistentHashSet old, links;
    try {

      do {
        old = linksref.get();
        links = (PersistentHashSet) old.disjoin(handle);
      } while (!linksref.weakCompareAndSet(old, links));

    } catch (Exception e) {
      throw new RuntimeException(e);
    }   
View Full Code Here

Examples of com.trifork.clj_ds.PersistentHashSet

  public boolean link_oneway(EHandle h) {
    // TODO: check if h is valid.

    if (h.exists()) {

      PersistentHashSet old, links;
      try {

        do {
          old = linksref.get();
          links = (PersistentHashSet) old.cons(h);
        } while (!linksref.weakCompareAndSet(old, links));

      } catch (Exception e) {
        throw new RuntimeException(e);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.