gpt4 book ai didi

cyclops.data.Zipper.next()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-20 17:38:31 34 4
gpt4 key购买 nike

本文整理了Java中cyclops.data.Zipper.next()方法的一些代码示例,展示了Zipper.next()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Zipper.next()方法的具体详情如下:
包路径:cyclops.data.Zipper
类名称:Zipper
方法名:next

Zipper.next介绍

暂无

代码示例

代码示例来源:origin: aol/cyclops

public <R> Zipper<T> next(Zipper<T> alt){
  return next().orElse(alt);
}
public <R> Zipper<T> previous(Zipper<T> alt){

代码示例来源:origin: aol/cyclops

public Zipper<T> end() {
  Option<Zipper<T>> result = Option.some(this);
  Option<Zipper<T>> next = result;
  while(next.isPresent()){
    next = result.flatMap(p->p.next());
    if(next.isPresent())
      result = next;
  }
  return result.orElse(this);
}
public int index(){

代码示例来源:origin: aol/cyclops

public Zipper<T> cycleNext() {
  return left.fold(cons->right.fold(c->next().orElse(this), nil->{
    return of(LazySeq.empty(),cons.head(),cons.tail().append(point));
  }),nil->this);
}
public Zipper<T> cyclePrevious() {

代码示例来源:origin: aol/cyclops

@Test
public void getPoint() throws Exception {
  assertThat(z.getPoint(),equalTo(5));
  assertThat(z.next().orElse(z2).getPoint(),equalTo(10));
}

代码示例来源:origin: aol/cyclops

public Option<Zipper<T>> position(int index) {
  Zipper<T> result = this;
  while (index != result.index()) {
    if (result.index() < index && !result.isEnd()) {
      result = result.next(result);
    } else if (result.index() > index && !result.isStart()) {
      result = result.previous(result);
    } else {
      return Option.none();
    }
  }
  return Option.some(result);
}
public <R> Option<Zipper<T>> next(){

代码示例来源:origin: aol/cyclops

@Test
public void next1() throws Exception {
  assertThat(z.next(z2),equalTo(Zipper.of(LazySeq.of(1,2,3,5),10,LazySeq.of(20,30))));
}

代码示例来源:origin: aol/cyclops

@Test
public void getRight() throws Exception {
  assertThat(z.getRight(),equalTo(right));
  assertThat(z.next().orElse(z2).getRight(),equalTo(LazySeq.of(20,30)));
}

代码示例来源:origin: aol/cyclops

@Test
public void index() throws Exception {
  assertThat(z.index(),equalTo(3));
  assertThat(z.next().orElse(z2).index(),equalTo(4));
  assertThat(z.previous().orElse(z2).index(),equalTo(2));
}

代码示例来源:origin: aol/cyclops

@Test
public void next() throws Exception {
  assertThat(z.next().orElse(z2),equalTo(Zipper.of(LazySeq.of(1,2,3,5),10,LazySeq.of(20,30))));
}

代码示例来源:origin: aol/cyclops

@Test
public void getLeft() throws Exception {
  assertThat(z.getLeft(),equalTo(left));
  assertThat(z.next().orElse(z2).getLeft().seq(),equalTo(LazySeq.of(1,2,3,5).seq()));
}

代码示例来源:origin: aol/cyclops

@Test
public void cycleNext() throws Exception {
  assertThat(z.cycleNext(),equalTo(z.next().orElse(z2)));
  assertThat(Zipper.of(LazySeq.of(1,2,3),5,LazySeq.empty()).cycleNext(),equalTo(Zipper.of(LazySeq.empty(),1,LazySeq.of(2,3,5))));
}

代码示例来源:origin: com.oath.cyclops/cyclops

public <R> Zipper<T> next(Zipper<T> alt){
  return next().orElse(alt);
}
public <R> Zipper<T> previous(Zipper<T> alt){

代码示例来源:origin: com.oath.cyclops/cyclops

public Zipper<T> end() {
  Option<Zipper<T>> result = Option.some(this);
  Option<Zipper<T>> next = result;
  while(next.isPresent()){
    next = result.flatMap(p->p.next());
    if(next.isPresent())
      result = next;
  }
  return result.orElse(this);
}
public int index(){

代码示例来源:origin: com.oath.cyclops/cyclops

public Zipper<T> cycleNext() {
  return left.fold(cons->right.fold(c->next().orElse(this), nil->{
    return of(LazySeq.empty(),cons.head(),cons.tail().append(point));
  }),nil->this);
}
public Zipper<T> cyclePrevious() {

代码示例来源:origin: com.oath.cyclops/cyclops

public Option<Zipper<T>> position(int index) {
  Zipper<T> result = this;
  while (index != result.index()) {
    if (result.index() < index && !result.isEnd()) {
      result = result.next(result);
    } else if (result.index() > index && !result.isStart()) {
      result = result.previous(result);
    } else {
      return Option.none();
    }
  }
  return Option.some(result);
}
public <R> Option<Zipper<T>> next(){

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com