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


Java LazySeq类代码示例

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


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

示例1: prioritySeq

import clojure.lang.LazySeq; //导入依赖的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

示例2: traverseFrom

import clojure.lang.LazySeq; //导入依赖的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

示例3: rtraverseFrom

import clojure.lang.LazySeq; //导入依赖的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

示例4: traverseAtMost

import clojure.lang.LazySeq; //导入依赖的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

示例5: traverseBelow

import clojure.lang.LazySeq; //导入依赖的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

示例6: rtraverseAtMost

import clojure.lang.LazySeq; //导入依赖的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

示例7: rtraverseBelow

import clojure.lang.LazySeq; //导入依赖的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

示例8: getAvailableSlots

import clojure.lang.LazySeq; //导入依赖的package包/类
/**
 * Returns the available slots of the given supervisor.
 * 
 * @param info the supervisor information object
 * @return the available slots
 */
public static Set<Integer> getAvailableSlots(SupervisorInfo info) {
    Set<Integer> result = new HashSet<Integer>();
    if (info.meta instanceof LazySeq) {
        Object[] ports = ((LazySeq) info.meta).toArray();
        if (null != ports) {
            for (int p = 0; p < ports.length; p++) {
                Object portO = ports[p];
                if (portO instanceof Integer) {
                    result.add((Integer) portO);
                } else if (portO instanceof Number) {
                    result.add(((Number) portO).intValue());
                }
            }
        }
    }
    return result;
}
 
开发者ID:QualiMaster,项目名称:Infrastructure,代码行数:24,代码来源:ZkUtils.java

示例9: traverse

import clojure.lang.LazySeq; //导入依赖的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

示例10: rtraverse

import clojure.lang.LazySeq; //导入依赖的package包/类
ISeq rtraverse(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 rtraverse(key, priority, lright);
                    }
                }),
                new LazySeq(new AFn() {
                    public ISeq invoke() {
                        return rtraverse(lkey, lpriority, lleft);
                    }
                })
        );
    return concat(
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return rtraverse(lkey, lpriority, lright);
                }
            }),
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return rtraverse(key, priority, lleft);
                }
            })
    );
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:34,代码来源:PersistentPrioritySearchQueue.java

示例11: traverseAtMostRange

import clojure.lang.LazySeq; //导入依赖的package包/类
ISeq traverseAtMostRange(final Object low, final Object high, 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) {
        Object lkey = match.left.key;
        if (kcomp.compare(low, lkey) <= 0 && kcomp.compare(lkey, high) <= 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(low, lubound) <= 0 ?
                            traverseAtMostRange(low, high, priority, match.left) :
                            null;
                }
            }),
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return kcomp.compare(lubound, high) <= 0 ?
                            traverseAtMostRange(low, high, priority, match.right) :
                            null;
                }
            })
    );
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:29,代码来源:PersistentPrioritySearchQueue.java

示例12: traverseBelowRange

import clojure.lang.LazySeq; //导入依赖的package包/类
ISeq traverseBelowRange(final Object low, final Object high, 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) {
        Object lkey = match.left.key;
        if (kcomp.compare(low, lkey) <= 0 && kcomp.compare(lkey, high) <= 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(low, lubound) <= 0 ?
                            traverseBelowRange(low, high, priority, match.left) :
                            null;
                }
            }),
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return kcomp.compare(lubound, high) <= 0 ?
                            traverseBelowRange(low, high, priority, match.right) :
                            null;
                }
            })
    );
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:29,代码来源:PersistentPrioritySearchQueue.java

示例13: rtraverseAtMostRange

import clojure.lang.LazySeq; //导入依赖的package包/类
ISeq rtraverseAtMostRange(final Object low, final Object high, 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) {
        Object lkey = match.left.key;
        if (kcomp.compare(low, lkey) <= 0 && kcomp.compare(lkey, high) <= 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, high) <= 0 ?
                            rtraverseAtMostRange(low, high, priority, match.right) :
                            null;
                }
            }),
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return kcomp.compare(low, lubound) <= 0 ?
                            rtraverseAtMostRange(low, high, priority, match.left) :
                            null;
                }
            })
    );
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:29,代码来源:PersistentPrioritySearchQueue.java

示例14: rtraverseBelowRange

import clojure.lang.LazySeq; //导入依赖的package包/类
ISeq rtraverseBelowRange(final Object low, final Object high, 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) {
        Object lkey = match.left.key;
        if (kcomp.compare(low, lkey) <= 0 && kcomp.compare(lkey, high) <= 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, high) <= 0 ?
                            rtraverseBelowRange(low, high, priority, match.right) :
                            null;
                }
            }),
            new LazySeq(new AFn() {
                public ISeq invoke() {
                    return kcomp.compare(low, lubound) <= 0 ?
                            rtraverseBelowRange(low, high, priority, match.left) :
                            null;
                }
            })
    );
}
 
开发者ID:michalmarczyk,项目名称:psq.clj,代码行数:29,代码来源:PersistentPrioritySearchQueue.java

示例15: configureJvmRepr

import clojure.lang.LazySeq; //导入依赖的package包/类
@Override
protected void configureJvmRepr() {
  Displayers.register(LazySeq.class, new Displayer<LazySeq>() {
    @Override
    public Map<String, String> display(LazySeq value) {
      return new HashMap<String, String>() {{
        List<String> collect = stream(value.toArray()).map(Object::toString).collect(Collectors.toList());
        put(MIMEContainer.MIME.TEXT_PLAIN, new ArrayList<>(collect).toString());
      }};
    }
  });
  DisplayerDataMapper.register(converter);
}
 
开发者ID:twosigma,项目名称:beakerx,代码行数:14,代码来源:Clojure.java


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