当前位置: 首页>>代码示例>>Java>>正文


Java ISeq类代码示例

本文整理汇总了Java中clojure.lang.ISeq的典型用法代码示例。如果您正苦于以下问题:Java ISeq类的具体用法?Java ISeq怎么用?Java ISeq使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ISeq类属于clojure.lang包,在下文中一共展示了ISeq类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import clojure.lang.ISeq; //导入依赖的package包/类
private static ISeq create(long bitmap, Object[] array, ISeq nexts, int lvl) {
    while (bitmap != 0L) {
        switch ((int) (bitmap & 3L)) {
        case 0: 
            bitmap >>>= Long.numberOfTrailingZeros(bitmap) & -2;
            break;
        case 3:
            return new Seq(null, bitmap >>> 2, array, nexts, lvl);
        default:
            Object object = array[Long.bitCount(bitmap) - 1];
            nexts = lvl == 30 ? Collisions.Seq.create(object, nexts) : Node.Seq.create(object, nexts, lvl+5);
            bitmap >>>= 2;
        }
    }
    return nexts;
}
 
开发者ID:cgrand,项目名称:confluent-map,代码行数:17,代码来源:ConfluentHashMap.java

示例2: prioritySeq

import clojure.lang.ISeq; //导入依赖的package包/类
ISeq prioritySeq(final int countdown, final Loser losers, final Object ubound) {
    if (0 == countdown)
        return null;

    return new LazySeq(
            new AFn() {
                public Object invoke() {
                    MatchFrame mf = new MatchFrame();
                    secondBest(losers, ubound, mf);
                    Object lkey = mf.lkey;
                    Object lpriority = mf.lpriority;
                    Loser llosers = mf.llosers;
                    Object lubound = mf.lubound;
                    return new Cons(
                            new MapEntry(lkey, lpriority),
                            prioritySeq(countdown - 1, llosers, lubound)
                    );
                }
            }
    );
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:22,代码来源:PersistentPrioritySearchQueue.java

示例3: traverseFrom

import clojure.lang.ISeq; //导入依赖的package包/类
ISeq traverseFrom(final Object lbound, Winner winner) {
    if (null == winner)
        return PersistentList.EMPTY;
    final Match match = unplay(winner);
    if (null == match.right) {
        Object lkey = match.left.key;
        if (kcomp.compare(lbound, lkey) <= 0)
            return RT.list(new MapEntry(lkey, match.left.priority));
        return PersistentList.EMPTY;
    }
    final Object lubound = match.left.ubound;
    return concat(
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return kcomp.compare(lbound, lubound) <= 0 ?
                            traverseFrom(lbound, match.left) :
                            null;
                }
            }),
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return traverseFrom(lbound, match.right);
                }
            })
    );
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:27,代码来源:PersistentPrioritySearchQueue.java

示例4: rtraverseFrom

import clojure.lang.ISeq; //导入依赖的package包/类
ISeq rtraverseFrom(final Object ubound, Winner winner) {
    if (null == winner)
        return PersistentList.EMPTY;
    final Match match = unplay(winner);
    if (null == match.right) {
        Object lkey = match.left.key;
        if (kcomp.compare(lkey, ubound) <= 0)
            return RT.list(new MapEntry(lkey, match.left.priority));
        return PersistentList.EMPTY;
    }
    final Object lubound = match.left.ubound;
    return concat(
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return kcomp.compare(lubound, ubound) <= 0 ?
                            rtraverseFrom(ubound, match.right) :
                            null;
                }
            }),
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return rtraverseFrom(ubound, match.left);
                }
            })
    );
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:27,代码来源:PersistentPrioritySearchQueue.java

示例5: traverseAtMost

import clojure.lang.ISeq; //导入依赖的package包/类
ISeq traverseAtMost(final Object priority, final Winner winner) {
    if (null == winner || pcomp.compare(winner.priority, priority) > 0)
        return PersistentList.EMPTY;
    final Match match = unplay(winner);
    if (null == match.right)
        return RT.list(new MapEntry(match.left.key, match.left.priority));
    return concat(
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return traverseAtMost(priority, match.left);
                }
            }),
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return traverseAtMost(priority, match.right);
                }
            })
    );
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:20,代码来源:PersistentPrioritySearchQueue.java

示例6: traverseBelow

import clojure.lang.ISeq; //导入依赖的package包/类
ISeq traverseBelow(final Object priority, final Winner winner) {
    if (null == winner || pcomp.compare(winner.priority, priority) >= 0)
        return PersistentList.EMPTY;
    final Match match = unplay(winner);
    if (null == match.right)
        return RT.list(new MapEntry(match.left.key, match.left.priority));
    return concat(
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return traverseBelow(priority, match.left);
                }
            }),
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return traverseBelow(priority, match.right);
                }
            })
    );
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:20,代码来源:PersistentPrioritySearchQueue.java

示例7: rtraverseAtMost

import clojure.lang.ISeq; //导入依赖的package包/类
ISeq rtraverseAtMost(final Object priority, Winner winner) {
    if (null == winner || pcomp.compare(winner.priority, priority) > 0)
        return PersistentList.EMPTY;
    final Match match = unplay(winner);
    if (null == match.right)
        return RT.list(new MapEntry(match.left.key, match.left.priority));
    return concat(
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return rtraverseAtMost(priority, match.right);
                }
            }),
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return rtraverseAtMost(priority, match.left);
                }
            })
    );
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:20,代码来源:PersistentPrioritySearchQueue.java

示例8: rtraverseBelow

import clojure.lang.ISeq; //导入依赖的package包/类
ISeq rtraverseBelow(final Object priority, Winner winner) {
    if (null == winner || pcomp.compare(winner.priority, priority) >= 0)
        return PersistentList.EMPTY;
    final Match match = unplay(winner);
    if (null == match.right)
        return RT.list(new MapEntry(match.left.key, match.left.priority));
    return concat(
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return rtraverseBelow(priority, match.right);
                }
            }),
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return rtraverseBelow(priority, match.left);
                }
            })
    );
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:20,代码来源:PersistentPrioritySearchQueue.java

示例9: iterator

import clojure.lang.ISeq; //导入依赖的package包/类
public Iterator<Object> iterator() {
    return new Iterator<Object>() {
        private Possible<ISeq> current; {
            current = Possible.value(delegate);
        }

        public boolean hasNext() {
            return current.hasValue();
        }

        public Object next() {
            Object result = current.get().first();
            current = Nulls.possible(current.get().next());
            return ClJ.toJava(result);
        }};
}
 
开发者ID:shopsmart,项目名称:ClJ,代码行数:17,代码来源:ClojureSeq.java

示例10: map

import clojure.lang.ISeq; //导入依赖的package包/类
public void map(Object key, Object value, Collector<Object, Object> collector){

        if(fn == null) {
            IFn require = Clojure.var("clojure.core", "require");
            require.invoke(Clojure.read(ns));
            fn = Clojure.var(ns, sym);
        }

        for (Object o : (Iterable)fn.invoke(key, value)){
            Seqable s = (Seqable)o;
            ISeq seq = s.seq();
            Object k = seq.first();
            Object v = seq.next().first();
            collector.emit(k, v);
        }
    }
 
开发者ID:danstone,项目名称:immutant-mr,代码行数:17,代码来源:InfinispanMapper.java

示例11: encodeHeaders

import clojure.lang.ISeq; //导入依赖的package包/类
public void encodeHeaders(DynamicBytes bytes) {
    final int total = size << 1;
    for (int i = 0; i < total; i += 2) {
        String k = (String) arrays[i];
        Object v = arrays[i + 1];
        if (v instanceof String) {
            bytes.append(k);
            bytes.append(COLON, SP);
            // supposed to be ISO-8859-1, but utf-8 is compatible.
            // filename in Content-Disposition can be utf8
            bytes.append((String) v, HttpUtils.UTF_8);
            bytes.append(CR, LF);
            // ring spec says it could be a seq
        } else if (v instanceof Seqable) {
            ISeq seq = ((Seqable) v).seq();
            while (seq != null) {
                bytes.append(k);
                bytes.append(COLON, SP);
                bytes.append(seq.first().toString(), HttpUtils.UTF_8);
                bytes.append(CR, LF);
                seq = seq.next();
            }
        }
    }
    bytes.append(CR, LF);
}
 
开发者ID:nLight,项目名称:jruby-http-kit,代码行数:27,代码来源:HeaderMap.java

示例12: invoke

import clojure.lang.ISeq; //导入依赖的package包/类
@Override
public Object invoke(Object newVal) {
    if (newVal instanceof Seqable) {
        ISeq seq = ((Seqable) newVal).seq();
        // An empty seqable returns null.
        if (seq == null) {
            return true;
        }
        int count = seq.count();
        while (count --> 0) {
            Object o = seq.first();
            seq = seq.next();
            if (!(o instanceof Runnable)) {
                return false;
            }
        }
        return true;
    }
    else if (newVal == null) {
        return true;
    }
    else {
        return false;
    }
}
 
开发者ID:hypirion,项目名称:beckon,代码行数:26,代码来源:SignalAtoms.java

示例13: Seq

import clojure.lang.ISeq; //导入依赖的package包/类
private Seq(IPersistentMap meta, long bitmap, Object[] array, ISeq nexts, int lvl) {
    super(meta);
    this.bitmap = bitmap;
    this.array = array;
    this.nexts = nexts;
    this.lvl = lvl;
}
 
开发者ID:cgrand,项目名称:confluent-map,代码行数:8,代码来源:ConfluentHashMap.java

示例14: create

import clojure.lang.ISeq; //导入依赖的package包/类
static public PersistentPrioritySearchQueue create(ISeq items) {
    IPersistentMap ret = EMPTY;
    for (; items != null; items = items.next().next()) {
        if (items.next() == null)
            throw new IllegalArgumentException(
                    String.format("No value supplied for key: %s", items.first())
            );
        ret = ret.assoc(items.first(), RT.second(items));
    }
    return (PersistentPrioritySearchQueue) ret;
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:12,代码来源:PersistentPrioritySearchQueue.java

示例15: traverse

import clojure.lang.ISeq; //导入依赖的package包/类
ISeq traverse(final Object key, final Object priority, Loser losers) {
    if (null == losers)
        return RT.list(new MapEntry(key, priority));
    final Object lkey = losers.key;
    final Object lpriority = losers.priority;
    final Loser lleft = losers.left;
    final Loser lright = losers.right;
    if (kcomp.compare(lkey, losers.split) <= 0)
        return concat(
                new LazySeq(new AFn() {
                    public ISeq invoke() {
                        return traverse(lkey, lpriority, lleft);
                    }
                }),
                new LazySeq(new AFn() {
                    public ISeq invoke() {
                        return traverse(key, priority, lright);
                    }
                })
        );
    return concat(
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return traverse(key, priority, lleft);
                }
            }),
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return traverse(lkey, lpriority, lright);
                }
            })
    );
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:34,代码来源:PersistentPrioritySearchQueue.java


注:本文中的clojure.lang.ISeq类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。