Java 类javax.swing.text.html.parser.Element 实例源码

项目:javify    文件:Parser.java   
/**
 * Handle attribute without value. The default method uses
 * the only allowed attribute value from DTD.
 * If the attribute is unknown or allows several values,
 * the HTML.NULL_ATTRIBUTE_VALUE is used. The attribute with
 * this value is added to the attribute set.
 * @param element The name of element.
 * @param attribute The name of attribute without value.
 */
protected void noValueAttribute(String element, String attribute)
{
  Object value = HTML.NULL_ATTRIBUTE_VALUE;

  Element e = dtd.elementHash.get(element.toLowerCase());
  if (e != null)
    {
      AttributeList attr = e.getAttribute(attribute);
      if (attr != null)
        {
          Vector values = attr.values;
          if (values != null && values.size() == 1)
            value = values.get(0);
        }
    }
  attributes.addAttribute(attribute, value);
}
项目:javify    文件:Parser.java   
private TagElement makeTagElement(String name, boolean isSupposed)
{
  Element e = dtd.elementHash.get(name.toLowerCase());
  if (e == null)
    {
      error("Unknown tag <" + name + ">");
      e = dtd.getElement(name);
      e.name = name.toUpperCase();
      e.index = -1;
    }

  if (!documentTags.contains(e.name))
    {
      markFirstTime(e);
      documentTags.add(e.name);
    }

  return makeTag(e, isSupposed);
}
项目:jvm-stm    文件:Parser.java   
/**
 * Handle attribute without value. The default method uses
 * the only allowed attribute value from DTD.
 * If the attribute is unknown or allows several values,
 * the HTML.NULL_ATTRIBUTE_VALUE is used. The attribute with
 * this value is added to the attribute set.
 * @param element The name of element.
 * @param attribute The name of attribute without value.
 */
protected void noValueAttribute(String element, String attribute)
{
  Object value = HTML.NULL_ATTRIBUTE_VALUE;

  Element e = dtd.elementHash.get(element.toLowerCase());
  if (e != null)
    {
      AttributeList attr = e.getAttribute(attribute);
      if (attr != null)
        {
          Vector values = attr.values;
          if (values != null && values.size() == 1)
            value = values.get(0);
        }
    }
  attributes.addAttribute(attribute, value);
}
项目:jvm-stm    文件:Parser.java   
private TagElement makeTagElement(String name, boolean isSupposed)
{
  Element e = dtd.elementHash.get(name.toLowerCase());
  if (e == null)
    {
      error("Unknown tag <" + name + ">");
      e = dtd.getElement(name);
      e.name = name.toUpperCase();
      e.index = -1;
    }

  if (!documentTags.contains(e.name))
    {
      markFirstTime(e);
      documentTags.add(e.name);
    }

  return makeTag(e, isSupposed);
}
项目:cn1    文件:ContentModelCompatilityTest.java   
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.ContentModel(Element)'*
 * ContentModel(Element( "elemento",',',false,false,('*',new
 * ContentModel()),BitSet(0).set(1),BitSet(168).set(45),AttributeList("1") .
 * It checks if an instance is created, content is equal to el ,type is 0
 * and next is null.
 */
public void testContentModelElement003() {
    dtd = new DTDGetter("TestContentModelSemantic");
    ContentModel cm2 = new ContentModel('*', new ContentModel());
    BitSet bs1 = new BitSet(0);
    bs1.set(1);
    BitSet bs2 = new BitSet(168);
    bs2.set(45);
    AttributeList al = new AttributeList("1");
    Element el = dtd.defineElement("elemento", ',', false, false, cm2,
            bs1, bs2, al);
    cm = new ContentModel(el);
    assertNotNull(cm);
    assertEquals(el, cm.content);
    assertEquals(cm2, el.content);
    assertEquals(el, cm.content);
    assertEquals(0, cm.type);
    assertNull(cm.next);
}
项目:cn1    文件:ContentModelCompatilityTest.java   
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.ContentModel(Element)'*
 * ContentModel(Element( "",',',false,false,('*',new
 * ContentModel()),BitSet(128).set(1),BitSet(7),AttributeList("bigC",-2147483648,-1,"value",new
 * Vector(),new AttributeList(null)) . It checks if an instance is created,
 * content is equal to el ,type is 0 and next is null.
 */
public void testContentModelElement004() {
    dtd = new DTDGetter("TestContentModelSemantic");
    ContentModel cm2 = new ContentModel('*', new ContentModel());
    BitSet bs1 = new BitSet(128);
    bs1.set(1);
    BitSet bs2 = new BitSet(7);
    AttributeList al = new AttributeList("bigC", -2147483648, -1,
            "value", new Vector(), new AttributeList(null));
    Element el = dtd.defineElement("", '*', true, false, cm2, bs1, bs2,
            al);
    cm = new ContentModel(el);
    assertNotNull(cm);
    assertEquals(el, cm.content);
    assertEquals(cm2, el.content);
    assertEquals(el, cm.content);
    assertEquals(0, cm.type);
    assertNull(cm.next);
}
项目:cn1    文件:ContentModelCompatilityTest.java   
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.ContentModel(int, Object,
 * ContentModel)' Parameters type=-38, (element is defined in a dtd as el=
 * "elemento",',',false,false,('*',new
 * ContentModel()),BitSet(0).set(1),BitSet(168).set(45),AttributeList("1")),
 * null Verifies that an instance is created. content is equal to element,
 * type is -38 and next is null
 */
public void testContentModelIntObjectContentModel045() {
    dtd = new DTDGetter("TestContentModelSemantic");
    ContentModel cm2 = new ContentModel('*', new ContentModel());
    BitSet bs1 = new BitSet(0);
    bs1.set(1);
    BitSet bs2 = new BitSet(168);
    bs2.set(45);
    AttributeList al = new AttributeList("1");
    Element el = dtd.defineElement("elemento", ',', false, false, cm2,
            bs1, bs2, al);
    cm = new ContentModel(-38, el, null);
    assertNotNull(cm);
    assertEquals(el, cm.content);
    assertEquals(-38, cm.type);
    assertNull(cm.next);
}
项目:cn1    文件:ContentModelCompatilityTest.java   
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.ContentModel(int, Object,
 * ContentModel)' Parameters type=Integer.MIN_VALUE, el=
 * "",',',false,false,('*',new
 * ContentModel()),BitSet(128).set(1),BitSet(7),AttributeList("bigC",-2147483648,-1,"value",new
 * Vector(),new AttributeList(null)), null Verifies that an instance is
 * created. content is equal to el= "",',',false,false,('*',new
 * ContentModel()),BitSet(128).set(1),BitSet(7),AttributeList("bigC",-2147483648,-1,"value",new
 * Vector(),new AttributeList(null)), type is Integer.MIN_VALUE and next is
 * null
 */
public void testContentModelIntObjectContentModel047() {
    dtd = new DTDGetter("TestContentModelSemantic");
    ContentModel cm2 = new ContentModel('*', new ContentModel());
    BitSet bs1 = new BitSet(128);
    bs1.set(1);
    BitSet bs2 = new BitSet(7);
    AttributeList al = new AttributeList("bigC", -2147483648, -1,
            "value", new Vector(), new AttributeList(null));
    Element el = dtd.defineElement("", '*', true, false, cm2, bs1, bs2,
            al);
    cm = new ContentModel(Integer.MIN_VALUE, el, null);
    assertNotNull(cm);
    assertEquals(el, cm.content);
    assertEquals(Integer.MIN_VALUE, cm.type);
    assertNull(cm.next);
}
项目:cn1    文件:ContentModelCompatilityTest.java   
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.ContentModel(int, Object,
 * ContentModel)' Parameters type=Integer.MIN_VALUE, el=
 * "",',',false,false,('*',new
 * ContentModel()),BitSet(128).set(1),BitSet(7),AttributeList("bigC",-2147483648,-1,"value",new
 * Vector(),new AttributeList(null)), new ContentModel() Verifies that an
 * instance is created. content is equal to el= "",',',false,false,('*',new
 * ContentModel()),BitSet(128).set(1),BitSet(7),AttributeList("bigC",-2147483648,-1,"value",new
 * Vector(),new AttributeList(null)), type is Integer.MIN_VALUE and next is
 * new ContentModel()
 */
public void testContentModelIntObjectContentModel080() {
    dtd = new DTDGetter("TestContentModelSemantic");
    ContentModel cmnext = new ContentModel();
    ContentModel cm2 = new ContentModel('*', new ContentModel());
    BitSet bs1 = new BitSet(128);
    bs1.set(1);
    BitSet bs2 = new BitSet(7);
    AttributeList al = new AttributeList("bigC", -2147483648, -1,
            "value", new Vector(), new AttributeList(null));
    Element el = dtd.defineElement("", '*', true, false, cm2, bs1, bs2,
            al);
    cm = new ContentModel(Integer.MIN_VALUE, el, cmnext);
    assertNotNull(cm);
    assertEquals(el, cm.content);
    assertEquals(Integer.MIN_VALUE, cm.type);
    assertEquals(cmnext, cm.next);
}
项目:cn1    文件:ContentModelCompatilityTest.java   
/**
 * Test method for 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.toString()'
 * ContentModel(Element("",'*',true,false,cm2,bs1,bs2,al)) ""
 */

public void testToString005() {
    dtd = new DTDGetter("TestContentModelSemantic");
    ContentModel cm2 = new ContentModel('*', new ContentModel());
    BitSet bs1 = new BitSet(128);
    bs1.set(1);
    BitSet bs2 = new BitSet(7);
    AttributeList al = new AttributeList("bigC", -2147483648, -1,
            "value", new Vector(), new AttributeList(null));
    Element el = dtd.defineElement("", '*', true, false, cm2, bs1, bs2,
            al);
    cm = new ContentModel(el);

    assertEquals("", cm.toString());
}
项目:cn1    文件:ContentModelCompatilityTest.java   
/**
 * Test method for 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.first(Object)'
 * ContentModel("elemento",',',false,false,('*',new
 * ContentModel()),BitSet(0).set(1),BitSet(168).set(45),AttributeList("1"))
 * "elemento",',',false,false,('*',new
 * ContentModel()),BitSet(0).set(1),BitSet(168).set(45),AttributeList("1")
 * Expected: true
 */
public void testFirstObject005() {
    dtd = new DTDGetter("TestContentModelSemantic");
    ContentModel cm2 = new ContentModel('*', new ContentModel());
    BitSet bs1 = new BitSet(0);
    bs1.set(1);
    BitSet bs2 = new BitSet(168);
    bs2.set(45);
    AttributeList al = new AttributeList("1");
    Element el = dtd.defineElement("elemento", ',', false, false, cm2,
            bs1, bs2, al);
    cm = new ContentModel(el);
    assertTrue(cm.first(el));
    assertFalse(cm.first(cm));
    assertFalse(cm.first(cm2));
    assertFalse(cm.first(dtd));

    assertFalse(cm.first(bs1));
    assertFalse(cm.first(bs2));
    assertFalse(cm.first(al));
    assertFalse(cm.first(""));
    assertFalse(cm.first("elemento"));
    assertFalse(cm.first(null));
}
项目:cn1    文件:ContentModelCompatilityTest.java   
/**
 * Test method for 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.first(Object)'
 * ContentModel("",',',false,false,('*',new
 * ContentModel()),BitSet(128).set(1),BitSet(7),AttributeList("bigC",-2147483648,-1,"value",new
 * Vector(),new AttributeList(null))) "",',',false,false,('*',new
 * ContentModel()),BitSet(128).set(1),BitSet(7),AttributeList("bigC",-2147483648,-1,"value",new
 * Vector(),new AttributeList(null)) Expected: true
 */

public void testFirstObject006() {
    dtd = new DTDGetter("TestContentModelSemantic");
    ContentModel cm2 = new ContentModel('*', new ContentModel());
    BitSet bs1 = new BitSet(128);
    bs1.set(1);
    BitSet bs2 = new BitSet(7);
    AttributeList al = new AttributeList("bigC", -2147483648, -1,
            "value", new Vector(), new AttributeList(null));
    Element el = dtd.defineElement("", '*', true, false, cm2, bs1, bs2,
            al);
    cm = new ContentModel(el);
    assertTrue(cm.first(el));
    assertFalse(cm.first(cm));
    assertFalse(cm.first(cm2));
    assertFalse(cm.first(dtd));

    assertFalse(cm.first(bs1));
    assertFalse(cm.first(bs2));
    assertFalse(cm.first(al));
    assertFalse(cm.first(""));
    assertFalse(cm.first(null));
}
项目:cn1    文件:ContentModelCompatilityTest.java   
/**
 * Test method for 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.first(Object)'
 * ContentModel(0,ContentModel(Element("1",0,true,true,null,null,null,null)))
 * parameter: ContentModel(Element("1",0,true,true,null,null,null,null))
 * expected: true
 */

public void testFirstObject042() {
    dtd = new DTDGetter("TestContentModelSemantic");
    Element el = dtd.defineElement("1", 0, true, true, null, null,
            null, null);
    cm = new ContentModel(el);
    ContentModel cm2 = new ContentModel(0, cm);
    assertTrue(cm2.first(cm));
    assertFalse(cm2.first(cm2));
    assertFalse(cm2.first(el));
    assertFalse(cm2.first(""));
    assertFalse(cm2.first("1"));

    assertFalse(cm2.first(dtd));
    assertFalse(cm2.first(null));
}
项目:cn1    文件:ContentModelCompatilityTest.java   
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.getElements(Vector)'
 * ContentModel("elemento",',',false,false,('*',new
 * ContentModel()),BitSet(0).set(1),BitSet(168).set(45),AttributeList("1")).getElements(null)
 * Expected: NullPointerException
 */
public void testGetElements004() {
    try {
        dtd = new DTDGetter("TestContentModelSemantic");
        ContentModel cm2 = new ContentModel('*', new ContentModel());
        BitSet bs1 = new BitSet(0);
        bs1.set(1);
        BitSet bs2 = new BitSet(168);
        bs2.set(45);
        AttributeList al = new AttributeList("1");
        Element el = dtd.defineElement("elemento", ',', false, false, cm2,
                bs1, bs2, al);
        cm = new ContentModel(el);

        cm.getElements(null);

        fail("Should raise NullPointerException");
    } catch (NullPointerException e) {
        // Expected
    }
}
项目:cn1    文件:ContentModelCompatilityTest.java   
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.getElements(Vector)'
 * ContentModel("",',',false,false,('*',new
 * ContentModel()),BitSet(128).set(1),BitSet(7),AttributeList("bigC",-2147483648,-1,"value",new
 * Vector(),new AttributeList(null)).getElements(null) Expected:
 * NullPointerException
 */
public void testGetElements005() {
    try {
        dtd = new DTDGetter("TestContentModelSemantic");
        ContentModel cm2 = new ContentModel('*', new ContentModel());
        BitSet bs1 = new BitSet(128);
        bs1.set(1);
        BitSet bs2 = new BitSet(7);
        AttributeList al = new AttributeList("bigC", -2147483648, -1,
                "value", new Vector(), new AttributeList(null));
        Element el = dtd.defineElement("", '*', true, false, cm2, bs1, bs2,
                al);
        cm = new ContentModel(el);
        cm.getElements(null);
        fail("Should raise NullPointerException");
    } catch (NullPointerException e) {
        // Expected
    }
}
项目:cn1    文件:ContentModelCompatilityTest.java   
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.getElements(Vector)'
 * ContentModel("elemento",',',false,false,('*',new
 * ContentModel()),BitSet(0).set(1),BitSet(168).set(45),AttributeList("1")).getElements(new
 * Vector()) Expected: "elemento"
 */
public void testGetElements010() {
    dtd = new DTDGetter("TestContentModelSemantic");
    ContentModel cm2 = new ContentModel('*', new ContentModel());
    BitSet bs1 = new BitSet(0);
    bs1.set(1);
    BitSet bs2 = new BitSet(168);
    bs2.set(45);
    AttributeList al = new AttributeList("1");
    Element el = dtd.defineElement("elemento", ',', false, false, cm2,
            bs1, bs2, al);
    cm = new ContentModel(el);
    Vector v = new Vector();
    cm.getElements(v);
    assertEquals("[elemento]", v.toString());
}
项目:cn1    文件:ContentModelCompatilityTest.java   
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.getElements(Vector)'
 * ContentModel("",',',false,false,('*',new
 * ContentModel()),BitSet(128).set(1),BitSet(7),AttributeList("bigC",-2147483648,-1,"value",new
 * Vector(),new AttributeList(null)).getElements(new Vector()) Expected: ""
 */
public void testGetElements011() {
    dtd = new DTDGetter("TestContentModelSemantic");
    ContentModel cm2 = new ContentModel('*', new ContentModel());
    BitSet bs1 = new BitSet(128);
    bs1.set(1);
    BitSet bs2 = new BitSet(7);
    AttributeList al = new AttributeList("bigC", -2147483648, -1,
            "value", new Vector(), new AttributeList(null));
    Element el = dtd.defineElement("", '*', true, false, cm2, bs1, bs2,
            al);
    cm = new ContentModel(el);
    Vector v = new Vector();
    cm.getElements(v);
    assertEquals("[]", v.toString());
}
项目:cn1    文件:ContentModelCompatilityTest.java   
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.getElements(Vector)'
 * ContentModel("elemento",',',false,false,('*',new
 * ContentModel()),BitSet(0).set(1),BitSet(168).set(45),AttributeList("1")).getElements(new
 * Vector()) method is called 4 times Expected: "[elemento, elemento,
 * elemento, elemento]"
 */
public void testGetElements014() {
    dtd = new DTDGetter("TestContentModelSemantic");
    ContentModel cm2 = new ContentModel('*', new ContentModel());
    BitSet bs1 = new BitSet(0);
    bs1.set(1);
    BitSet bs2 = new BitSet(168);
    bs2.set(45);
    AttributeList al = new AttributeList("1");
    Element el = dtd.defineElement("elemento", ',', false, false, cm2,
            bs1, bs2, al);
    cm = new ContentModel(el);
    Vector v = new Vector();
    cm.getElements(v);
    cm.getElements(v);
    cm.getElements(v);
    cm.getElements(v);
    assertEquals("[elemento, elemento, elemento, elemento]", v
            .toString());
}
项目:JamVM-PH    文件:Parser.java   
/**
 * Handle attribute without value. The default method uses
 * the only allowed attribute value from DTD.
 * If the attribute is unknown or allows several values,
 * the HTML.NULL_ATTRIBUTE_VALUE is used. The attribute with
 * this value is added to the attribute set.
 * @param element The name of element.
 * @param attribute The name of attribute without value.
 */
protected void noValueAttribute(String element, String attribute)
{
  Object value = HTML.NULL_ATTRIBUTE_VALUE;

  Element e = dtd.elementHash.get(element.toLowerCase());
  if (e != null)
    {
      AttributeList attr = e.getAttribute(attribute);
      if (attr != null)
        {
          Vector values = attr.values;
          if (values != null && values.size() == 1)
            value = values.get(0);
        }
    }
  attributes.addAttribute(attribute, value);
}
项目:JamVM-PH    文件:Parser.java   
private TagElement makeTagElement(String name, boolean isSupposed)
{
  Element e = dtd.elementHash.get(name.toLowerCase());
  if (e == null)
    {
      error("Unknown tag <" + name + ">");
      e = dtd.getElement(name);
      e.name = name.toUpperCase();
      e.index = -1;
    }

  if (!documentTags.contains(e.name))
    {
      markFirstTime(e);
      documentTags.add(e.name);
    }

  return makeTag(e, isSupposed);
}
项目:freeVM    文件:ContentModelCompatilityTest.java   
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.ContentModel(int, Object,
 * ContentModel)' Parameters type=-38, (element is defined in a dtd as el=
 * "elemento",',',false,false,('*',new
 * ContentModel()),BitSet(0).set(1),BitSet(168).set(45),AttributeList("1")),
 * null Verifies that an instance is created. content is equal to element,
 * type is -38 and next is null
 */
public void testContentModelIntObjectContentModel045() {
    dtd = new DTDGetter("TestContentModelSemantic");
    ContentModel cm2 = new ContentModel('*', new ContentModel());
    BitSet bs1 = new BitSet(0);
    bs1.set(1);
    BitSet bs2 = new BitSet(168);
    bs2.set(45);
    AttributeList al = new AttributeList("1");
    Element el = dtd.defineElement("elemento", ',', false, false, cm2,
            bs1, bs2, al);
    cm = new ContentModel(-38, el, null);
    assertNotNull(cm);
    assertEquals(el, cm.content);
    assertEquals(-38, cm.type);
    assertNull(cm.next);
}
项目:freeVM    文件:ContentModelCompatilityTest.java   
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.ContentModel(Element)'*
 * ContentModel(Element( "",',',false,false,('*',new
 * ContentModel()),BitSet(128).set(1),BitSet(7),AttributeList("bigC",-2147483648,-1,"value",new
 * Vector(),new AttributeList(null)) . It checks if an instance is created,
 * content is equal to el ,type is 0 and next is null.
 */
public void testContentModelElement004() {
    dtd = new DTDGetter("TestContentModelSemantic");
    ContentModel cm2 = new ContentModel('*', new ContentModel());
    BitSet bs1 = new BitSet(128);
    bs1.set(1);
    BitSet bs2 = new BitSet(7);
    AttributeList al = new AttributeList("bigC", -2147483648, -1,
            "value", new Vector(), new AttributeList(null));
    Element el = dtd.defineElement("", '*', true, false, cm2, bs1, bs2,
            al);
    cm = new ContentModel(el);
    assertNotNull(cm);
    assertEquals(el, cm.content);
    assertEquals(cm2, el.content);
    assertEquals(el, cm.content);
    assertEquals(0, cm.type);
    assertNull(cm.next);
}
项目:classpath    文件:Parser.java   
/**
 * Handle attribute without value. The default method uses
 * the only allowed attribute value from DTD.
 * If the attribute is unknown or allows several values,
 * the HTML.NULL_ATTRIBUTE_VALUE is used. The attribute with
 * this value is added to the attribute set.
 * @param element The name of element.
 * @param attribute The name of attribute without value.
 */
protected void noValueAttribute(String element, String attribute)
{
  Object value = HTML.NULL_ATTRIBUTE_VALUE;

  Element e = dtd.elementHash.get(element.toLowerCase());
  if (e != null)
    {
      AttributeList attr = e.getAttribute(attribute);
      if (attr != null)
        {
          Vector values = attr.values;
          if (values != null && values.size() == 1)
            value = values.get(0);
        }
    }
  attributes.addAttribute(attribute, value);
}
项目:freeVM    文件:ContentModelCompatilityTest.java   
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.getElements(Vector)'
 * ContentModel("",',',false,false,('*',new
 * ContentModel()),BitSet(128).set(1),BitSet(7),AttributeList("bigC",-2147483648,-1,"value",new
 * Vector(),new AttributeList(null)).getElements(new Vector()) Expected: ""
 */
public void testGetElements011() {
    dtd = new DTDGetter("TestContentModelSemantic");
    ContentModel cm2 = new ContentModel('*', new ContentModel());
    BitSet bs1 = new BitSet(128);
    bs1.set(1);
    BitSet bs2 = new BitSet(7);
    AttributeList al = new AttributeList("bigC", -2147483648, -1,
            "value", new Vector(), new AttributeList(null));
    Element el = dtd.defineElement("", '*', true, false, cm2, bs1, bs2,
            al);
    cm = new ContentModel(el);
    Vector v = new Vector();
    cm.getElements(v);
    assertEquals("[]", v.toString());
}
项目:freeVM    文件:ContentModelCompatilityTest.java   
/**
 * Test method for 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.first(Object)'
 * ContentModel(0,ContentModel(Element("1",0,true,true,null,null,null,null)))
 * parameter: ContentModel(Element("1",0,true,true,null,null,null,null))
 * expected: true
 */

public void testFirstObject042() {
    dtd = new DTDGetter("TestContentModelSemantic");
    Element el = dtd.defineElement("1", 0, true, true, null, null,
            null, null);
    cm = new ContentModel(el);
    ContentModel cm2 = new ContentModel(0, cm);
    assertTrue(cm2.first(cm));
    assertFalse(cm2.first(cm2));
    assertFalse(cm2.first(el));
    assertFalse(cm2.first(""));
    assertFalse(cm2.first("1"));

    assertFalse(cm2.first(dtd));
    assertFalse(cm2.first(null));
}
项目:freeVM    文件:ContentModelCompatilityTest.java   
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.ContentModel(int,
 * ContentModel)' ContentModel(Element( "1",0,true,true,null,null,null,null ,
 * and a contentmodel is created. Then ContentModel(0,contentmodel) is
 * instanciated It checks if an instance is created, content is equal to el
 * ,type is 0 and next is null.
 */
public void testContentModelIntContentModel036() {
    try {
        dtd = new DTDGetter("TestContentModelSemantic");
        Element el = dtd.defineElement("1", 0, true, true, null, null,
                null, null);
        cm = new ContentModel(el);
        ContentModel cm2 = new ContentModel(0, cm);
        assertNotNull(cm2);

        assertEquals(cm, cm2.content);
        assertEquals(0, cm2.type);
        assertNull(cm2.next);
    } catch (Exception e) {
        fail("Should not throw any exception but was: " + e);
    }
}
项目:freeVM    文件:ContentModelCompatilityTest.java   
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.ContentModel(int, Object,
 * ContentModel)' Parameters type=0,
 * ContentModel(Element:"elemento",',',false,false,('*',new
 * ContentModel('*',new
 * ContentModel()),BitSet(0).set(1),BitSet(168).set(45),AttributeList("1")),
 * null Verifies that an instance is created. content is equal to null, type
 * is 0 and next is null
 */
public void testContentModelIntObjectContentModel046() {
    try {
        dtd = new DTDGetter("TestContentModelSemantic");
        ContentModel cm2 = new ContentModel('*', new ContentModel());
        BitSet bs1 = new BitSet(3);
        bs1.set(1);
        BitSet bs2 = new BitSet(168);
        bs2.set(45);
        AttributeList al = new AttributeList("1");
        Element el = dtd.defineElement("elemento", '.', false, false, cm2,
                bs1, bs2, al);
        cm2 = new ContentModel(el);
        cm = new ContentModel(0, cm2, null);
        assertNotNull(cm);
        assertEquals(cm2, cm.content);
        assertEquals(0, cm.type);
        assertNull(cm.next);
    } catch (Exception e) {
        fail("Should not throw any exception but was: " + e);
    }
}
项目:freeVM    文件:ContentModelCompatilityTest.java   
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.ContentModel(int, Object,
 * ContentModel)' Parameters type=Integer.MIN_VALUE, el=
 * "",',',false,false,('*',new
 * ContentModel()),BitSet(128).set(1),BitSet(7),AttributeList("bigC",-2147483648,-1,"value",new
 * Vector(),new AttributeList(null)), null Verifies that an instance is
 * created. content is equal to el= "",',',false,false,('*',new
 * ContentModel()),BitSet(128).set(1),BitSet(7),AttributeList("bigC",-2147483648,-1,"value",new
 * Vector(),new AttributeList(null)), type is Integer.MIN_VALUE and next is
 * null
 */
public void testContentModelIntObjectContentModel047() {
    try {
        dtd = new DTDGetter("TestContentModelSemantic");
        ContentModel cm2 = new ContentModel('*', new ContentModel());
        BitSet bs1 = new BitSet(128);
        bs1.set(1);
        BitSet bs2 = new BitSet(7);
        AttributeList al = new AttributeList("bigC", -2147483648, -1,
                "value", new Vector(), new AttributeList(null));
        Element el = dtd.defineElement("", '*', true, false, cm2, bs1, bs2,
                al);
        cm = new ContentModel(Integer.MIN_VALUE, el, null);
        assertNotNull(cm);
        assertEquals(el, cm.content);
        assertEquals(Integer.MIN_VALUE, cm.type);
        assertNull(cm.next);
    } catch (Exception e) {
        fail("Should not throw any exception but was: " + e);
    }
}
项目:freeVM    文件:ContentModelCompatilityTest.java   
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.ContentModel(int, Object,
 * ContentModel)' Parameters type=42, ContentModel(
 * "elemento",',',false,false,('*',new
 * ContentModel()),BitSet(0).set(1),BitSet(168).set(45),AttributeList("1")),
 * null Verifies that an instance is created. content is equal to
 * ContentModel(("elemento",',',false,false,cm2,bs1,bs2,al)), type is 42 and
 * next is null
 */
public void testContentModelIntObjectContentModel049() {
    try {
        dtd = new DTDGetter("TestContentModelSemantic");
        ContentModel cm2 = new ContentModel('*', new ContentModel());
        BitSet bs1 = new BitSet(0);
        bs1.set(1);
        BitSet bs2 = new BitSet(168);
        bs2.set(45);
        AttributeList al = new AttributeList("1");
        Element el = dtd.defineElement("elemento", ',', false, false, cm2,
                bs1, bs2, al);
        cm2 = new ContentModel(el);

        cm = new ContentModel(42, cm2, null);
        assertNotNull(cm);
        assertEquals(cm2, cm.content);
        assertEquals(42, cm.type);
        assertNull(cm.next);
    } catch (Exception e) {
        fail("Should not throw any exception but was: " + e);
    }
}
项目:freeVM    文件:ContentModelCompatilityTest.java   
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.ContentModel(int, Object,
 * ContentModel)' Parameters type=Integer.MIN_VALUE, el=
 * "",',',false,false,('*',new
 * ContentModel()),BitSet(128).set(1),BitSet(7),AttributeList("bigC",-2147483648,-1,"value",new
 * Vector(),new AttributeList(null)), new ContentModel() Verifies that an
 * instance is created. content is equal to el= "",',',false,false,('*',new
 * ContentModel()),BitSet(128).set(1),BitSet(7),AttributeList("bigC",-2147483648,-1,"value",new
 * Vector(),new AttributeList(null)), type is Integer.MIN_VALUE and next is
 * new ContentModel()
 */
public void testContentModelIntObjectContentModel080() {
    try {
        dtd = new DTDGetter("TestContentModelSemantic");
        ContentModel cmnext = new ContentModel();
        ContentModel cm2 = new ContentModel('*', new ContentModel());
        BitSet bs1 = new BitSet(128);
        bs1.set(1);
        BitSet bs2 = new BitSet(7);
        AttributeList al = new AttributeList("bigC", -2147483648, -1,
                "value", new Vector(), new AttributeList(null));
        Element el = dtd.defineElement("", '*', true, false, cm2, bs1, bs2,
                al);
        cm = new ContentModel(Integer.MIN_VALUE, el, cmnext);
        assertNotNull(cm);
        assertEquals(el, cm.content);
        assertEquals(Integer.MIN_VALUE, cm.type);
        assertEquals(cmnext, cm.next);
    } catch (Exception e) {
        fail("Should not throw any exception but was: " + e);
    }
}
项目:freeVM    文件:ContentModelCompatilityTest.java   
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.ContentModel(int, Object,
 * ContentModel)' Parameters type=Integer.MAX_VALUE,
 * Element("1",0,true,true,null,null,null,null), new ContentModel() Verifies
 * that an instance is created. content is equal to
 * Element("1",0,true,true,null,null,null,null), type is Integer.MAX_VALUE
 * and next is new ContentModel()
 */
public void testContentModelIntObjectContentModel081() {
    try {
        ContentModel cmnext = new ContentModel();
        dtd = new DTDGetter("TestContentModelSemantic");
        Element el = dtd.defineElement("1", 0, true, true, null, null,
                null, null);
        cm = new ContentModel(Integer.MAX_VALUE, el, cmnext);
        assertNotNull(cm);
        assertEquals(el, cm.content);
        assertEquals(Integer.MAX_VALUE, cm.type);
        assertEquals(cmnext, cm.next);
    } catch (Exception e) {
        fail("Should not throw any exception but was: " + e);
    }
}
项目:freeVM    文件:ContentModelCompatilityTest.java   
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.ContentModel(int, Object,
 * ContentModel)' Parameters type=42, ContentModel(
 * "elemento",',',false,false,('*',new
 * ContentModel()),BitSet(0).set(1),BitSet(168).set(45),AttributeList("1")),
 * new ContentModel() Verifies that an instance is created. content is equal
 * to ContentModel(("elemento",',',false,false,cm2,bs1,bs2,al)), type is 42
 * and next is new ContentModel()
 */
public void testContentModelIntObjectContentModel082() {
    try {
        ContentModel cmnext = new ContentModel();
        dtd = new DTDGetter("TestContentModelSemantic");
        ContentModel cm2 = new ContentModel('*', new ContentModel());
        BitSet bs1 = new BitSet(0);
        bs1.set(1);
        BitSet bs2 = new BitSet(168);
        bs2.set(45);
        AttributeList al = new AttributeList("1");
        Element el = dtd.defineElement("elemento", ',', false, false, cm2,
                bs1, bs2, al);
        cm2 = new ContentModel(el);

        cm = new ContentModel(42, cm2, cmnext);
        assertNotNull(cm);
        assertEquals(cm2, cm.content);
        assertEquals(42, cm.type);
        assertEquals(cmnext, cm.next);
    } catch (Exception e) {
        fail("Should not throw any exception but was: " + e);
    }
}
项目:freeVM    文件:ContentModelCompatilityTest.java   
/**
 * Test method for 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.first()'
 * ContentModel(Element( "elemento",',',false,false,('*',new
 * ContentModel()),BitSet(0).set(1),BitSet(168).set(45),AttributeList("1"))
 * Expected result Element( "elemento",',',false,false,('*',new
 * ContentModel()),BitSet(0).set(1),BitSet(168).set(45),AttributeList("1")
 */
public void testFirst022() {
    try {
        dtd = new DTDGetter("TestContentModelSemantic");
        ContentModel cm2 = new ContentModel('*', new ContentModel());
        BitSet bs1 = new BitSet(0);
        bs1.set(1);
        BitSet bs2 = new BitSet(168);
        bs2.set(45);
        AttributeList al = new AttributeList("1");
        Element el = dtd.defineElement("elemento", ',', false, false, cm2,
                bs1, bs2, al);
        cm2 = new ContentModel(el);
        ContentModel cm = new ContentModel(0, cm2);
        assertEquals(el, cm.first());
        fail("Should raise ClassCastException");
    } catch (ClassCastException e) {
        // Expected
    }
}
项目:freeVM    文件:ContentModelCompatilityTest.java   
/**
 * Test method for 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.toString()'
 * ContentModel(Element("elemento",',',false,false,('*',new
 * ContentModel()),BitSet(0).set(1),BitSet(168).set(45),AttributeList("1")
 * Expected: "elemento"
 */
public void testToString004() {
    try {
        dtd = new DTDGetter("TestContentModelSemantic");
        ContentModel cm2 = new ContentModel('*', new ContentModel());
        BitSet bs1 = new BitSet(0);
        bs1.set(1);
        BitSet bs2 = new BitSet(168);
        bs2.set(45);
        AttributeList al = new AttributeList("1");
        Element el = dtd.defineElement("elemento", ',', false, false, cm2,
                bs1, bs2, al);
        cm = new ContentModel(el);

        assertEquals("elemento", cm.toString());

    } catch (Exception e) {
        fail("Should not throw any exception but was: " + e);
    }
}
项目:freeVM    文件:ContentModelCompatilityTest.java   
/**
 * Test method for 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.toString()'
 * ContentModel(Element( "elemento",',',false,false,('*',new
 * ContentModel()),BitSet(0).set(1),BitSet(168).set(45),AttributeList("1") .
 * Expected result is "elemento"
 */
public void testToString022() {
    try {
        dtd = new DTDGetter("TestContentModelSemantic");
        ContentModel cm2 = new ContentModel('*', new ContentModel());
        BitSet bs1 = new BitSet(0);
        bs1.set(1);
        BitSet bs2 = new BitSet(168);
        bs2.set(45);
        AttributeList al = new AttributeList("1");
        Element el = dtd.defineElement("elemento", ',', false, false, cm2,
                bs1, bs2, al);
        cm2 = new ContentModel(el);
        ContentModel cm = new ContentModel(0, cm2);
        assertEquals("elemento", cm.toString());
    } catch (Exception e) {
        fail("Should not throw any exception but was: " + e);
    }
}
项目:freeVM    文件:ContentModelCompatilityTest.java   
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.ContentModel(int, Object,
 * ContentModel)' Parameters type=Integer.MIN_VALUE, el=
 * "",',',false,false,('*',new
 * ContentModel()),BitSet(128).set(1),BitSet(7),AttributeList("bigC",-2147483648,-1,"value",new
 * Vector(),new AttributeList(null)), new ContentModel() Verifies that an
 * instance is created. content is equal to el= "",',',false,false,('*',new
 * ContentModel()),BitSet(128).set(1),BitSet(7),AttributeList("bigC",-2147483648,-1,"value",new
 * Vector(),new AttributeList(null)), type is Integer.MIN_VALUE and next is
 * new ContentModel()
 */
public void testContentModelIntObjectContentModel080() {
    dtd = new DTDGetter("TestContentModelSemantic");
    ContentModel cmnext = new ContentModel();
    ContentModel cm2 = new ContentModel('*', new ContentModel());
    BitSet bs1 = new BitSet(128);
    bs1.set(1);
    BitSet bs2 = new BitSet(7);
    AttributeList al = new AttributeList("bigC", -2147483648, -1,
            "value", new Vector(), new AttributeList(null));
    Element el = dtd.defineElement("", '*', true, false, cm2, bs1, bs2,
            al);
    cm = new ContentModel(Integer.MIN_VALUE, el, cmnext);
    assertNotNull(cm);
    assertEquals(el, cm.content);
    assertEquals(Integer.MIN_VALUE, cm.type);
    assertEquals(cmnext, cm.next);
}
项目:freeVM    文件:ContentModelCompatilityTest.java   
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.getElements(Vector)'
 * ContentModel("",',',false,false,('*',new
 * ContentModel()),BitSet(128).set(1),BitSet(7),AttributeList("bigC",-2147483648,-1,"value",new
 * Vector(),new AttributeList(null)).getElements(null) Expected:
 * NullPointerException
 */
public void testGetElements005() {
    try {
        dtd = new DTDGetter("TestContentModelSemantic");
        ContentModel cm2 = new ContentModel('*', new ContentModel());
        BitSet bs1 = new BitSet(128);
        bs1.set(1);
        BitSet bs2 = new BitSet(7);
        AttributeList al = new AttributeList("bigC", -2147483648, -1,
                "value", new Vector(), new AttributeList(null));
        Element el = dtd.defineElement("", '*', true, false, cm2, bs1, bs2,
                al);
        cm = new ContentModel(el);
        cm.getElements(null);
        fail("Should raise NullPointerException");
    } catch (NullPointerException e) {
        // Expected
    }
}
项目:freeVM    文件:ContentModelCompatilityTest.java   
/**
 * Test method for 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.empty()'
 * ContentModel(Element( "elemento",',',false,false,('*',new
 * ContentModel()),BitSet(0).set(1),BitSet(168).set(45),AttributeList("1")
 * Expected result is false
 */
public void testEmpty022() {
    try {
        dtd = new DTDGetter("TestContentModelSemantic");
        ContentModel cm2 = new ContentModel('*', new ContentModel());
        BitSet bs1 = new BitSet(0);
        bs1.set(1);
        BitSet bs2 = new BitSet(168);
        bs2.set(45);
        AttributeList al = new AttributeList("1");
        Element el = dtd.defineElement("elemento", ',', false, false, cm2,
                bs1, bs2, al);
        cm2 = new ContentModel(el);
        ContentModel cm = new ContentModel(0, cm2);
        assertFalse(cm.empty());
    } catch (Exception e) {
        fail("Should not throw any exception but was: " + e);
    }
}
项目:freeVM    文件:ContentModelCompatilityTest.java   
/**
 * Test method for 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.first()'
 * ContentModel(Element("",',',false,false,('*',new
 * ContentModel()),BitSet(128).set(1),BitSet(7),AttributeList("bigC",-2147483648,-1,"value",new
 * Vector(),new AttributeList(null)) expected:
 * Element("",',',false,false,('*',new
 * ContentModel()),BitSet(128).set(1),BitSet(7),AttributeList("bigC",-2147483648,-1,"value",new
 * Vector(),new AttributeList(null))
 */
public void testFirst005() {
    try {
        dtd = new DTDGetter("TestContentModelSemantic");
        ContentModel cm2 = new ContentModel('*', new ContentModel());
        BitSet bs1 = new BitSet(128);
        bs1.set(1);
        BitSet bs2 = new BitSet(7);
        AttributeList al = new AttributeList("bigC", -2147483648, -1,
                "value", new Vector(), new AttributeList(null));
        Element el = dtd.defineElement("", '*', true, false, cm2, bs1, bs2,
                al);
        cm = new ContentModel(el);
        assertEquals(el, cm.first());
    } catch (Exception e) {
        fail("Should not throw any exception but was: " + e);
    }
}
项目:freeVM    文件:ContentModelCompatilityTest.java   
/**
 * Test method for
 * 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.getElements(Vector)'
 * ContentModel(0,ContentModel(43,ContentModel("elemento",',',false,false,('*',new
 * ContentModel()),BitSet(0).set(1),BitSet(168).set(45),AttributeList("1")))
 * parameter: new Vector() expected: "elemento",',',false,false,('*',new
 * ContentModel()),BitSet(0).set(1),BitSet(168).set(45),AttributeList("1")
 */
public void testGetElements044() {
    dtd = new DTDGetter("TestContentModelSemantic");
    Vector v = new Vector();
    ContentModel cm2 = new ContentModel('*', new ContentModel());
    BitSet bs1 = new BitSet(128);
    bs1.set(1);
    BitSet bs2 = new BitSet(7);
    AttributeList al = new AttributeList("bigC", -2147483648, -1,
            "value", new Vector(), new AttributeList(null));
    Element el = dtd.defineElement("", '*', true, false, cm2, bs1, bs2,
            al);
    cm2 = new ContentModel(el);
    ContentModel cm = new ContentModel(43, cm2);
    cm2.getElements(v);
    assertEquals("[]", v.toString());
}