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

📄 referencetype.java

📁 代码是一个分类器的实现,其中使用了部分weka的源代码。可以将项目导入eclipse运行
💻 JAVA
字号:
package de.fub.bytecode.generic;import de.fub.bytecode.Constants;import de.fub.bytecode.Repository;import de.fub.bytecode.classfile.JavaClass;/**  * Super class for objects and arrays. * * @version $Id: ReferenceType.java,v 1.11 2001/08/21 17:44:13 ehaase Exp $ * @author  <A HREF="http://www.berlin.de/~markus.dahm/">M. Dahm</A> */public class ReferenceType extends Type {  protected ReferenceType(byte t, String s) {    super(t, s);  }  /** Class is non-abstract but not instantiable from the outside   */  ReferenceType() {    super(Constants.T_OBJECT, "<null object>");  }  /**   * Return true iff this type is castable to another type t as defined in   * the JVM specification.  The case where this is Type.NULL is not   * defined (see the CHECKCAST definition in the JVM specification).   * However, because e.g. CHECKCAST doesn't throw a   * ClassCastException when casting a null reference to any Object,   * true is returned in this case.   */  public boolean isCastableTo(Type t){    if(this.equals(Type.NULL))      return true;		// If this is ever changed in isAssignmentCompatible()    return isAssignmentCompatibleWith(t); /* Yes, it's true: It's the same definition.					   * See vmspec2 AASTORE / CHECKCAST definitions.					   */  }  /**   * Return true iff this is assignment compatible with another type t   * as defined in the JVM specification; see the AASTORE definition   * there.   */  public boolean isAssignmentCompatibleWith(Type t) {    if(!(t instanceof ReferenceType))      return false;    ReferenceType T = (ReferenceType)t;    if(this.equals(Type.NULL))      return true; // This is not explicitely stated, but clear. Isn't it?    /* If this is a class type then     */    if((this instanceof ObjectType) && (((ObjectType) this).referencesClass())) {      /* If T is a class type, then this must be the same class as T,         or this must be a subclass of T;      */      if((T instanceof ObjectType) && (((ObjectType) T).referencesClass())) {	if(this.equals(T))	  return true;	if(Repository.instanceOf( ((ObjectType) this).getClassName(),				  ((ObjectType) T).getClassName()))	  return true;      }      /* If T is an interface type, this must implement interface T.       */      if ((T instanceof ObjectType) && (((ObjectType) T).referencesInterface())) {	if (Repository.implementationOf( ((ObjectType) this).getClassName(),					 ((ObjectType) T).getClassName() ))	  return true;      }    }    /* If this is an interface type, then:     */    if ((this instanceof ObjectType) && (((ObjectType) this).referencesInterface())){      /* If T is a class type, then T must be Object (

⌨️ 快捷键说明

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