MCPcopy Index your code
hub / github.com/clojure/clojure / seqFrom

Method seqFrom

src/jvm/clojure/lang/PersistentTreeMap.java:183–221  ·  view source on GitHub ↗
(Object key, boolean ascending)

Source from the content-addressed store, hash-verified

181}
182
183public ISeq seqFrom(Object key, boolean ascending){
184 if(_count > 0)
185 {
186 ISeq stack = null;
187 Node t = tree;
188 while(t != null)
189 {
190 int c = doCompare(key, t.key);
191 if(c == 0)
192 {
193 stack = RT.cons(t, stack);
194 return new Seq(stack, ascending);
195 }
196 else if(ascending)
197 {
198 if(c < 0)
199 {
200 stack = RT.cons(t, stack);
201 t = t.left();
202 }
203 else
204 t = t.right();
205 }
206 else
207 {
208 if(c > 0)
209 {
210 stack = RT.cons(t, stack);
211 t = t.right();
212 }
213 else
214 t = t.left();
215 }
216 }
217 if(stack != null)
218 return new Seq(stack, ascending);
219 }
220 return null;
221}
222
223public NodeIterator iterator(){
224 return new NodeIterator(tree, true);

Callers 1

seqFromMethod · 0.95

Calls 4

doCompareMethod · 0.95
consMethod · 0.95
leftMethod · 0.95
rightMethod · 0.95

Tested by

no test coverage detected