⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xmlstartofelement.java

📁 JAVA在编译原理上的应用。
💻 JAVA
字号:
package lolo.scans;/** A recognizer to scan for <tt>&lt;aElementName</tt>.  * * @author <a href="http://www.inf.uos.de/bernd" target="_blank">Bernd K&uuml;hl</a>           (<a href="mailto:bernd@informatik.uni-osnabrueck.de">bernd@informatik.uni-osnabrueck.de</a>) */public class XMLStartOfElement extends Word {    /** To mark the start of a scan. */    protected boolean start = true;        /** Constructs a <tt>XMLStartOfElement</tt> to the start of the element <tt>elementName</tt>.     *     * @param elementName the element name.     * @throws IllegalArgumentException if <tt>elementName</tt> is <tt>null</tt> or contains no character.     */	public XMLStartOfElement(String elementName) throws IllegalArgumentException {        super(elementName);	}        	public void reset() {        super.reset();        start = true;	}        	public State nextChar(char ch) {        if (start) {            start = false;            return stateObject.set(                ch == '<',  // need more?                false       // found            );        }        return super.nextChar(ch);	}    	public String toString() {        return getClass().getName()+"[<"+word+"]";	}           private static final int ltHashCode = new Character('<').hashCode();    /** Returns a hash code for the object.     *     * @return a hash code for the object.     */    public int hashCode() {        return ltHashCode/2+super.hashCode()/2;    }    /** Indicates whether some other object is "equal to" this one.     *     * @return <tt>true</tt> if the receiver and <tt>obj</tt> are from the same class     * and if the element names are the same, <tt>false</tt> otherwise.     */    public boolean equals(Object obj) {        if (obj == null || !(obj instanceof XMLStartOfElement)) return false;        return super.equals(obj);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -