org.sweble.wikitext.lazy.parser.Url 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.parser;
import de.fau.cs.osr.ptk.common.ast.*;
/**
* Url
* Grammar
*
* Protocol ::= [A-Za-z] [A-Za-z0-9+\-.]*
*
* Path ::= [^\u0000-\u0020\u007F\uE000\u2028\u2029\u0085\"\[\]<>|]+
*
* Url ::= Scheme ':' Path
*
*
*/
public class Url
extends LeafNode
{
private static final long serialVersionUID = 1L;
// =========================================================================
public Url()
{
super();
}
public Url(String protocol, String path)
{
super();
setProtocol(protocol);
setPath(path);
}
@Override
public int getNodeType()
{
return org.sweble.wikitext.lazy.AstNodeTypes.NT_URL;
}
// =========================================================================
// Properties
private String protocol;
public final String getProtocol()
{
return this.protocol;
}
public final String setProtocol(String protocol)
{
String old = this.protocol;
this.protocol = protocol;
return old;
}
private String path;
public final String getPath()
{
return this.path;
}
public final String setPath(String path)
{
String old = this.path;
this.path = path;
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 "protocol";
case 1:
return "path";
default:
throw new IndexOutOfBoundsException();
}
}
@Override
protected Object getValue(int index)
{
switch (index)
{
case 0:
return Url.this.getProtocol();
case 1:
return Url.this.getPath();
default:
throw new IndexOutOfBoundsException();
}
}
@Override
protected Object setValue(int index, Object value)
{
switch (index)
{
case 0:
return Url.this.setProtocol((String) value);
case 1:
return Url.this.setPath((String) value);
default:
throw new IndexOutOfBoundsException();
}
}
};
}
// =========================================================================
// Children
// =========================================================================
}