Buffer() public method

public Buffer ( ) : char[]
return char[]
 private void AssertEquals(CharTermAttribute term, string expected)
 {
     assertEquals(expected.Length, term.Length);
     char[] buffer = term.Buffer();
     for (int chIDX = 0; chIDX < expected.Length; chIDX++)
     {
         assertEquals(expected[chIDX], buffer[chIDX]);
     }
 }
Exemplo n.º 2
0
        public virtual void TestClone()
        {
            CharTermAttribute t = new CharTermAttribute();

            char[] content = "hello".ToCharArray();
            t.CopyBuffer(content, 0, 5);
            char[]            buf  = t.Buffer();
            CharTermAttribute copy = TestToken.AssertCloneIsEqual(t);

            Assert.AreEqual(t.ToString(), copy.ToString());
            Assert.AreNotSame(buf, copy.Buffer());
        }
 public virtual void TestResize()
 {
     CharTermAttribute t = new CharTermAttribute();
     char[] content = "hello".ToCharArray();
     t.CopyBuffer(content, 0, content.Length);
     for (int i = 0; i < 2000; i++)
     {
         t.ResizeBuffer(i);
         Assert.IsTrue(i <= t.Buffer().Length);
         Assert.AreEqual("hello", t.ToString());
     }
 }
Exemplo n.º 4
0
        public virtual void TestResize()
        {
            CharTermAttribute t = new CharTermAttribute();

            char[] content = "hello".ToCharArray();
            t.CopyBuffer(content, 0, content.Length);
            for (int i = 0; i < 2000; i++)
            {
                t.ResizeBuffer(i);
                Assert.IsTrue(i <= t.Buffer().Length);
                Assert.AreEqual("hello", t.ToString());
            }
        }
        public virtual void TestCopyTo()
        {
            CharTermAttribute t = new CharTermAttribute();
            CharTermAttribute copy = TestToken.AssertCopyIsEqual(t);
            Assert.AreEqual("", t.ToString());
            Assert.AreEqual("", copy.ToString());

            t = new CharTermAttribute();
            char[] content = "hello".ToCharArray();
            t.CopyBuffer(content, 0, 5);
            char[] buf = t.Buffer();
            copy = TestToken.AssertCopyIsEqual(t);
            Assert.AreEqual(t.ToString(), copy.ToString());
            Assert.AreNotSame(buf, copy.Buffer());
        }