Save This Page
Home » apache-harmony-6.0-src-r917296-snapshot » java » lang » [javadoc | source]
    1   /*
    2    *  Licensed to the Apache Software Foundation (ASF) under one or more
    3    *  contributor license agreements.  See the NOTICE file distributed with
    4    *  this work for additional information regarding copyright ownership.
    5    *  The ASF licenses this file to You under the Apache License, Version 2.0
    6    *  (the "License"); you may not use this file except in compliance with
    7    *  the License.  You may obtain a copy of the License at
    8    *
    9    *     http://www.apache.org/licenses/LICENSE-2.0
   10    *
   11    *  Unless required by applicable law or agreed to in writing, software
   12    *  distributed under the License is distributed on an "AS IS" BASIS,
   13    *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14    *  See the License for the specific language governing permissions and
   15    *  limitations under the License.
   16    */
   17   /**
   18    * @author Roman S. Bushmanov
   19    */
   20   
   21   package java.lang;
   22   
   23   /**
   24    * @com.intel.drl.spec_ref
   25    *
   26    */
   27   public class Object {
   28   
   29   	public final Class<? extends Object> getClass() {
   30   		return VMClassRegistry.getClass(this);
   31   	}
   32   
   33   	public int hashCode() {
   34   		return VMMemoryManager.getIdentityHashCode(this);
   35   	}
   36   
   37   	public boolean equals(Object object) {
   38   		return this == object;
   39   	}
   40   
   41   	protected Object clone() throws CloneNotSupportedException {
   42   		if (!(this instanceof Cloneable)) {
   43   			throw new CloneNotSupportedException(
   44   					"Doesn't implement Cloneable interface!");
   45   		}
   46   		return VMMemoryManager.clone(this);
   47   	}
   48   
   49   	public String toString() {
   50   		return getClass().getName() + '@' + Integer.toHexString(hashCode());
   51   	}
   52   
   53   	public final void notify() {
   54           int status = VMThreadManager.notify(this);
   55           if (status == VMThreadManager.TM_ERROR_ILLEGAL_STATE) {
   56               throw new IllegalMonitorStateException();
   57           } else if (status != VMThreadManager.TM_ERROR_NONE) {
   58               throw new InternalError(
   59                   "Thread Manager internal error " + status);
   60           }
   61   	}
   62   
   63   	public final void notifyAll() {
   64           int status = VMThreadManager.notifyAll(this);
   65           if (status == VMThreadManager.TM_ERROR_ILLEGAL_STATE) {
   66               throw new IllegalMonitorStateException();
   67           } else if (status != VMThreadManager.TM_ERROR_NONE) {
   68               throw new InternalError(
   69                   "Thread Manager internal error " + status);
   70           }
   71   	}
   72   
   73   	public final void wait(long millis, int nanos) throws InterruptedException {
   74   		if(millis < 0 || nanos < 0 || nanos > 999999 ){
   75   			throw new IllegalArgumentException("Arguments don't match the expected range!");
   76   		}
   77           int status = VMThreadManager.wait(this, millis, nanos);
   78           if (status == VMThreadManager.TM_ERROR_INTERRUPT) {
   79               throw new InterruptedException();        
   80           } else if (status == VMThreadManager.TM_ERROR_ILLEGAL_STATE) {
   81               throw new IllegalMonitorStateException();
   82           } else if (status != VMThreadManager.TM_ERROR_NONE) {
   83              // throw new InternalError(
   84              //     "Thread Manager internal error " + status);
   85           }
   86   	}
   87   
   88   	public final void wait(long millis) throws InterruptedException {
   89   		wait(millis, 0);
   90   	}
   91   
   92   	public final void wait() throws InterruptedException {
   93           int status = VMThreadManager.wait(this, 0, 0);
   94           if (status == VMThreadManager.TM_ERROR_INTERRUPT) {
   95               throw new InterruptedException();        
   96           } else if (status == VMThreadManager.TM_ERROR_ILLEGAL_STATE) {
   97               throw new IllegalMonitorStateException();
   98           } else if (status != VMThreadManager.TM_ERROR_NONE) {
   99              // throw new InternalError(
  100              //     "Thread Manager internal error " + status);
  101           }
  102   	}
  103   
  104   	protected void finalize() throws Throwable {
  105   	}
  106   
  107   }

Save This Page
Home » apache-harmony-6.0-src-r917296-snapshot » java » lang » [javadoc | source]