java::lang::Object Class Reference

Inherited by java::awt::BorderLayout [virtual], java::awt::CheckboxGroup [virtual], java::awt::Color [virtual], java::awt::color::ColorSpace [virtual], java::awt::Component [virtual], java::awt::ComponentOrientation [virtual], java::awt::FlowLayout [virtual], java::awt::Font [virtual], java::awt::FontMetrics [virtual], java::awt::geom::AffineTransform [virtual], java::awt::geom::Dimension2D [virtual], java::awt::geom::Line2D [virtual], java::awt::geom::Point2D [virtual], java::awt::Graphics [virtual], java::awt::GridLayout [virtual], java::awt::Image [virtual], java::awt::image::ColorModel [virtual], java::awt::image::DataBuffer [virtual], java::awt::image::ImageFilter [virtual], java::awt::Insets [virtual], java::awt::MenuComponent [virtual], java::awt::MenuShortcut [virtual], java::awt::Toolkit [virtual], java::io::Bits, java::io::BufferedInputStream [virtual], java::io::BufferedOutputStream [virtual], java::io::BufferedReader [virtual], java::io::BufferedWriter [virtual], java::io::ByteArrayInputStream [virtual], java::io::ByteArrayOutputStream [virtual], java::io::ByteOrder, java::io::CharArrayReader [virtual], java::io::CharArrayWriter [virtual], java::io::CharsetCoder, java::io::CoderResult, java::io::CodingErrorAction, java::io::File [virtual], java::io::FileDescriptor [virtual], java::io::FileInputStream [virtual], java::io::FileOutputStream [virtual], java::io::FilterInputStream [virtual], java::io::FilterOutputStream [virtual], java::io::FilterReader [virtual], java::io::FilterWriter [virtual], java::io::InputStreamReader [virtual], java::io::OutputStreamWriter [virtual], java::io::PrintStream [virtual], java::io::Properties [virtual], java::io::RandomAccessFile [virtual], java::io::System [virtual], java::lang::Array< Type >, java::lang::Array< char >, java::lang::Array< int >, java::lang::Array< java::lang::Array< char > >, java::lang::Array< java::lang::Array< int > >, java::lang::Array< java::lang::Array< short > >, java::lang::Array< java::lang::String >, java::lang::Boolean, java::lang::Character [virtual], java::lang::Character::Subset [virtual], java::lang::Class, java::lang::Interface [virtual], java::lang::Math [virtual], java::lang::Number [virtual], java::lang::Scope [virtual], java::lang::String [virtual], java::lang::Thread [virtual], java::lang::Throwable [virtual], java::net::DatagramPacket [virtual], java::net::InetAddress [virtual], java::net::NetworkInterface [virtual], java::net::ServerSocket [virtual], java::net::Socket [virtual], java::net::SocketAddress [virtual], java::text::AttributedCharacterIterator::Attribute [virtual], java::util::Calendar, java::util::Date [virtual], java::util::DSTRule, java::util::EventListenerProxy [virtual], java::util::EventObject [virtual], java::util::FMath, java::util::ListQueue [virtual], java::util::ListStack [virtual], java::util::PreferenceLock [virtual], java::util::PriorityQueue [virtual], java::util::Random [virtual], java::util::Timer [virtual], and java::util::TimeZone.

List of all members.


Detailed Description

Class Object is the root of the class hierarchy.

Every class has Object as a superclass. All objects, including arrays, implement the methods of this class.

All the Interface should be inherited as virtual base class. All concrete class other then Object should be inherited as direct base class. Methods should return const Object& for reference (no deletion required, the providing class will delete it later, eg. instance from a global Map) Methods should return Object for copy of object instance. (no deletion required, but excessive copy decrease the efficiency) Usually, when the object size is small and it return a copy of its own type we will prefer return Object. If the returned object is large or an interface or any polymorphic objects, we will prefer use the return ObjectRef instead. Methods should return Object* for instance need to be deleted later by the receiving party. Methods should return ObjectRef to provide the object reference, auto-deletion and avoid excesive object copy. (Preferable but looks messy)

regular java member -> virtual member final java member -> regular member

Author:
Yuh-Jye Chang
Version:
1.0, 06/11/02

Public Member Functions

 Object ()
 Object (const Object &src)
virtual ~Object ()
virtual jboolean equals (const Object &src) const
 Indicates whether some other object is "equal to" this one.
virtual jint hashCode () const
 Returns a hash code value for the object.
virtual String toString () const
 Returns a string representation of the object.
virtual ObjectRef clone () const
 Creates and returns a copy of this object.

Friends

class ObjectRef

Constructor & Destructor Documentation

java::lang::Object::Object (  )  [inline]

java::lang::Object::Object ( const Object src  )  [inline]

virtual java::lang::Object::~Object (  )  [inline, virtual]


Member Function Documentation

virtual jboolean java::lang::Object::equals ( const Object src  )  const [virtual]

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation:

The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any reference values x and y, this method returns true if and only if x and y refer to the same object (x==y has the value true).

Parameters:
obj the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

Reimplemented in java::awt::Color, java::awt::Dimension, java::awt::Font, java::awt::Insets, java::awt::MenuShortcut, java::awt::Point, java::awt::Rectangle, java::awt::geom::AffineTransform, java::awt::geom::Point2D, java::awt::geom::Point2D, java::awt::geom::Rectangle2D, java::awt::image::ColorModel, java::io::Charset, java::io::File, java::io::FileDescriptor, java::lang::Array< Type >, java::lang::Boolean, java::lang::Byte, java::lang::Character, java::lang::Double, java::lang::Float, java::lang::Integer, java::lang::Long, java::lang::ObjectRef, java::lang::Short, java::lang::String, java::net::InetAddress, java::net::InetSocketAddress, java::net::NetworkInterface, java::util::AbstractList, java::util::AbstractMap, java::util::AbstractMap::SimpleEntry, java::util::AbstractMap::ImmutableEntry, java::util::AbstractSet, java::util::ArrayList, java::util::Calendar, java::util::Date, java::util::GregorianCalendar, java::util::DSTRule, java::util::SimpleTimeZone, java::util::TreeMap, java::util::TreeSet, java::lang::Array< java::lang::String >, java::lang::Array< int >, java::lang::Array< java::lang::Array< int > >, java::lang::Array< java::lang::Array< short > >, java::lang::Array< char >, and java::lang::Array< java::lang::Array< char > >.

virtual jint java::lang::Object::hashCode (  )  const [virtual]

Returns a hash code value for the object.

This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.

The general contract of hashCode is:

As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the Java<font size="-2">TM</font> programming language.)

Returns:
a hash code value for this object.

Reimplemented in java::awt::Color, java::awt::Dimension, java::awt::Font, java::awt::Insets, java::awt::MenuShortcut, java::awt::Point, java::awt::Rectangle, java::awt::geom::AffineTransform, java::awt::geom::Point2D, java::awt::geom::Point2D, java::awt::geom::Rectangle2D, java::awt::image::ColorModel, java::io::Charset, java::io::File, java::io::FileDescriptor, java::lang::Array< Type >, java::lang::Boolean, java::lang::Byte, java::lang::Character, java::lang::Double, java::lang::Float, java::lang::Integer, java::lang::Long, java::lang::ObjectRef, java::lang::Short, java::lang::String, java::net::InetAddress, java::net::InetSocketAddress, java::net::NetworkInterface, java::util::AbstractList, java::util::AbstractMap, java::util::AbstractMap::SimpleEntry, java::util::AbstractMap::ImmutableEntry, java::util::AbstractSet, java::util::ArrayList, java::util::Calendar, java::util::Date, java::util::GregorianCalendar, java::util::DSTRule, java::util::SimpleTimeZone, java::util::TreeMap, java::util::TreeSet, java::lang::Array< java::lang::String >, java::lang::Array< int >, java::lang::Array< java::lang::Array< int > >, java::lang::Array< java::lang::Array< short > >, java::lang::Array< char >, and java::lang::Array< java::lang::Array< char > >.

virtual String java::lang::Object::toString (  )  const [virtual]

Returns a string representation of the object.

In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `</code>', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: <blockquote>

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 
</blockquote>

Returns:
a string representation of the object.

Reimplemented in java::awt::AWTEvent, java::awt::BorderLayout, java::awt::Button, java::awt::Checkbox, java::awt::CheckboxGroup, java::awt::CheckboxMenuItem, java::awt::Choice, java::awt::Color, java::awt::Component, java::awt::Container, java::awt::Dialog, java::awt::Dimension, java::awt::FlowLayout, java::awt::Font, java::awt::FontMetrics, java::awt::Frame, java::awt::Graphics, java::awt::GridLayout, java::awt::Insets, java::awt::ListBox, java::awt::Menu, java::awt::MenuBar, java::awt::MenuComponent, java::awt::MenuItem, java::awt::MenuShortcut, java::awt::Point, java::awt::Rectangle, java::awt::Scrollbar, java::awt::TextComponent, java::awt::Window, java::awt::event::InvocationEvent, java::awt::geom::AffineTransform, java::awt::geom::Point2D, java::awt::geom::Point2D, java::awt::geom::RectangularShape, java::awt::image::ColorModel, java::io::ByteArrayOutputStream, java::io::ByteOrder, java::io::CharArrayWriter, java::io::Charset, java::io::CoderResult, java::io::CodingErrorAction, java::io::File, java::io::Properties, java::lang::Array< Type >, java::lang::Boolean, java::lang::Byte, java::lang::Character::Subset, java::lang::Character, java::lang::Class, java::lang::Double, java::lang::Float, java::lang::Integer, java::lang::Long, java::lang::ObjectRef, java::lang::Short, java::lang::String, java::lang::Thread, java::lang::Throwable, java::net::DatagramSocketImpl, java::net::InetAddress, java::net::InetSocketAddress, java::net::NetworkInterface, java::net::ServerSocket, java::net::Socket, java::net::SocketImpl, java::text::AttributedCharacterIterator::Attribute, java::util::AbstractCollection, java::util::AbstractList, java::util::AbstractMap, java::util::AbstractMap::SimpleEntry, java::util::AbstractMap::ImmutableEntry, java::util::AbstractSet, java::util::ArrayList, java::util::Calendar, java::util::Date, java::util::EventObject, java::util::PriorityQueue, java::util::TreeMap, java::util::TreeSet, java::lang::Array< java::lang::String >, java::lang::Array< int >, java::lang::Array< java::lang::Array< int > >, java::lang::Array< java::lang::Array< short > >, java::lang::Array< char >, and java::lang::Array< java::lang::Array< char > >.

virtual ObjectRef java::lang::Object::clone (  )  const [virtual]

Creates and returns a copy of this object.

The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression: <blockquote>

 x.clone() != x
</blockquote> will be true, and that the expression: <blockquote>
 x.clone().getClass() == x.getClass()
</blockquote> will be true, but these are not absolute requirements. While it is typically the case that: <blockquote>
 x.clone().equals(x)
</blockquote> will be true, this is not an absolute requirement. Copying an object will typically entail creating a new instance of its class, but it also may require copying of internal data structures as well. No constructors are called.

The method clone for class Object performs a specific cloning operation. First, if the class of this object does not implement the interface Cloneable, then a CloneNotSupportedException is thrown. Note that all arrays are cons idered to implement the interface Cloneable. Otherwise, this method creates a new instance of the class of this object and initializes all its fields with exactly the contents of the corresponding fields of this object, as if by assignment; the contents of the fields are not themselves cloned. Thus, this method performs a "shallow copy" of this object, not a "deep copy" operation.

The class Object does not itself implement the interface Cloneable, so calling the clone method on an object whose class is Object will result in throwing an exception at run time. The clone method is implemented by the class Object as a convenient, general utility for subclasses that implement the interface Cloneable, possibly also overriding the clone method, in which case the overriding definition can refer to this utility definition by the call: <blockquote>

 super.clone()
</blockquote>

Returns:
a clone of this instance.
Exceptions:
CloneNotSupportedException if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.
OutOfMemoryError if there is not enough memory.


Friends And Related Function Documentation

friend class ObjectRef [friend]


The documentation for this class was generated from the following file:
Generated on Fri May 16 11:56:39 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3