예제 #1
0
파일: ColumnFixture.cs 프로젝트: juherr/fit
        // Utility //////////////////////////////////

        protected virtual void bind(Parse heads)
        {
            columnBindings = new TypeAdapter[heads.size()];
            for (int i = 0; heads != null; i++, heads = heads.more)
            {
                String name   = heads.text();
                String suffix = "()";
                try {
                    if (name == "")
                    {
                        columnBindings[i] = null;
                    }
                    else if (name.EndsWith(suffix))
                    {
                        columnBindings[i] = bindMethod(name.Substring(0, name.Length - suffix.Length));
                    }
                    else
                    {
                        columnBindings[i] = bindField(name);
                    }
                }
                catch (Exception e) {
                    exception(heads, e);
                }
            }
        }
예제 #2
0
파일: FrameworkTest.cs 프로젝트: juherr/fit
 public void testIndexing()
 {
     Parse p = new Parse("leader<table><tr><td>one</td><td>two</td><td>three</td></tr><tr><td>four</td></tr></table>trailer");
     Assert.AreEqual("one", p.at(0,0,0).body);
     Assert.AreEqual("two", p.at(0,0,1).body);
     Assert.AreEqual("three", p.at(0,0,2).body);
     Assert.AreEqual("three", p.at(0,0,3).body);
     Assert.AreEqual("three", p.at(0,0,4).body);
     Assert.AreEqual("four", p.at(0,1,0).body);
     Assert.AreEqual("four", p.at(0,1,1).body);
     Assert.AreEqual("four", p.at(0,2,0).body);
     Assert.AreEqual(1, p.size());
     Assert.AreEqual(2, p.parts.size());
     Assert.AreEqual(3, p.parts.parts.size());
     Assert.AreEqual("one", p.leaf().body);
     Assert.AreEqual("four", p.parts.last().leaf().body);
 }
예제 #3
0
        public void testIndexing()
        {
            Parse p = new Parse("leader<table><tr><td>one</td><td>two</td><td>three</td></tr><tr><td>four</td></tr></table>trailer");

            Assert.AreEqual("one", p.at(0, 0, 0).body);
            Assert.AreEqual("two", p.at(0, 0, 1).body);
            Assert.AreEqual("three", p.at(0, 0, 2).body);
            Assert.AreEqual("three", p.at(0, 0, 3).body);
            Assert.AreEqual("three", p.at(0, 0, 4).body);
            Assert.AreEqual("four", p.at(0, 1, 0).body);
            Assert.AreEqual("four", p.at(0, 1, 1).body);
            Assert.AreEqual("four", p.at(0, 2, 0).body);
            Assert.AreEqual(1, p.size());
            Assert.AreEqual(2, p.parts.size());
            Assert.AreEqual(3, p.parts.parts.size());
            Assert.AreEqual("one", p.leaf().body);
            Assert.AreEqual("four", p.parts.last().leaf().body);
        }
예제 #4
0
파일: Parse.cs 프로젝트: juherr/fit
 public virtual int size()
 {
     return(more == null ? 1 : more.size() + 1);
 }
예제 #5
0
파일: ColumnFixture.cs 프로젝트: juherr/fit
 // Utility //////////////////////////////////
 protected virtual void bind(Parse heads)
 {
     columnBindings = new TypeAdapter[heads.size()];
     for (int i=0; heads!=null; i++, heads=heads.more) {
         String name = heads.text();
         String suffix = "()";
         try {
             if (name == "") {
                 columnBindings[i] = null;
             }
             else if (name.EndsWith(suffix)) {
                 columnBindings[i] = bindMethod(name.Substring(0,name.Length-suffix.Length));
             }
             else {
                 columnBindings[i] = bindField(name);
             }
         }
         catch (Exception e) {
             exception (heads, e);
         }
     }
 }