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

📄 element.java

📁 MG4J (Managing Gigabytes for Java) is a free full-text search engine for large document collections
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package it.unimi.dsi.mg4j.util.parser;/*		  * MG4J: Managing Gigabytes for Java * * Copyright (C) 2005-2007 Sebastiano Vigna  * *  This library is free software; you can redistribute it and/or modify it *  under the terms of the GNU Lesser General Public License as published by the Free *  Software Foundation; either version 2.1 of the License, or (at your option) *  any later version. * *  This library is distributed in the hope that it will be useful, but *  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License *  for more details. * *  You should have received a copy of the GNU Lesser General Public License *  along with this program; if not, write to the Free Software *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */import it.unimi.dsi.fastutil.Hash;import it.unimi.dsi.fastutil.objects.ReferenceLinkedOpenHashSet;import it.unimi.dsi.lang.MutableString;/** An HTML element type.  * @deprecated Moved to <code>dsiutils</code>. */@Deprecatedpublic final class Element {    /** The name of the type of this element. */	public final CharSequence name;	/** The length of {@link #name}. */	public final int nameLength;	/** Whether this element breaks the flow. */	public final boolean breaksFlow;	/** Whether this element is simple. */	public final boolean isSimple;	/** Whether this element has implicit closure. */	public final boolean isImplicit;	/** The content model for this element. */	final ReferenceLinkedOpenHashSet<Element> contentModel;	/** Creates a new element with the specified name. 	 * The element is assumed to break the flow, 	 * and neither being simple nor having implicit closure.	 *	 * @param name the name of the type of the new element.	 */	public Element( final CharSequence name ) {		this( name, true, false, false );	}	/** Creates a new element with the specified name and flags.	 * The element is assumed not to have implicit closure.	 *	 * @param name the name of the type of the new element.	 * @param breaksFlow true if this elements breaks the flow.	 * @param isSimple true if this element is simple.	 */	public Element( final CharSequence name, final boolean breaksFlow, final boolean isSimple ) {		this( name, breaksFlow, isSimple, false );	}	/** Creates a new element.	 *	 * @param name the name of the type of the new element.	 * @param breaksFlow true if this elements breaks the flow.	 * @param isSimple true if this element is simple.	 * @param isImplicit true if this element has implicit closure.	 */	public Element( final CharSequence name, final boolean breaksFlow, final boolean isSimple, final boolean isImplicit ) {		this.name = new MutableString( name );		this.nameLength = name.length();		this.breaksFlow = breaksFlow;		this.isSimple = isSimple;		this.isImplicit = isImplicit;		this.contentModel = new ReferenceLinkedOpenHashSet<Element>( Hash.DEFAULT_INITIAL_SIZE, .5f );	}	/** Returns the name of this element.	 * @return the name of this element.	 */	public String toString() {		return name.toString();	}	/* --- Tag Names ----------------------------------- */	public static final Element A = HTMLFactory.newElement( "a" );	public static final Element ABBR = HTMLFactory.newElement( "abbr" );	public static final Element ACRONYM = HTMLFactory.newElement( "acronym" );	public static final Element ADDRESS = HTMLFactory.newElement( "address" );	// deprecated	public static final Element APPLET = HTMLFactory.newElement( "applet" );	// forbidden	public static final Element AREA = HTMLFactory.newElement( "area", true, true );	// flowMaintainer	public static final Element B = HTMLFactory.newElement( "b", false, false );	// forbidden	public static final Element BASE = HTMLFactory.newElement( "base", true, true, false );	// flowMaintainer, forbidden, deprecated	public static final Element BASEFONT = HTMLFactory.newElement( "basefont", false, true );	public static final Element BDO = HTMLFactory.newElement( "bdo" );	// flowMaintainer	public static final Element BIG = HTMLFactory.newElement( "big", false, false );	public static final Element BLOCKQUOTE = HTMLFactory.newElement( "blockquote" );	// 2optional --- even opening is optiona	public static final Element BODY = HTMLFactory.newElement( "body", true, false, true );	// forbidden	public static final Element BR = HTMLFactory.newElement( "br", true, true );	public static final Element BUTTON = HTMLFactory.newElement( "button" );	public static final Element CAPTION = HTMLFactory.newElement( "caption" );	/*Deprecated*/  public static final Element CENTER = HTMLFactory.newElement( "center" );	public static final Element CITE = HTMLFactory.newElement( "cite" );	// flowMaintainer	public static final Element CODE = HTMLFactory.newElement( "code", false, false );	// forbidden	public static final Element COL = HTMLFactory.newElement( "col", true, true );	// optional	public static final Element COLGROUP = HTMLFactory.newElement( "colgroup", true, false, true );	// optional	public static final Element DD = HTMLFactory.newElement( "dd", true, false, true );	public static final Element DEL = HTMLFactory.newElement( "del" );	public static final Element DFN = HTMLFactory.newElement( "dfn" );	/*Deprecated*/  public static final Element DIR = HTMLFactory.newElement( "dir" );	public static final Element DIV = HTMLFactory.newElement( "div" );	public static final Element DL = HTMLFactory.newElement( "dl" );	// optional	public static final Element DT = HTMLFactory.newElement( "dt", true, false, true );	// flowMaintainer	public static final Element EM = HTMLFactory.newElement( "em", false, false );	// Nonstandard	public static final Element EMBED = HTMLFactory.newElement( "embed", false, false );	public static final Element FIELDSET = HTMLFactory.newElement( "fieldset" );	// flowMaintainer	/*Deprecated*/  public static final Element FONT = HTMLFactory.newElement( "font", false, false );	public static final Element FORM = HTMLFactory.newElement( "form" );	// forbidden	public static final Element FRAME = HTMLFactory.newElement( "frame", true, true );	public static final Element FRAMESET = HTMLFactory.newElement( "frameset" );	public static final Element H1 = HTMLFactory.newElement( "h1" );	public static final Element H2 = HTMLFactory.newElement( "h2" );	public static final Element H3 = HTMLFactory.newElement( "h3" );	public static final Element H4 = HTMLFactory.newElement( "h4" );	public static final Element H5 = HTMLFactory.newElement( "h5" );	public static final Element H6 = HTMLFactory.newElement( "h6" );	// 2optional --- even opening is optional	public static final Element HEAD = HTMLFactory.newElement( "head", true, false, true );	// forbidden	public static final Element HR = HTMLFactory.newElement( "hr", true, true );	// 2optional --- even opening is optional	public static final Element HTML = HTMLFactory.newElement( "html", true, false, true );	// flowMaintainer	public static final Element I = HTMLFactory.newElement( "i", false, false );	public static final Element IFRAME = HTMLFactory.newElement( "iframe" );	// flowMaintainer, forbidden	public static final Element IMG = HTMLFactory.newElement( "img", false, true );	// forbidden	public static final Element INPUT = HTMLFactory.newElement( "input", true, true );	public static final Element INS = HTMLFactory.newElement( "ins" );	// forbidden, deprecated	public static final Element ISINDEX = HTMLFactory.newElement( "isindex", true, true );	public static final Element KBD = HTMLFactory.newElement( "kbd" );	public static final Element LABEL = HTMLFactory.newElement( "label" );	public static final Element LEGEND = HTMLFactory.newElement( "legend" );	// optional	public static final Element LI = HTMLFactory.newElement( "li", true, false, true );	// forbidden	public static final Element LINK = HTMLFactory.newElement( "link", true, true );	public static final Element MAP = HTMLFactory.newElement( "map" );	public static final Element MENU = HTMLFactory.newElement( "menu" );	// forbidden	public static final Element META = HTMLFactory.newElement( "meta", true, true );	public static final Element NOFRAMES = HTMLFactory.newElement( "noframes" );	public static final Element NOSCRIPT = HTMLFactory.newElement( "noscript" );	public static final Element OBJECT = HTMLFactory.newElement( "object" );	public static final Element OL = HTMLFactory.newElement( "ol" );	// optional	public static final Element OPTION = HTMLFactory.newElement( "option", true, false, true );	public static final Element OPTGROUP = HTMLFactory.newElement( "optgroup" );	// optional	public static final Element P = HTMLFactory.newElement( "p", true, false, true );	// forbidden	public static final Element PARAM = HTMLFactory.newElement( "param", true, true );	public static final Element PRE = HTMLFactory.newElement( "pre" );	public static final Element Q = HTMLFactory.newElement( "q" );	// flowMaintainer	public static final Element SAMP = HTMLFactory.newElement( "samp", false, false );	public static final Element SCRIPT = HTMLFactory.newElement( "script" );	public static final Element SELECT = HTMLFactory.newElement( "select" );	// flowMaintainer	public static final Element SMALL = HTMLFactory.newElement( "small", false, false );	// flowMaintainer	public static final Element SPAN = HTMLFactory.newElement( "span", false, false );	// flowMaintainer, deprecated	public static final Element STRIKE = HTMLFactory.newElement( "strike", false, false );	// flowMaintainer, deprecated	public static final Element S = HTMLFactory.newElement( "s", false, false );	// flowMaintainer	public static final Element STRONG = HTMLFactory.newElement( "strong", false, false );	public static final Element STYLE = HTMLFactory.newElement( "style" );	public static final Element SUB = HTMLFactory.newElement( "sub" );	public static final Element SUP = HTMLFactory.newElement( "sup" );	public static final Element TABLE = HTMLFactory.newElement( "table" );	// 2optional --- even opening is optional	public static final Element TBODY = HTMLFactory.newElement( "tbody", true, false, true );	// optional	public static final Element TD = HTMLFactory.newElement( "td", true, false, true );	public static final Element TEXTAREA = HTMLFactory.newElement( "textarea" );	// optional	public static final Element TFOOT = HTMLFactory.newElement( "tfoot", true, false, true );	// optional	public static final Element TH = HTMLFactory.newElement( "th", true, false, true );	// optional	public static final Element THEAD = HTMLFactory.newElement( "thead", true, false, true );	public static final Element TITLE = HTMLFactory.newElement( "title" );	// optional	public static final Element TR = HTMLFactory.newElement( "tr", true, false, true );	// flowMaintainer	public static final Element TT = HTMLFactory.newElement( "tt", false, false );	// flowMaintainer, deprecated	public static final Element U = HTMLFactory.newElement( "u", false, false );	public static final Element UL = HTMLFactory.newElement( "ul" );	public static final Element VAR = HTMLFactory.newElement( "var" );	public static final Element UNKNOWN = HTMLFactory.newElement( "unknown" );	private static final ReferenceLinkedOpenHashSet<Element> HEADING = new ReferenceLinkedOpenHashSet<Element>( Hash.DEFAULT_INITIAL_SIZE, .5f );	private static final ReferenceLinkedOpenHashSet<Element> LIST = new ReferenceLinkedOpenHashSet<Element>( Hash.DEFAULT_INITIAL_SIZE, .5f );	private static final ReferenceLinkedOpenHashSet<Element> PREFORMATTED = new ReferenceLinkedOpenHashSet<Element>( Hash.DEFAULT_INITIAL_SIZE, .5f );	private static final ReferenceLinkedOpenHashSet<Element> FONTSTYLE = new ReferenceLinkedOpenHashSet<Element>( Hash.DEFAULT_INITIAL_SIZE, .5f );	private static final ReferenceLinkedOpenHashSet<Element> PHRASE = new ReferenceLinkedOpenHashSet<Element>( Hash.DEFAULT_INITIAL_SIZE, .5f );	private static final ReferenceLinkedOpenHashSet<Element> SPECIAL = new ReferenceLinkedOpenHashSet<Element>( Hash.DEFAULT_INITIAL_SIZE, .5f );	private static final ReferenceLinkedOpenHashSet<Element> FORM_CONTROL = new ReferenceLinkedOpenHashSet<Element>( Hash.DEFAULT_INITIAL_SIZE, .5f );	private static final ReferenceLinkedOpenHashSet<Element> INLINE = new ReferenceLinkedOpenHashSet<Element>( Hash.DEFAULT_INITIAL_SIZE, .5f );	private static final ReferenceLinkedOpenHashSet<Element> BLOCK = new ReferenceLinkedOpenHashSet<Element>( Hash.DEFAULT_INITIAL_SIZE, .5f );	private static final ReferenceLinkedOpenHashSet<Element> FLOW = new ReferenceLinkedOpenHashSet<Element>( Hash.DEFAULT_INITIAL_SIZE, .5f );	private static final ReferenceLinkedOpenHashSet<Element> PRE_EXCLUSION = new ReferenceLinkedOpenHashSet<Element>( Hash.DEFAULT_INITIAL_SIZE, .5f );		static {		// We define sets for several entities contained in the HTML 4.01 loose DTD (http://www.w3.org/TR/html4/loose.dtd).				/* <!ENTITY % heading "H1|H2|H3|H4|H5|H6">*/		HEADING.add( Element.H1 );		HEADING.add( Element.H2 );		HEADING.add( Element.H3 );		HEADING.add( Element.H4 );		HEADING.add( Element.H5 );		HEADING.add( Element.H6 );				/* <!ENTITY % list "UL | OL |  DIR | MENU"> */		LIST.add( Element.UL );		LIST.add( Element.OL );		LIST.add( Element.DIR );		LIST.add( Element.MENU );				/* <!ENTITY % preformatted "PRE"> */		PREFORMATTED.add( Element.PRE );				/*<!ENTITY % fontstyle "TT | I | B | U | S | STRIKE | BIG | SMALL"> */		FONTSTYLE.add( Element.TT );		FONTSTYLE.add( Element.I );		FONTSTYLE.add( Element.B );		FONTSTYLE.add( Element.U );		FONTSTYLE.add( Element.S );		FONTSTYLE.add( Element.STRIKE );		FONTSTYLE.add( Element.BIG );		FONTSTYLE.add( Element.SMALL );				/* <!ENTITY % phrase "EM | STRONG | DFN | CODE | SAMP | KBD | VAR | CITE | ABBR | ACRONYM" > */			PHRASE.add( Element.EM );		PHRASE.add( Element.STRONG );		PHRASE.add( Element.SAMP );		PHRASE.add( Element.CODE );		PHRASE.add( Element.KBD );		PHRASE.add( Element.DFN );		PHRASE.add( Element.VAR );		PHRASE.add( Element.CITE );		PHRASE.add( Element.ABBR );		PHRASE.add( Element.ACRONYM );				/* <!ENTITY % special "A | IMG | APPLET | OBJECT | FONT | BASEFONT | BR | SCRIPT |		   MAP | Q | SUB | SUP | SPAN | BDO | IFRAME"> */		SPECIAL.add( Element.A );		SPECIAL.add( Element.SPAN );		SPECIAL.add( Element.FONT );		SPECIAL.add( Element.IMG );		SPECIAL.add( Element.APPLET );		SPECIAL.add( Element.OBJECT );		SPECIAL.add( Element.BASEFONT );		SPECIAL.add( Element.BR );		SPECIAL.add( Element.EMBED );		SPECIAL.add( Element.SCRIPT );		SPECIAL.add( Element.MAP );		SPECIAL.add( Element.Q );		SPECIAL.add( Element.SUB );		SPECIAL.add( Element.SUP );		SPECIAL.add( Element.BDO );		SPECIAL.add( Element.IFRAME );				/* <!ENTITY % formctrl "INPUT | SELECT | TEXTAREA | LABEL | BUTTON"> */		FORM_CONTROL.add( Element.INPUT );		FORM_CONTROL.add( Element.SELECT );		FORM_CONTROL.add( Element.TEXTAREA );		FORM_CONTROL.add( Element.LABEL );		FORM_CONTROL.add( Element.BUTTON );				/* <!ENTITY % inline "#PCDATA | %fontstyle; | %phrase; | %special; | %formctrl;"> */		INLINE.addAll( PHRASE );		INLINE.addAll( FONTSTYLE );		INLINE.addAll( SPECIAL );		INLINE.addAll( FORM_CONTROL );		

⌨️ 快捷键说明

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