當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。