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


Java ReadonlyList.ArrayListWrapper方法代码示例

本文整理汇总了Java中com.intellij.util.containers.ReadonlyList.ArrayListWrapper方法的典型用法代码示例。如果您正苦于以下问题:Java ReadonlyList.ArrayListWrapper方法的具体用法?Java ReadonlyList.ArrayListWrapper怎么用?Java ReadonlyList.ArrayListWrapper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.util.containers.ReadonlyList的用法示例。


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

示例1: testRealResults

import com.intellij.util.containers.ReadonlyList; //导入方法依赖的package包/类
private void testRealResults(TreeNavigationImpl navigation, ReadonlyList.ArrayListWrapper<CommitI> commits) {
  final int[] expectedWireNumbers = {0,0,1,1,1,   1,3,3,2,0,    0,1,1,1,2,    2,0,0};
  for (int i = 0; i < 5; i++) {
    final CommitI commitI = (CommitI)commits.get(i);
    // just because of the test data order
    Assert.assertEquals("" + (i + 1), commitI.getHash().getString());
    Assert.assertEquals(expectedWireNumbers[i], commitI.getWireNumber());
  }

  Ring<Integer> usedWires = navigation.getUsedWires(17, commits, new Convertor<Integer, List<Integer>>() {
    @Override
    public List<Integer> convert(Integer o) {
      return Collections.emptyList();
    }
  });
  System.out.println("*");
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:SkeletonBuilderTest.java

示例2: fillData

import com.intellij.util.containers.ReadonlyList; //导入方法依赖的package包/类
private void fillData(List<CommitHashPlusParents> list,
                      TreeNavigationImpl navigation,
                      SkeletonBuilder builder,
                      ReadonlyList.ArrayListWrapper<CommitI> commits) {
  int wasSize = commits.getSize();
  for (CommitHashPlusParents commitHashPlusParents : list) {
    final WireNumberCommitDecoration commitI = createCommit(commitHashPlusParents);
    commits.getDelegate().add(commitI);
    builder.consume(commitI, getParents(commitHashPlusParents), commits, commits.getSize() - 1);
  }
  //navigation.recountWires(wasSize == 0 ? 0 : (wasSize - 1), commits);
  navigation.recalcIndex(commits, builder.getFutureConvertor());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:14,代码来源:SkeletonBuilderTest.java

示例3: testOneLine

import com.intellij.util.containers.ReadonlyList; //导入方法依赖的package包/类
public void testOneLine() throws Exception {
  final List<CommitHashPlusParents> list = read("1 2\n2 3\n3 4\n4 5\n5");
  // 4, 4
  final TreeNavigationImpl navigation = new TreeNavigationImpl(2, 2);
  final SkeletonBuilder builder = new SkeletonBuilder(navigation);
  final ReadonlyList.ArrayListWrapper<CommitI> commits = new ReadonlyList.ArrayListWrapper<CommitI>();
  fillData(list, navigation, builder, commits);

  for (int i = 0; i < 5; i++) {
    final CommitI commitI = (CommitI)commits.get(i);
    // just because of the test data order
    Assert.assertEquals("" + (i + 1), commitI.getHash().getString());
    Assert.assertEquals(0, commitI.getWireNumber());
  }

  final Iterator<WireEvent> iterator = navigation.createWireEventsIterator(0);
  WireEventI we = iterator.next();
  Assert.assertEquals(true, we.isStart());
  Assert.assertEquals(0, we.getCommitIdx());

  we = iterator.next();
  Assert.assertEquals(true, we.isEnd());
  Assert.assertEquals(4, we.getCommitIdx());

  assertWires(navigation.getUsedWires(0, commits, builder.getFutureConvertor()).getUsed());
  assertWires(navigation.getUsedWires(1, commits, builder.getFutureConvertor()).getUsed(), 0);
  assertWires(navigation.getUsedWires(2, commits, builder.getFutureConvertor()).getUsed(), 0);
  assertWires(navigation.getUsedWires(3, commits, builder.getFutureConvertor()).getUsed(), 0);
  assertWires(navigation.getUsedWires(4, commits, builder.getFutureConvertor()).getUsed(), 0);

  final Iterator<WireEvent> iterator1 = navigation.createWireEventsIterator(4);
  WireEventI we1 = iterator1.next();
  Assert.assertEquals(true, we1.isEnd());
  Assert.assertEquals(4, we1.getCommitIdx());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:36,代码来源:SkeletonBuilderTest.java

示例4: testFirstStepResults

import com.intellij.util.containers.ReadonlyList; //导入方法依赖的package包/类
private void testFirstStepResults(TreeNavigationImpl navigation, ReadonlyList.ArrayListWrapper<CommitI> commits, final SkeletonBuilder builder) {
  for (int i = 0; i < 7; i++) {
    final CommitI commitI = (CommitI)commits.get(i);
    // just because of the test data order
    Assert.assertEquals("" + (i + 1), commitI.getHash().getString());
  }
  Assert.assertEquals(0, commits.get(0).getWireNumber());
  Assert.assertEquals(0, commits.get(1).getWireNumber());
  Assert.assertEquals(1, commits.get(2).getWireNumber());
  Assert.assertEquals(0, commits.get(3).getWireNumber());
  Assert.assertEquals(1, commits.get(4).getWireNumber());
  Assert.assertEquals(0, commits.get(5).getWireNumber());
  Assert.assertEquals(0, commits.get(6).getWireNumber());

  final Iterator<WireEvent> iterator = navigation.createWireEventsIterator(0);
  testFirstIteratorPart(iterator);
  WireEventI we;

  assertWires(navigation.getUsedWires(0, commits, builder.getFutureConvertor()).getUsed());
  assertWires(navigation.getUsedWires(1, commits, builder.getFutureConvertor()).getUsed(), 0,1);
  assertWires(navigation.getUsedWires(2, commits, builder.getFutureConvertor()).getUsed(), 0,1);
  assertWires(navigation.getUsedWires(3, commits, builder.getFutureConvertor()).getUsed(), 0,1);
  assertWires(navigation.getUsedWires(4, commits, builder.getFutureConvertor()).getUsed(), 0,1);
  assertWires(navigation.getUsedWires(5, commits, builder.getFutureConvertor()).getUsed(), 0,1);
  assertWires(navigation.getUsedWires(6, commits, builder.getFutureConvertor()).getUsed(), 0);

  final Iterator<WireEvent> iterator1 = navigation.createWireEventsIterator(4);
  we = iterator1.next();
  Assert.assertEquals(4, we.getWireEnds()[0]);
  Assert.assertEquals(5, we.getCommitIdx());
  final int[] commitsEnds1 = we.getCommitsEnds();
  Assert.assertEquals(2, commitsEnds1.length);
  Assert.assertEquals(3, commitsEnds1[0]);
  Assert.assertEquals(4, commitsEnds1[1]);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:36,代码来源:SkeletonBuilderTest.java

示例5: testRealMergesAndBranches

import com.intellij.util.containers.ReadonlyList; //导入方法依赖的package包/类
public void testRealMergesAndBranches() throws Exception {
  List<CommitHashPlusParents> list = read("1 2 3\n2 10\n3 4\n4 5 9\n5 6 7\n6 10\n7 8\n8 10\n9 10\n10 11 12\n11 17\n12 13 15\n" +
                                                "13 14\n14 17\n15 16 17\n16 18\n17 18");
  TreeNavigationImpl navigation = new TreeNavigationImpl(20, 20);
  SkeletonBuilder builder = new SkeletonBuilder(navigation);
  ReadonlyList.ArrayListWrapper<CommitI> commits = new ReadonlyList.ArrayListWrapper<CommitI>();
  fillData(list, navigation, builder, commits);

  testRealResults(navigation, commits);

  List<CommitHashPlusParents> list1 = read("1 2 3\n2 10\n3 4\n4 5 9\n5 6 7\n6 10\n7 8\n8 10\n9 10\n10 11 12\n11 17\n12 13 15\n");
  List<CommitHashPlusParents> list2 = read("13 14\n14 17\n15 16 17\n16 18\n17 18");
  navigation = new TreeNavigationImpl(20, 20);
  builder = new SkeletonBuilder(navigation);
  commits = new ReadonlyList.ArrayListWrapper<CommitI>();
  fillData(list1, navigation, builder, commits);
  fillData(list2, navigation, builder, commits);
  testRealResults(navigation, commits);

  list1 = read("1 2 3\n2 10\n3 4\n4 5 9\n5 6 7\n6 10\n7 8\n8 10\n9 10\n10 11 12\n11 17\n12 13 15\n13 14\n14 17\n");
  list2 = read("15 16 17\n16 18\n17 18");
  navigation = new TreeNavigationImpl(20, 20);
  builder = new SkeletonBuilder(navigation);
  commits = new ReadonlyList.ArrayListWrapper<CommitI>();
  fillData(list1, navigation, builder, commits);
  fillData(list2, navigation, builder, commits);
  testRealResults(navigation, commits);

  list1 = read("1 2 3\n2 10\n3 4\n4 5 9\n5 6 7\n6 10\n7 8\n8 10\n9 10\n10 11 12\n11 17\n12 13 15\n13 14\n14 17\n15 16 17\n");
  list2 = read("16 18\n17 18");
  navigation = new TreeNavigationImpl(20, 20);
  builder = new SkeletonBuilder(navigation);
  commits = new ReadonlyList.ArrayListWrapper<CommitI>();
  fillData(list1, navigation, builder, commits);
  fillData(list2, navigation, builder, commits);
  testRealResults(navigation, commits);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:38,代码来源:SkeletonBuilderTest.java

示例6: testTwoSteps

import com.intellij.util.containers.ReadonlyList; //导入方法依赖的package包/类
public void testTwoSteps() throws Exception {
  final List<CommitHashPlusParents> list = read("1 2 3\n2 4\n3 5\n4 6\n5 6\n6 7\n7 8 9");
  final List<CommitHashPlusParents> step2 = read("8 10\n9 11\n10 12\n11 13\n12 14\n13 14\n14 15");
  // 4, 4
  final TreeNavigationImpl navigation = new TreeNavigationImpl(2, 2);
  final SkeletonBuilder builder = new SkeletonBuilder(navigation);
  final ReadonlyList.ArrayListWrapper<CommitI> commits = new ReadonlyList.ArrayListWrapper<CommitI>();
  fillData(list, navigation, builder, commits);

  testFirstStepResults(navigation, commits, builder);
  // end of first step
  fillData(step2, navigation, builder, commits);

  testFirstStepResults(navigation, commits, builder);
  for (int i = 7; i < 14; i++) {
    final CommitI commitI = (CommitI)commits.get(i);
    // just because of the test data order
    Assert.assertEquals("" + (i + 1), commitI.getHash().getString());
  }
  Assert.assertEquals(0, commits.get(7).getWireNumber());
  Assert.assertEquals(1, commits.get(8).getWireNumber());
  Assert.assertEquals(0, commits.get(9).getWireNumber());
  Assert.assertEquals(1, commits.get(10).getWireNumber());
  Assert.assertEquals(0, commits.get(11).getWireNumber());
  Assert.assertEquals(1, commits.get(12).getWireNumber());
  Assert.assertEquals(0, commits.get(13).getWireNumber());

  final Iterator<WireEvent> iterator = navigation.createWireEventsIterator(0);
  testFirstIteratorPart(iterator);
  WireEventI we = iterator.next();

  Assert.assertEquals(6, we.getCommitIdx());
  final int[] commitsStarts = we.getCommitsStarts();
  Assert.assertEquals(2, commitsStarts.length);
  Assert.assertEquals(7, commitsStarts[0]);
  Assert.assertEquals(8, commitsStarts[1]);
  Assert.assertNull(we.getWireEnds());

  we = iterator.next();
  Assert.assertEquals(12, we.getWireEnds()[0]);
  Assert.assertEquals(13, we.getCommitIdx());
  final int[] commitsEnds = we.getCommitsEnds();
  Assert.assertEquals(2, commitsEnds.length);
  Assert.assertEquals(11, commitsEnds[0]);
  Assert.assertEquals(12, commitsEnds[1]);

  assertWires(navigation.getUsedWires(7, commits, builder.getFutureConvertor()).getUsed(),0,1);
  assertWires(navigation.getUsedWires(8, commits, builder.getFutureConvertor()).getUsed(), 0,1);
  assertWires(navigation.getUsedWires(9, commits, builder.getFutureConvertor()).getUsed(), 0,1);
  assertWires(navigation.getUsedWires(10, commits, builder.getFutureConvertor()).getUsed(), 0,1);
  assertWires(navigation.getUsedWires(11, commits, builder.getFutureConvertor()).getUsed(), 0,1);
  assertWires(navigation.getUsedWires(12, commits, builder.getFutureConvertor()).getUsed(), 0,1);
  assertWires(navigation.getUsedWires(13, commits, builder.getFutureConvertor()).getUsed(), 0,1);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:55,代码来源:SkeletonBuilderTest.java

示例7: testTwoStepsMinusLastElement

import com.intellij.util.containers.ReadonlyList; //导入方法依赖的package包/类
public void testTwoStepsMinusLastElement() throws Exception {
  final List<CommitHashPlusParents> list = read("1 2 3\n2 4\n3 5\n4 6\n5 6\n6 7\n7 8 9");
  final List<CommitHashPlusParents> step2 = read("8 10\n9 11\n10 12\n11 13\n12 14\n13 14");
  // 4, 4
  final TreeNavigationImpl navigation = new TreeNavigationImpl(2, 2);
  final SkeletonBuilder builder = new SkeletonBuilder(navigation);
  final ReadonlyList.ArrayListWrapper<CommitI> commits = new ReadonlyList.ArrayListWrapper<CommitI>();
  fillData(list, navigation, builder, commits);

  testFirstStepResults(navigation, commits, builder);
  // end of first step
  fillData(step2, navigation, builder, commits);

  testFirstStepResults(navigation, commits, builder);
  for (int i = 7; i < 13; i++) {
    final CommitI commitI = (CommitI)commits.get(i);
    // just because of the test data order
    Assert.assertEquals("" + (i + 1), commitI.getHash().getString());
  }
  Assert.assertEquals(0, commits.get(7).getWireNumber());
  Assert.assertEquals(1, commits.get(8).getWireNumber());
  Assert.assertEquals(0, commits.get(9).getWireNumber());
  Assert.assertEquals(1, commits.get(10).getWireNumber());
  Assert.assertEquals(0, commits.get(11).getWireNumber());
  Assert.assertEquals(1, commits.get(12).getWireNumber());

  final Iterator<WireEvent> iterator = navigation.createWireEventsIterator(0);
  testFirstIteratorPart(iterator);
  WireEventI we = iterator.next();

  Assert.assertEquals(6, we.getCommitIdx());
  final int[] commitsStarts = we.getCommitsStarts();
  Assert.assertEquals(2, commitsStarts.length);
  Assert.assertEquals(7, commitsStarts[0]);
  Assert.assertEquals(8, commitsStarts[1]);
  Assert.assertNull(we.getWireEnds());

  assertWires(navigation.getUsedWires(7, commits, builder.getFutureConvertor()).getUsed(),0,1);
  assertWires(navigation.getUsedWires(8, commits, builder.getFutureConvertor()).getUsed(), 0,1);
  assertWires(navigation.getUsedWires(9, commits, builder.getFutureConvertor()).getUsed(), 0,1);
  assertWires(navigation.getUsedWires(10, commits, builder.getFutureConvertor()).getUsed(), 0,1);
  assertWires(navigation.getUsedWires(11, commits, builder.getFutureConvertor()).getUsed(), 0,1);
  assertWires(navigation.getUsedWires(12, commits, builder.getFutureConvertor()).getUsed(), 0,1);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:45,代码来源:SkeletonBuilderTest.java

示例8: testBranchAndMerge

import com.intellij.util.containers.ReadonlyList; //导入方法依赖的package包/类
public void testBranchAndMerge() throws Exception {
  final List<CommitHashPlusParents> list = read("1 2\n2 3 4\n3 5\n4 6\n5 7\n6 8\n7 8\n8 9\n9");
  // 4, 4
  final TreeNavigationImpl navigation = new TreeNavigationImpl(2, 2);
  final SkeletonBuilder builder = new SkeletonBuilder(navigation);
  final ReadonlyList.ArrayListWrapper<CommitI> commits = new ReadonlyList.ArrayListWrapper<CommitI>();
  fillData(list, navigation, builder, commits);

  final int[] expectedWireNumbers = {0, 0, 0, 1, 0, 1, 0, 1, 1};
  for (int i = 0; i < 5; i++) {
    final CommitI commitI = (CommitI)commits.get(i);
    // just because of the test data order
    Assert.assertEquals("" + (i + 1), commitI.getHash().getString());
    Assert.assertEquals(expectedWireNumbers[i], commitI.getWireNumber());
  }

  final Iterator<WireEvent> iterator = navigation.createWireEventsIterator(0);
  WireEventI we = iterator.next();
  Assert.assertEquals(true, we.isStart());
  Assert.assertEquals(0, we.getCommitIdx());

  we = iterator.next();
  final int[] commitsStarts = we.getCommitsStarts();
  Assert.assertEquals(2, commitsStarts.length);
  Assert.assertEquals(2, commitsStarts[0]);
  Assert.assertEquals(3, commitsStarts[1]);
  Assert.assertNull(we.getWireEnds());
  Assert.assertEquals(1, we.getCommitIdx());

  we = iterator.next();
  Assert.assertEquals(6, we.getWireEnds()[0]);
  Assert.assertEquals(7, we.getCommitIdx());
  final int[] commitsEnds = we.getCommitsEnds();
  Assert.assertEquals(2, commitsEnds.length);
  Arrays.sort(commitsEnds);
  Assert.assertEquals(5, commitsEnds[0]);
  Assert.assertEquals(6, commitsEnds[1]);

  we = iterator.next();
  Assert.assertEquals(true, we.isEnd());
  Assert.assertEquals(8, we.getCommitIdx());

  assertWires(navigation.getUsedWires(0, commits, builder.getFutureConvertor()).getUsed());
  assertWires(navigation.getUsedWires(1, commits, builder.getFutureConvertor()).getUsed(), 0);
  assertWires(navigation.getUsedWires(2, commits, builder.getFutureConvertor()).getUsed(), 0, 1);
  assertWires(navigation.getUsedWires(3, commits, builder.getFutureConvertor()).getUsed(), 0, 1);
  assertWires(navigation.getUsedWires(4, commits, builder.getFutureConvertor()).getUsed(), 0, 1);
  assertWires(navigation.getUsedWires(5, commits, builder.getFutureConvertor()).getUsed(), 0, 1);
  assertWires(navigation.getUsedWires(6, commits, builder.getFutureConvertor()).getUsed(), 0, 1);
  assertWires(navigation.getUsedWires(7, commits, builder.getFutureConvertor()).getUsed(), 0, 1);  // before wires!
  assertWires(navigation.getUsedWires(8, commits, builder.getFutureConvertor()).getUsed(), 1);

  final Iterator<WireEvent> iterator1 = navigation.createWireEventsIterator(5);
  WireEventI we1 = iterator1.next();

  Assert.assertEquals(6, we1.getWireEnds()[0]);
  Assert.assertEquals(7, we1.getCommitIdx());
  final int[] commitsEnds1 = we1.getCommitsEnds();
  Assert.assertEquals(2, commitsEnds1.length);
  Arrays.sort(commitsEnds);
  Assert.assertEquals(5, commitsEnds1[0]);
  Assert.assertEquals(6, commitsEnds1[1]);

  we1 = iterator1.next();
  Assert.assertEquals(true, we1.isEnd());
  Assert.assertEquals(8, we1.getCommitIdx());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:68,代码来源:SkeletonBuilderTest.java


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