Java 类com.intellij.util.StringConvertion 实例源码

项目:intellij-ce-playground    文件:ByWordTest.java   
public void testExtractWords() {
  String text = "a b, c.d\n\n  x\n y";
  Word[] words = ByWord.buildWords(text, ComparisonPolicy.DEFAULT);
  CHECK.setEquality(new Equality() {
    @Override
    public boolean equals(Object o1, Object o2) {
      Word word1 = (Word)o1;
      Word word2 = (Word)o2;
      return word1.getStart() == word2.getStart() && word1.getEnd() == word2.getEnd();
    }
  });
  CHECK.setStringConvertion(StringConvertion.DEFAULT);
  CHECK.compareAll(new Word[]{new Formatting(text, new TextRange(0, 0)),
                              new Word(text, new TextRange(0, 1)),
                              new Word(text, new TextRange(2, 3)),
                              new Word(text, new TextRange(5, 6)),
                              new Word(text, new TextRange(7, 8)),
                              new Formatting(text, new TextRange(8, 12)),
                              new Word(text, new TextRange(12, 13)),
                              new Formatting(text, new TextRange(13, 15)),
                              new Word(text, new TextRange(15, 16))}, words);
  text = " b c";
  words = ByWord.buildWords(text, ComparisonPolicy.DEFAULT);
  CHECK.compareAll(new Word[]{new Formatting(text, new TextRange(0, 1)),
                              new Word(text, new TextRange(1, 2)),
                              new Word(text, new TextRange(3, 4))}, words);
}
项目:tools-idea    文件:ByWordTest.java   
public void testExtractWords() {
  String text = "a b, c.d\n\n  x\n y";
  Word[] words = ByWord.buildWords(text, ComparisonPolicy.DEFAULT);
  CHECK.setEquality(new Equality() {
    @Override
    public boolean equals(Object o1, Object o2) {
      Word word1 = (Word)o1;
      Word word2 = (Word)o2;
      return word1.getStart() == word2.getStart() && word1.getEnd() == word2.getEnd();
    }
  });
  CHECK.setStringConvertion(StringConvertion.DEFAULT);
  CHECK.compareAll(new Word[]{new Formatting(text, new TextRange(0, 0)),
                              new Word(text, new TextRange(0, 1)),
                              new Word(text, new TextRange(2, 3)),
                              new Word(text, new TextRange(5, 6)),
                              new Word(text, new TextRange(7, 8)),
                              new Formatting(text, new TextRange(8, 12)),
                              new Word(text, new TextRange(12, 13)),
                              new Formatting(text, new TextRange(13, 15)),
                              new Word(text, new TextRange(15, 16))}, words);
  text = " b c";
  words = ByWord.buildWords(text, ComparisonPolicy.DEFAULT);
  CHECK.compareAll(new Word[]{new Formatting(text, new TextRange(0, 1)),
                              new Word(text, new TextRange(1, 2)),
                              new Word(text, new TextRange(3, 4))}, words);
}
项目:consulo    文件:ByWordTest.java   
public void testExtractWords() {
  String text = "a b, c.d\n\n  x\n y";
  Word[] words = ByWord.buildWords(text, ComparisonPolicy.DEFAULT);
  CHECK.setEquality(new Equality() {
    @Override
    public boolean equals(Object o1, Object o2) {
      Word word1 = (Word)o1;
      Word word2 = (Word)o2;
      return word1.getStart() == word2.getStart() && word1.getEnd() == word2.getEnd();
    }
  });
  CHECK.setStringConvertion(StringConvertion.DEFAULT);
  CHECK.compareAll(new Word[]{new Formatting(text, new TextRange(0, 0)),
                              new Word(text, new TextRange(0, 1)),
                              new Word(text, new TextRange(2, 3)),
                              new Word(text, new TextRange(5, 6)),
                              new Word(text, new TextRange(7, 8)),
                              new Formatting(text, new TextRange(8, 12)),
                              new Word(text, new TextRange(12, 13)),
                              new Formatting(text, new TextRange(13, 15)),
                              new Word(text, new TextRange(15, 16))}, words);
  text = " b c";
  words = ByWord.buildWords(text, ComparisonPolicy.DEFAULT);
  CHECK.compareAll(new Word[]{new Formatting(text, new TextRange(0, 1)),
                              new Word(text, new TextRange(1, 2)),
                              new Word(text, new TextRange(3, 4))}, words);
}