001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: /**
018: * @author Roman S. Bushmanov
019: * @version $Revision: 1.1.2.1.4.3 $
020: */package java.lang;
021:
022: /**
023: * @com.intel.drl.spec_ref
024: *
025: */
026: public class Object {
027:
028: public final Class<? extends Object> getClass() {
029: return VMClassRegistry.getClass(this );
030: }
031:
032: public int hashCode() {
033: return VMMemoryManager.getIdentityHashCode(this );
034: }
035:
036: public boolean equals(Object object) {
037: return this == object;
038: }
039:
040: protected Object clone() throws CloneNotSupportedException {
041: if (!(this instanceof Cloneable)) {
042: throw new CloneNotSupportedException(
043: "Doesn't implement Cloneable interface!");
044: }
045: return VMMemoryManager.clone(this );
046: }
047:
048: public String toString() {
049: return getClass().getName() + '@'
050: + Integer.toHexString(hashCode());
051: }
052:
053: public final void notify() {
054: int status = VMThreadManager.notify(this );
055: if (status == VMThreadManager.TM_ERROR_ILLEGAL_STATE) {
056: throw new IllegalMonitorStateException();
057: } else if (status != VMThreadManager.TM_ERROR_NONE) {
058: throw new InternalError("Thread Manager internal error "
059: + status);
060: }
061: }
062:
063: public final void notifyAll() {
064: int status = VMThreadManager.notifyAll(this );
065: if (status == VMThreadManager.TM_ERROR_ILLEGAL_STATE) {
066: throw new IllegalMonitorStateException();
067: } else if (status != VMThreadManager.TM_ERROR_NONE) {
068: throw new InternalError("Thread Manager internal error "
069: + status);
070: }
071: }
072:
073: public final void wait(long millis, int nanos)
074: throws InterruptedException {
075: if (millis < 0 || nanos < 0 || nanos > 999999) {
076: throw new IllegalArgumentException(
077: "Arguments don't match the expected range!");
078: }
079: int status = VMThreadManager.wait(this , millis, nanos);
080: if (status == VMThreadManager.TM_ERROR_INTERRUPT) {
081: throw new InterruptedException();
082: } else if (status == VMThreadManager.TM_ERROR_ILLEGAL_STATE) {
083: throw new IllegalMonitorStateException();
084: } else if (status != VMThreadManager.TM_ERROR_NONE) {
085: // throw new InternalError(
086: // "Thread Manager internal error " + status);
087: }
088: }
089:
090: public final void wait(long millis) throws InterruptedException {
091: wait(millis, 0);
092: }
093:
094: public final void wait() throws InterruptedException {
095: int status = VMThreadManager.wait(this , 0, 0);
096: if (status == VMThreadManager.TM_ERROR_INTERRUPT) {
097: throw new InterruptedException();
098: } else if (status == VMThreadManager.TM_ERROR_ILLEGAL_STATE) {
099: throw new IllegalMonitorStateException();
100: } else if (status != VMThreadManager.TM_ERROR_NONE) {
101: // throw new InternalError(
102: // "Thread Manager internal error " + status);
103: }
104: }
105:
106: protected void finalize() throws Throwable {
107: }
108:
109: }
|