externalid.scala

来自「JAVA 语言的函数式编程扩展」· SCALA 代码 · 共 91 行

SCALA
91
字号
/*                     __                                               *\**     ________ ___   / /  ___     Scala API                            ****    / __/ __// _ | / /  / _ |    (c) 2003-2008, LAMP/EPFL             ****  __\ \/ /__/ __ |/ /__/ __ |    http://www.scala-lang.org/           **** /____/\___/_/ |_/____/_/ | |                                         ****                          |/                                          **\*                                                                      */// $Id: ExternalID.scala 13898 2008-02-06 10:43:23Z michelou $package scala.xml.dtd/** an ExternalIDs - either PublicID or SystemID * * @author Burak Emir * @param  target target name of this PI * @param  text   text contained in this node, may not contain "?>"**/abstract class ExternalID  {  /** returns "PUBLIC "+publicLiteral+" SYSTEM "+systemLiteral */  override def toString(): String  /** returns "PUBLIC "+publicLiteral+" SYSTEM "+systemLiteral */   def toString(sb: StringBuilder): StringBuilder  def systemId: String}/** a system identifier * * @author Burak Emir * @param  systemLiteral the system identifier literal**/case class SystemID( systemId:String ) extends ExternalID with parsing.TokenTests{    if( !checkSysID(systemId) )    throw new IllegalArgumentException(      "can't use both \" and ' in systemLiteral"    )  /** returns " SYSTEM "+systemLiteral */  override def toString() =     Utility.systemLiteralToString(systemId)  override def toString(sb: StringBuilder): StringBuilder =     Utility.systemLiteralToString(sb, systemId)}/** a public identifier * * @author Burak Emir * @param  publicLiteral the public identifier literal * @param  systemLiteral (can be null for notation pubIDs) the system identifier literal**/case class PublicID(publicId: String, systemId: String)extends ExternalID with parsing.TokenTests {  if( !checkPubID( publicId ))    throw new IllegalArgumentException(      "publicId must consist of PubidChars"    )  if( (systemId ne null) && !checkSysID( systemId ) )    throw new IllegalArgumentException(      "can't use both \" and ' in systemId"    )  /** the constant "#PI" */  def label    = "#PI"  /** always empty */  def attribute = Node.NoAttributes  /** always empty */  def child = Nil  /** appends "PUBLIC "+publicId+" SYSTEM "+systemId to argument */  override def toString(sb: StringBuilder): StringBuilder = {    Utility.publicLiteralToString( sb, publicId ).append(' ')    if(systemId ne null)      Utility.systemLiteralToString( sb, systemId )    else      sb  }}

⌨️ 快捷键说明

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