org.sweble.wikitext.lazy.utils.XmlAttribute Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of swc-parser-lazy Show documentation
Show all versions of swc-parser-lazy Show documentation
A parser for MediaWiki's Wikitext.
/*
* This file is auto-generated.
* DO NOT MODIFY MANUALLY!
*
* Generated by AstNodeGenerator.
* Last generated: 2014-09-12 00:37:37.
*/
package org.sweble.wikitext.lazy.utils;
import de.fau.cs.osr.ptk.common.ast.*;
/**
* XML Attribute
* Grammar
*
* Ws* XmlName Ws* '=' Ws* '\'' AttributeValueSq* '\''
*
* Ws* XmlName Ws* '=' Ws* '"' ValueDqStar '"'
*
* Ws* XmlName Ws* '=' ValueNqStar
*
* Ws* XmlName
*
*
*/
public class XmlAttribute
extends InnerNode.InnerNode1
{
private static final long serialVersionUID = 1L;
// =========================================================================
public XmlAttribute()
{
super(new NodeList());
}
public XmlAttribute(String name, boolean hasValue)
{
super(new NodeList());
setName(name);
setHasValue(hasValue);
}
public XmlAttribute(String name, NodeList value, boolean hasValue)
{
super(value);
setName(name);
setHasValue(hasValue);
}
@Override
public int getNodeType()
{
return org.sweble.wikitext.lazy.AstNodeTypes.NT_XML_ATTRIBUTE;
}
// =========================================================================
// Properties
private String name;
public final String getName()
{
return this.name;
}
public final String setName(String name)
{
String old = this.name;
this.name = name;
return old;
}
private boolean hasValue;
public final boolean getHasValue()
{
return this.hasValue;
}
public final boolean setHasValue(boolean hasValue)
{
boolean old = this.hasValue;
this.hasValue = hasValue;
return old;
}
@Override
public final int getPropertyCount()
{
return 2;
}
@Override
public final AstNodePropertyIterator propertyIterator()
{
return new AstNodePropertyIterator()
{
@Override
protected int getPropertyCount()
{
return 2;
}
@Override
protected String getName(int index)
{
switch (index)
{
case 0:
return "name";
case 1:
return "hasValue";
default:
throw new IndexOutOfBoundsException();
}
}
@Override
protected Object getValue(int index)
{
switch (index)
{
case 0:
return XmlAttribute.this.getName();
case 1:
return XmlAttribute.this.getHasValue();
default:
throw new IndexOutOfBoundsException();
}
}
@Override
protected Object setValue(int index, Object value)
{
switch (index)
{
case 0:
return XmlAttribute.this.setName((String) value);
case 1:
return XmlAttribute.this.setHasValue((Boolean) value);
default:
throw new IndexOutOfBoundsException();
}
}
};
}
// =========================================================================
// Children
public final void setValue(NodeList value)
{
set(0, value);
}
public final NodeList getValue()
{
return (NodeList) get(0);
}
private static final String[] CHILD_NAMES = new String[] {"value"};
public final String[] getChildNames()
{
return CHILD_NAMES;
}
// =========================================================================
}